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
This commit is contained in:
Ronan Browne 2022-01-19 10:34:35 +00:00 committed by GitHub
parent 857b8aa286
commit 2d2289b3bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 23 deletions

View File

@ -319,7 +319,7 @@ pipeline {
'./gradlew', './gradlew',
COMMON_GRADLE_PARAMS, COMMON_GRADLE_PARAMS,
'docker:pushDockerImage', 'docker:pushDockerImage',
'-Pdocker.image.repository=corda/corda', '-Pdocker.image.repository=corda/community-node',
'--image OFFICIAL' '--image OFFICIAL'
].join(' ') ].join(' ')
} }

View File

@ -33,47 +33,34 @@ shadowJar {
} }
enum ImageVariant { enum ImageVariant {
UBUNTU_ZULU("zulu", "Dockerfile", "1.8"), UBUNTU_ZULU("Dockerfile", "1.8", "zulu-openjdk8"),
UBUNTU_ZULU_11("zulu", "Dockerfile11", "11"), UBUNTU_ZULU_11("Dockerfile11", "11", "zulu-openjdk11"),
AL_CORRETTO("corretto", "DockerfileAL", "1.8"), AL_CORRETTO("DockerfileAL", "1.8", "amazonlinux2"),
OFFICIAL(UBUNTU_ZULU) OFFICIAL(UBUNTU_ZULU)
String knownAs
String dockerFile String dockerFile
String javaVersion String javaVersion
String baseImgaeFullName
String versionString(String baseTag, String version) {
return "${baseTag}-${knownAs}" +
(knownAs.isEmpty() ? "" : "-") +
"java${javaVersion}-" + version
}
ImageVariant(ImageVariant other) { ImageVariant(ImageVariant other) {
this.knownAs = other.knownAs
this.dockerFile = other.dockerFile this.dockerFile = other.dockerFile
this.javaVersion = other.javaVersion this.javaVersion = other.javaVersion
this.baseImgaeFullName = other.baseImgaeFullName
} }
ImageVariant(String knownAs, String dockerFile, String javaVersion) { ImageVariant(String dockerFile, String javaVersion, String baseImgaeFullName) {
this.knownAs = knownAs
this.dockerFile = dockerFile this.dockerFile = dockerFile
this.javaVersion = javaVersion this.javaVersion = javaVersion
this.baseImgaeFullName = baseImgaeFullName
} }
static final String getRepository(Project project) { static final String getRepository(Project project) {
return project.properties.getOrDefault("docker.image.repository", "corda/corda") 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<Identifier> buildTags(Project project) { Set<Identifier> buildTags(Project project) {
final String suffix = project.version.toString().toLowerCase().contains("snapshot") ? runTime : "RELEASE" return ["${project.version.toString().toLowerCase()}-${baseImgaeFullName}"].stream().map {
return [suffix, "latest"].stream().map { toAppend -> "${getRepository(project)}:${toAppend}".toString()
toAppend -> "${getName(project)}:${toAppend}".toString()
}.map(Identifier.&fromCompoundString).collect(Collectors.toSet()) }.map(Identifier.&fromCompoundString).collect(Collectors.toSet())
} }