From 2d2289b3bf4d79650efe063e0aef62072f473ace Mon Sep 17 00:00:00 2001 From: Ronan Browne Date: Wed, 19 Jan 2022 10:34:35 +0000 Subject: [PATCH] ENT-6426: update docker tagging inline with our dockerhub policies (#7027) * ENT-6426: update docker tahhing inline with our policies old corda/corda-zulu-java1.8-4.8.5:latest new corda/corda:4.8.5-zulu-1.8 based on pattern {repo}:{version}-{base-Image} * ENT-6426: update docker tahhing inline with our policies old corda/corda-zulu-java1.8-4.8.5:latest new corda/corda:4.8.5-zulu-openjdk8 based on pattern {repo}:{version}-{base-Image} Remove some redundant code * ENT-6426 update corda repo tagging --- .ci/dev/regression/Jenkinsfile | 2 +- docker/build.gradle | 31 +++++++++---------------------- 2 files changed, 10 insertions(+), 23 deletions(-) diff --git a/.ci/dev/regression/Jenkinsfile b/.ci/dev/regression/Jenkinsfile index aa22fce3f3..b53e23d557 100644 --- a/.ci/dev/regression/Jenkinsfile +++ b/.ci/dev/regression/Jenkinsfile @@ -319,7 +319,7 @@ pipeline { './gradlew', COMMON_GRADLE_PARAMS, 'docker:pushDockerImage', - '-Pdocker.image.repository=corda/corda', + '-Pdocker.image.repository=corda/community-node', '--image OFFICIAL' ].join(' ') } diff --git a/docker/build.gradle b/docker/build.gradle index 394826e3a7..09fb2ba8e6 100644 --- a/docker/build.gradle +++ b/docker/build.gradle @@ -33,47 +33,34 @@ shadowJar { } enum ImageVariant { - UBUNTU_ZULU("zulu", "Dockerfile", "1.8"), - UBUNTU_ZULU_11("zulu", "Dockerfile11", "11"), - AL_CORRETTO("corretto", "DockerfileAL", "1.8"), + UBUNTU_ZULU("Dockerfile", "1.8", "zulu-openjdk8"), + UBUNTU_ZULU_11("Dockerfile11", "11", "zulu-openjdk11"), + AL_CORRETTO("DockerfileAL", "1.8", "amazonlinux2"), OFFICIAL(UBUNTU_ZULU) - String knownAs String dockerFile String javaVersion - - String versionString(String baseTag, String version) { - return "${baseTag}-${knownAs}" + - (knownAs.isEmpty() ? "" : "-") + - "java${javaVersion}-" + version - } + String baseImgaeFullName ImageVariant(ImageVariant other) { - this.knownAs = other.knownAs this.dockerFile = other.dockerFile this.javaVersion = other.javaVersion + this.baseImgaeFullName = other.baseImgaeFullName } - ImageVariant(String knownAs, String dockerFile, String javaVersion) { - this.knownAs = knownAs + ImageVariant(String dockerFile, String javaVersion, String baseImgaeFullName) { this.dockerFile = dockerFile this.javaVersion = javaVersion + this.baseImgaeFullName = baseImgaeFullName } static final String getRepository(Project project) { return project.properties.getOrDefault("docker.image.repository", "corda/corda") } - static private final String runTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")) - - def getName(Project project) { - return versionString(getRepository(project), project.version.toString().toLowerCase()) - } - Set buildTags(Project project) { - final String suffix = project.version.toString().toLowerCase().contains("snapshot") ? runTime : "RELEASE" - return [suffix, "latest"].stream().map { - toAppend -> "${getName(project)}:${toAppend}".toString() + return ["${project.version.toString().toLowerCase()}-${baseImgaeFullName}"].stream().map { + toAppend -> "${getRepository(project)}:${toAppend}".toString() }.map(Identifier.&fromCompoundString).collect(Collectors.toSet()) }