Skip to content

Commit

Permalink
Docker tag prefixes for RC versions (#901)
Browse files Browse the repository at this point in the history
-- create latest and x.y tag prefixes for non-develop and non-rc releases
  • Loading branch information
usmansaleem authored Sep 6, 2023
1 parent a1bf6ba commit cbd6cec
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ plugins {
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'me.champeau.gradle.jmh' version '0.5.3' apply false
id 'net.ltgt.errorprone' version '2.0.2'
id 'org.ajoberstar.grgit' version '4.1.1'
id 'org.ajoberstar.grgit' version '5.2.0'
}

if (!JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17)) {
Expand All @@ -47,7 +47,6 @@ if (!JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17)) {

rootProject.version = calculatePublishVersion()
def specificVersion = calculateVersion()
def isDevelopBuild = rootProject.version.contains('develop')

group = 'tech.pegasys.web3signer'

Expand Down Expand Up @@ -506,22 +505,30 @@ task testDocker {
}
}

task uploadDocker {
dependsOn([distDocker])
def dockerBuildVersion = "${rootProject.version}".replace('+', '-')
def architecture = System.getenv('architecture')
def platform = System.getenv('platform')

def dockerTagPrefixes(String dockerBuildVersion) {
def versionPrefixes = [dockerBuildVersion]
if (project.hasProperty('branch') && project.property('branch') == 'master') {
versionPrefixes.add('develop')
}

if (!isDevelopBuild) {
// add `latest` tag for non-develop and non-rc versions
if (!rootProject.version.contains('develop') && !rootProject.version.toLowerCase().contains('-rc')) {
versionPrefixes.add('latest')
// when docker build version is x.y.[a,b..] we would also like to use tag x.y
versionPrefixes.add(dockerBuildVersion.split(/\./)[0..1].join('.'))
}

return versionPrefixes
}

task uploadDocker {
dependsOn([distDocker])
def dockerBuildVersion = "${rootProject.version}".replace('+', '-')
def architecture = System.getenv('architecture')
def platform = System.getenv('platform')

def versionPrefixes = dockerTagPrefixes(dockerBuildVersion)

doLast {
for (def variant in dockerJdkVariants) {
def tags = ""
Expand Down Expand Up @@ -557,18 +564,9 @@ task uploadDocker {

task manifestDocker {
def dockerBuildVersion = "${rootProject.version}".replace('+', '-')
def versionPrefixes = [dockerBuildVersion]
def versionPrefixes = dockerTagPrefixes(dockerBuildVersion)
def platforms = ["arm64", "amd64"]

if (project.hasProperty('branch') && project.property('branch') == 'master') {
versionPrefixes.add('develop')
}

if (!isDevelopBuild) {
versionPrefixes.add('latest')
versionPrefixes.add(dockerBuildVersion.split(/\./)[0..1].join('.'))
}

doLast {
for (def variant in dockerJdkVariants) {
def tags = []
Expand Down

0 comments on commit cbd6cec

Please sign in to comment.