@@ -1003,90 +1003,89 @@ task dockerUpload(type: Exec) {
10031003 args " -c" , cmd
10041004}
10051005
1006- task dockerUploadRelease {
1007- def archs = [ " arm64" , " amd64 " ]
1006+ task dockerUploadReleaseArm64 ( type : Exec ) {
1007+ def architecture = " arm64"
10081008 def image = " ${ dockerImageName} :${ dockerBuildVersion} "
10091009
1010- doLast {
1011- for (def architecture in archs) {
1012-
1013- exec {
1014- def cmd = " docker pull '${ image} -${ architecture} ' && docker tag '${ image} -${ architecture} ' '${ dockerImageName} :latest-${ architecture} '"
1015- println " Executing '${ cmd} '"
1016- executable shell
1017- args " -c" , cmd
1018- }
1019- exec {
1020- def cmd = " docker push '${ dockerImageName} :latest-${ architecture} '"
1021- println " Executing '${ cmd} '"
1022- executable shell
1023- args " -c" , cmd
1024- }
1010+ doFirst {
1011+ def cmd = " docker pull '${ image} -${ architecture} ' && docker tag '${ image} -${ architecture} ' '${ dockerImageName} :latest-${ architecture} ' && docker push '${ dockerImageName} :latest-${ architecture} '"
1012+ println " Executing '${ cmd} '"
1013+ commandLine shell, " -c" , cmd
1014+ }
1015+ }
10251016
1017+ task dockerUploadReleaseAmd64 (type : Exec ) {
1018+ def architecture = " amd64"
1019+ def image = " ${ dockerImageName} :${ dockerBuildVersion} "
10261020
1027- exec {
1028- def archImage = " ${ image} -${ architecture} "
1029- def cmd = " docker pull '${ archImage} ' && docker tag ${ archImage} '${ dockerImageName} :latest-${ architecture} '"
1030- println " Executing '${ cmd} '"
1031- executable shell
1032- args " -c" , cmd
1033- }
1034- exec {
1035- def cmd = " docker push '${ dockerImageName} :latest-${ architecture} '"
1036- println " Executing '${ cmd} '"
1037- executable shell
1038- args " -c" , cmd
1039- }
1040- }
1021+ doFirst {
1022+ def cmd = " docker pull '${ image} -${ architecture} ' && docker tag '${ image} -${ architecture} ' '${ dockerImageName} :latest-${ architecture} ' && docker push '${ dockerImageName} :latest-${ architecture} '"
1023+ println " Executing '${ cmd} '"
1024+ commandLine shell, " -c" , cmd
10411025 }
10421026}
10431027
1044- task manifestDocker {
1028+ task dockerUploadRelease {
1029+ dependsOn dockerUploadReleaseArm64, dockerUploadReleaseAmd64
1030+ }
1031+
1032+ task manifestDockerCreate (type : Exec ) {
10451033 def image = " ${ dockerImageName} :${ dockerBuildVersion} "
10461034 def archs = [
10471035 " arm64" ,
10481036 " amd64" ] // TODO: this assumes dockerUpload task has already been run on 2 different archs!
1049- doLast {
1050- exec {
1051- def targets = " "
1052- archs. forEach { arch -> targets + = " '${ image} -${ arch} ' " }
1053- def cmd = " docker manifest create '${ image} ' ${ targets} "
1054- println " Executing '${ cmd} '"
1055- executable shell
1056- args " -c" , cmd
1057- }
1058- exec {
1059- def cmd = " docker manifest push '${ image} '"
1060- println " Executing '${ cmd} '"
1061- executable shell
1062- args " -c" , cmd
1063- }
1037+ doFirst {
1038+ def targets = " "
1039+ archs. forEach { arch -> targets + = " '${ image} -${ arch} ' " }
1040+ def cmd = " docker manifest create '${ image} ' ${ targets} "
1041+ println " Executing '${ cmd} '"
1042+ commandLine shell, " -c" , cmd
10641043 }
10651044}
10661045
1067- task manifestDockerRelease {
1046+ task manifestDockerPush (type : Exec ) {
1047+ dependsOn manifestDockerCreate
1048+ def image = " ${ dockerImageName} :${ dockerBuildVersion} "
1049+
1050+ doFirst {
1051+ def cmd = " docker manifest push '${ image} '"
1052+ println " Executing '${ cmd} '"
1053+ commandLine shell, " -c" , cmd
1054+ }
1055+ }
1056+
1057+ task manifestDocker {
1058+ dependsOn manifestDockerPush
1059+ }
1060+
1061+ task manifestDockerReleaseCreate (type : Exec ) {
10681062 def archs = [" arm64" , " amd64" ]
1069- def baseTag = " ${ dockerImageName} :latest" ;
1063+ def baseTag = " ${ dockerImageName} :latest"
10701064
1071- doLast {
1065+ doFirst {
1066+ def targets = " "
1067+ archs. forEach { arch -> targets + = " '${ baseTag} -${ arch} ' " }
1068+ def cmd = " docker manifest create '${ baseTag} ' ${ targets} --amend"
1069+ println " Executing '${ cmd} '"
1070+ commandLine shell, " -c" , cmd
1071+ }
1072+ }
10721073
1073- exec {
1074- def targets = " "
1075- archs. forEach { arch -> targets + = " '${ baseTag} -${ arch} ' " }
1076- def cmd = " docker manifest create '${ baseTag} ' ${ targets} --amend"
1077- println " Executing '${ cmd} '"
1078- executable shell
1079- args " -c" , cmd
1080- }
1081- exec {
1082- def cmd = " docker manifest push '${ baseTag} '"
1083- println " Executing '${ cmd} '"
1084- executable shell
1085- args " -c" , cmd
1086- }
1074+ task manifestDockerReleasePush (type : Exec ) {
1075+ dependsOn manifestDockerReleaseCreate
1076+ def baseTag = " ${ dockerImageName} :latest"
1077+
1078+ doFirst {
1079+ def cmd = " docker manifest push '${ baseTag} '"
1080+ println " Executing '${ cmd} '"
1081+ commandLine shell, " -c" , cmd
10871082 }
10881083}
10891084
1085+ task manifestDockerRelease {
1086+ dependsOn manifestDockerReleasePush
1087+ }
1088+
10901089def sep = Pattern . quote(File . separator)
10911090
10921091jacocoTestReport {
0 commit comments