corda/docker/build.gradle

102 lines
3.5 KiB
Groovy
Raw Permalink Normal View History

evaluationDependsOn(":node:capsule")
import com.bmuschko.gradle.docker.tasks.image.DockerBuildImage
2018-12-03 16:25:34 +00:00
import com.bmuschko.gradle.docker.tasks.image.DockerPushImage
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
apply plugin: 'kotlin'
apply plugin: 'application'
apply plugin: 'com.bmuschko.docker-remote-api'
// We need to set mainClassName before applying the shadow plugin.
mainClassName = 'net.corda.core.ConfigExporterMain'
apply plugin: 'com.github.johnrengelman.shadow'
repositories {
maven {
url "${artifactory_contextUrl}/corda-releases"
}
maven {
url "${artifactory_contextUrl}/corda-dev"
}
}
configurations {
artifactoryCorda
}
dependencies{
compile project(':node')
artifactoryCorda "net.corda:corda:${project.version}"
}
shadowJar {
baseName = 'config-exporter'
classifier = null
version = null
zip64 true
}
2018-12-03 16:25:34 +00:00
docker{
registryCredentials {
WIP Kubenetes parallel build (#5396) * Split integration tests * add simple example of printing all methods annotated with @Test * add docker plugin to root project remove docker plugin from child projects add Dockerfile for image to use when testing add task to build testing image to root project * add comment describing proposed testing workflow * simple attempt at running tests in docker container * add my first k8s interaction script * add fabric8 as dependnency to buildSrc * before adding classpath * collect reports from containers and run through testReports * re-enable kubes backed testing * for each project 1. add a list tests task 2. use this list tests task to modify the included tests 3. add a parallel version of the test task * tweak logic for downloading test report XML files * use output of parallel testing tasks in report tasks to determine build resultCode * prepare for jenkins test * prepare for jenkins test * make docker reg password system property * add logging to print out docker reg creds * enable docker build * fix gradle build file * gather xml files into root project * change log level for gradle modification * stop printing gradle docker push passwd * tidy up report generation * fix compilation errors * split signature constraints test into two * change Sig constraint tests type hierarchy * tidy up build.gradle * try method based test includes * add unit test for test listing * fix bug with test slicing * stop filtering ignored tests to make the numbers match existing runs * change log level to ensure print out * move all plugin logic to buildSrc files * tidy up test modification add comments to explain what DistributedTesting plugin does * move new plugins into properly named packages * tidy up runConfigs * fix compile errors due to merge with slow-integration-test work * add system parameter to enable / disable build modification * add -Dkubenetise to build command * address review comments * type safe declaration of parameters in KubesTest
2019-09-03 15:40:08 +00:00
url = System.env.DOCKER_URL ?: "hub.docker.com"
2018-12-03 16:25:34 +00:00
username = System.env.DOCKER_USERNAME
password = System.env.DOCKER_PASSWORD
}
}
task buildDockerFolder(dependsOn: [":node:capsule:buildCordaJAR", shadowJar]) {
doLast {
def cordaJar = configurations.artifactoryCorda.singleFile
project.copy {
into new File(project.buildDir, "docker-temp")
from "src/bash/run-corda.sh"
from cordaJar.path
from shadowJar.archivePath
from "src/config/starting-node.conf"
from "src/bash/generate-config.sh"
from "src/docker/DockerfileAL"
from "src/docker/Dockerfile"
rename(cordaJar.name, "corda.jar")
rename(shadowJar.archivePath.name, "config-exporter.jar")
}
}
}
2018-12-03 16:25:34 +00:00
final String runTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))
final String suffix = project.version.toString().toLowerCase().contains("snapshot") ? runTime : "RELEASE"
final zuluBuildTags = ["corda/corda-zulu-${project.version.toString().toLowerCase()}:${suffix}", "corda/corda-zulu-${project.version.toString().toLowerCase()}:latest"]
final correttoBuildTags = ["corda/corda-corretto-${project.version.toString().toLowerCase()}:${suffix}", "corda/corda-corretto-${project.version.toString().toLowerCase()}:latest"]
2018-12-03 16:25:34 +00:00
task buildOfficialZuluDockerImage(type: DockerBuildImage, dependsOn: [buildDockerFolder]) {
inputDir = new File(project.buildDir, "docker-temp")
tags = zuluBuildTags
dockerFile = new File(new File(project.buildDir, "docker-temp"), "Dockerfile")
2018-12-03 16:25:34 +00:00
}
task buildOfficialCorrettoDockerImage(type: DockerBuildImage, dependsOn: [buildDockerFolder]) {
inputDir = new File(project.buildDir, "docker-temp")
tags = correttoBuildTags
dockerFile = new File(new File(project.buildDir, "docker-temp"), "DockerfileAL")
}
task pushZuluTimeStampedTag('type': DockerPushImage, dependsOn: [buildOfficialZuluDockerImage]){
imageName = zuluBuildTags[0]
}
task pushZuluLatestTag('type': DockerPushImage, dependsOn: [buildOfficialZuluDockerImage]){
imageName = zuluBuildTags[1]
}
task pushCorrettoTimeStampedTag('type': DockerPushImage, dependsOn: [buildOfficialCorrettoDockerImage]){
imageName = correttoBuildTags[0]
2018-12-03 16:25:34 +00:00
}
task pushCorrettoLatestTag('type': DockerPushImage, dependsOn: [buildOfficialCorrettoDockerImage]){
imageName = correttoBuildTags[1]
2018-12-03 16:25:34 +00:00
}
task pushOfficialImages(dependsOn: [pushZuluTimeStampedTag, pushZuluLatestTag, pushCorrettoTimeStampedTag, pushCorrettoLatestTag])