Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker tag prefixes for RC versions #901

Merged
merged 1 commit into from
Sep 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Docker tag prefixes for RC versions
 -- create latest and x.y tag prefixes for non-develop and non-rc releases
  • Loading branch information
usmansaleem committed Sep 6, 2023
commit ab631a01135e5e8653545f8072600df959edf79a
36 changes: 17 additions & 19 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -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)) {
@@ -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'

@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guess this doesn't hurt, but probably don't need this either

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was already part of existing logic, I simply added the comment for readability.

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 = ""
@@ -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 = []