Skip to content

Commit

Permalink
Make docker commands easier to debug during upload and manifest creat…
Browse files Browse the repository at this point in the history
…ion (hyperledger#5522)

- Print docker commands during upload and manifest creation
- Separate out docker push and docker manifest push commands for release

Signed-off-by: Simon Dudley <[email protected]>
  • Loading branch information
siladu committed Jun 1, 2023
1 parent 5fe53cf commit 890e8cd
Showing 1 changed file with 50 additions and 6 deletions.
56 changes: 50 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,7 @@ task dockerUpload {
def archVariantImage = "${variantImage}-${architecture}"
def cmd = "docker tag '${variantImage}' '${archVariantImage}' && docker push '${archVariantImage}'"
additionalTags.each { tag -> cmd += " && docker tag '${variantImage}' '${dockerImageName}:${tag.trim()}-${variant}-${architecture}' && docker push '${dockerImageName}:${tag.trim()}-${variant}-${architecture}'" }
println "Executing '${cmd}'"
executable "sh"
args "-c", cmd
}
Expand All @@ -760,6 +761,7 @@ task dockerUpload {
def archImage = "${image}-${architecture}"
def cmd = "docker tag ${image} ${archImage} && docker push '${archImage}'"
additionalTags.each { tag -> cmd += " && docker tag '${image}' '${dockerImageName}:${tag.trim()}-${architecture}' && docker push '${dockerImageName}:${tag.trim()}-${architecture}'" }
println "Executing '${cmd}'"
executable "sh"
args "-c", cmd
}
Expand All @@ -775,15 +777,29 @@ task dockerUploadRelease {
for (def variant in dockerVariants) {
def variantImage = "${image}-${variant}"
exec {
def cmd = "docker pull '${variantImage}-${architecture}' && docker tag '${variantImage}-${architecture}' '${dockerImageName}:latest-${variant}-${architecture}' && docker push '${dockerImageName}:latest-${variant}-${architecture}'"
def cmd = "docker pull '${variantImage}-${architecture}' && docker tag '${variantImage}-${architecture}' '${dockerImageName}:latest-${variant}-${architecture}'"
println "Executing '${cmd}'"
executable "sh"
args "-c", cmd
}
exec {
def cmd = "docker push '${dockerImageName}:latest-${variant}-${architecture}'"
println "Executing '${cmd}'"
executable "sh"
args "-c", cmd
}
}

exec {
def archImage = "${image}-${architecture}"
def cmd = "docker pull '${archImage}' && docker tag ${archImage} '${dockerImageName}:latest-${architecture}' && docker push '${dockerImageName}:latest-${architecture}'"
def cmd = "docker pull '${archImage}' && docker tag ${archImage} '${dockerImageName}:latest-${architecture}'"
println "Executing '${cmd}'"
executable "sh"
args "-c", cmd
}
exec {
def cmd = "docker push '${dockerImageName}:latest-${architecture}'"
println "Executing '${cmd}'"
executable "sh"
args "-c", cmd
}
Expand Down Expand Up @@ -812,7 +828,14 @@ task manifestDocker {
archs.forEach { arch -> targets += "'${variantImage}-${arch}' " }

exec {
def cmd = "docker manifest create '${variantImage}' ${targets} && docker manifest push '${variantImage}'"
def cmd = "docker manifest create '${variantImage}' ${targets}"
println "Executing '${cmd}'"
executable "sh"
args "-c", cmd
}
exec {
def cmd = "docker manifest push '${variantImage}'"
println "Executing '${cmd}'"
executable "sh"
args "-c", cmd
}
Expand All @@ -821,7 +844,14 @@ task manifestDocker {
exec {
def targets = ""
archs.forEach { arch -> targets += "'${baseTag}-${arch}' " }
def cmd = "docker manifest create '${baseTag}' ${targets} && docker manifest push '${baseTag}'"
def cmd = "docker manifest create '${baseTag}' ${targets}"
println "Executing '${cmd}'"
executable "sh"
args "-c", cmd
}
exec {
def cmd = "docker manifest push '${baseTag}'"
println "Executing '${cmd}'"
executable "sh"
args "-c", cmd
}
Expand All @@ -840,7 +870,14 @@ task manifestDockerRelease {
archs.forEach { arch -> targets += "'${variantImage}-${arch}' " }

exec {
def cmd = "docker manifest create '${variantImage}' ${targets} && docker manifest push '${variantImage}'"
def cmd = "docker manifest create '${variantImage}' ${targets}"
println "Executing '${cmd}'"
executable "sh"
args "-c", cmd
}
exec {
def cmd = "docker manifest push '${variantImage}'"
println "Executing '${cmd}'"
executable "sh"
args "-c", cmd
}
Expand All @@ -849,7 +886,14 @@ task manifestDockerRelease {
exec {
def targets = ""
archs.forEach { arch -> targets += "'${baseTag}-${arch}' " }
def cmd = "docker manifest create '${baseTag}' ${targets} && docker manifest push '${baseTag}'"
def cmd = "docker manifest create '${baseTag}' ${targets}"
println "Executing '${cmd}'"
executable "sh"
args "-c", cmd
}
exec {
def cmd = "docker manifest push '${baseTag}'"
println "Executing '${cmd}'"
executable "sh"
args "-c", cmd
}
Expand Down

0 comments on commit 890e8cd

Please sign in to comment.