From 5c7f4880aae58ab3194d0004867593cbe1feef49 Mon Sep 17 00:00:00 2001 From: Julia Tillman Date: Wed, 30 Oct 2024 14:42:59 +0100 Subject: [PATCH] fix(deps): upgrade gradle-docker-plugin version to 9.4.0 Upgrade bmuschko:gradle-docker-plugin from version 3.1.0 to 9.4.0 and include necessary code changes for DockerBuildImage and DockerPushImage. BREAKING CHANGE: Previously docker tasks required Java 8 to run and failed with later versions. Now at least Java 11 is required. --- build.gradle | 5 ++++- .../gradle/swarm/SwarmComposerPlugin.groovy | 18 +++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/build.gradle b/build.gradle index b6c1995..1f90dc8 100644 --- a/build.gradle +++ b/build.gradle @@ -14,6 +14,9 @@ group = 'to.wetransform' repositories { mavenCentral() + maven { + url "https://plugins.gradle.org/m2/" + } maven { url 'https://artifactory.wetransform.to/artifactory/local' } @@ -33,7 +36,7 @@ dependencies{ implementation 'org.yaml:snakeyaml:2.2' // Docker plugin - implementation 'com.bmuschko:gradle-docker-plugin:3.1.0' + implementation 'com.bmuschko:gradle-docker-plugin:9.4.0' // Encryption library implementation 'to.wetransform:alice:1.0.0', { diff --git a/src/main/groovy/to/wetransform/gradle/swarm/SwarmComposerPlugin.groovy b/src/main/groovy/to/wetransform/gradle/swarm/SwarmComposerPlugin.groovy index 79e0046..b8ff42c 100644 --- a/src/main/groovy/to/wetransform/gradle/swarm/SwarmComposerPlugin.groovy +++ b/src/main/groovy/to/wetransform/gradle/swarm/SwarmComposerPlugin.groovy @@ -895,7 +895,7 @@ $run""" dockerFile = new File(tempDir, dFile.name) inputDir = tempDir labels = ['sc-stack': sc.stackName, 'sc-setup': sc.setupName, 'sc-build': buildName] - tag = imageTag + images = [imageTag] //XXX quiet seems to break build //quiet = quietMode @@ -903,10 +903,12 @@ $run""" pull = pullImage if (customCredentials) { - registryCredentials = new DockerRegistryCredentials() - registryCredentials.url = customCredentials.url - registryCredentials.username = customCredentials.username - registryCredentials.password = customCredentials.password + registryCredentials { + url = customCredentials.url + username = customCredentials.username + password = customCredentials.password + } + } group 'Build individual image' @@ -922,10 +924,8 @@ $run""" // add push tasks def pushTask = project.task("push-${sc.stackName}-${sc.setupName}-${buildName}", type: DockerPushImage) { - def sepIndex = imageTag.lastIndexOf(':') - - imageName = (sepIndex >= 0) ? imageTag.substring(0, sepIndex) : imageTag - tag = (sepIndex >= 0 && sepIndex + 1 < imageTag.length()) ? imageTag.substring(sepIndex + 1) : '' + + images = [imageTag] group 'Push individual image' description "Push image for build \"${buildName}\" for stack ${sc.stackName} with setup ${sc.setupName}"