Skip to content

Commit

Permalink
Version tag may only be applied when all projects are "clean".
Browse files Browse the repository at this point in the history
  • Loading branch information
mnlipp committed Jun 27, 2024
1 parent b74de67 commit e3da87d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 17 deletions.
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ buildscript {
plugins {
id 'org.ajoberstar.grgit' version '5.2.0' apply false
id 'org.ajoberstar.git-publish' version '4.2.0' apply false
id 'pl.allegro.tech.build.axion-release' version '1.15.0' apply false
id 'pl.allegro.tech.build.axion-release' version '1.17.2' apply false
id 'org.jdrupes.vmoperator.versioning-conventions'
id 'org.jdrupes.vmoperator.java-doc-conventions'
id 'eclipse'
id "com.github.node-gradle.node" version "7.0.1"
Expand Down
9 changes: 5 additions & 4 deletions org.jdrupes.vmoperator.manager/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ application {

project.ext.gitBranch = grgit.branch.current.name.replace('/', '-')
def registry = "${project.rootProject.properties['docker.registry']}"
def rootVersion = rootProject.version

task buildImage(type: Exec) {
dependsOn installDist
Expand All @@ -70,7 +71,7 @@ task pushImage(type: Exec) {
task tagWithVersion(type: Exec) {
dependsOn pushImage

enabled = !project.version.contains("SNAPSHOT")
enabled = !rootVersion.contains("SNAPSHOT")

commandLine 'podman', 'push', \
"${project.name}:${project.gitBranch}",\
Expand All @@ -80,9 +81,9 @@ task tagWithVersion(type: Exec) {
task tagAsLatest(type: Exec) {
dependsOn tagWithVersion

enabled = !project.version.contains("SNAPSHOT")
&& !project.version.contains("alpha") \
&& !project.version.contains("beta") \
enabled = !rootVersion.contains("SNAPSHOT")
&& !rootVersion.contains("alpha") \
&& !rootVersion.contains("beta") \
|| project.rootProject.properties['docker.testRegistry'] \
&& project.rootProject.properties['docker.registry'] \
== project.rootProject.properties['docker.testRegistry']
Expand Down
17 changes: 9 additions & 8 deletions org.jdrupes.vmoperator.runner.qemu/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ application {

project.ext.gitBranch = grgit.branch.current.name.replace('/', '-')
def registry = "${project.rootProject.properties['docker.registry']}"
def rootVersion = rootProject.version

task buildImageArch(type: Exec) {
dependsOn installDist
Expand All @@ -54,7 +55,7 @@ task pushImageArch(type: Exec) {
task tagWithVersionArch(type: Exec) {
dependsOn pushImageArch

enabled = !project.version.contains("SNAPSHOT")
enabled = !rootVersion.contains("SNAPSHOT")

commandLine 'podman', 'push', \
"${project.name}-arch:${project.gitBranch}",\
Expand All @@ -64,9 +65,9 @@ task tagWithVersionArch(type: Exec) {
task tagAsLatestArch(type: Exec) {
dependsOn tagWithVersionArch

enabled = !project.version.contains("SNAPSHOT")
&& !project.version.contains("alpha") \
&& !project.version.contains("beta") \
enabled = !rootVersion.contains("SNAPSHOT")
&& !rootVersion.contains("alpha") \
&& !rootVersion.contains("beta") \
|| project.rootProject.properties['docker.testRegistry'] \
&& project.rootProject.properties['docker.registry'] \
== project.rootProject.properties['docker.testRegistry']
Expand Down Expand Up @@ -96,7 +97,7 @@ task pushImageAlpine(type: Exec) {
task tagWithVersionAlpine(type: Exec) {
dependsOn pushImageAlpine

enabled = !project.version.contains("SNAPSHOT")
enabled = !rootVersion.contains("SNAPSHOT")

commandLine 'podman', 'push', \
"${project.name}-alpine:${project.gitBranch}",\
Expand All @@ -106,9 +107,9 @@ task tagWithVersionAlpine(type: Exec) {
task tagAsLatestAlpine(type: Exec) {
dependsOn tagWithVersionAlpine

enabled = !project.version.contains("SNAPSHOT")
&& !project.version.contains("alpha") \
&& !project.version.contains("beta") \
enabled = !rootVersion.contains("SNAPSHOT")
&& !rootVersion.contains("alpha") \
&& !rootVersion.contains("beta") \
|| project.rootProject.properties['docker.testRegistry'] \
&& project.rootProject.properties['docker.registry'] \
== project.rootProject.properties['docker.testRegistry']
Expand Down
9 changes: 5 additions & 4 deletions spice-squid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ dependencies {

project.ext.gitBranch = grgit.branch.current.name.replace('/', '-')
def registry = "${project.rootProject.properties['docker.registry']}"
def rootVersion = rootProject.version

task buildImage(type: Exec) {
inputs.files 'Containerfile'
Expand All @@ -26,7 +27,7 @@ task pushImage(type: Exec) {
task tagWithVersion(type: Exec) {
dependsOn pushImage

enabled = !project.version.contains("SNAPSHOT")
enabled = !rootVersion.contains("SNAPSHOT")

commandLine 'podman', 'push', \
"${project.name}:${project.gitBranch}",\
Expand All @@ -36,9 +37,9 @@ task tagWithVersion(type: Exec) {
task tagAsLatest(type: Exec) {
dependsOn tagWithVersion

enabled = !project.version.contains("SNAPSHOT")
&& !project.version.contains("alpha") \
&& !project.version.contains("beta") \
enabled = !rootVersion.contains("SNAPSHOT")
&& !rootVersion.contains("alpha") \
&& !rootVersion.contains("beta") \
|| project.rootProject.properties['docker.testRegistry'] \
&& project.rootProject.properties['docker.registry'] \
== project.rootProject.properties['docker.testRegistry']
Expand Down

0 comments on commit e3da87d

Please sign in to comment.