buildContainerImage2: Unstash single-arch image

If the image being built is only for a single architecture, the step to
unstash the OCI archive file was missing.  This caused the build to fail
at the Push step, since there was noting to push.
bci2-resources
Dustin 2023-10-24 18:44:08 -05:00
parent 93da924aab
commit a4e9602ca9
1 changed files with 6 additions and 2 deletions

View File

@ -53,7 +53,7 @@ def call(args) {
sh "buildah manifest create '${full_name}'"
archlist.each { arch ->
unstash arch
sh "buildah manifest add '${full_name}' oci-archive:\${PWD}/${escapeImageName(name)}-${arch}.tar"
sh "buildah manifest add '${full_name}' oci-archive:\${PWD}/${escapeImageName(name)}-${arch}.tar:${full_name}"
}
}
}
@ -65,6 +65,10 @@ def call(args) {
sh "buildah manifest push ${full_name} docker://${repo}:latest"
}
} else {
archlist.each { arch ->
unstash arch
sh "buildah pull oci-archive:\${PWD}/${escapeImageName(name)}-${arch}.tar:${full_name}"
}
sh "buildah push ${full_name} ${full_name}-${env.BUILD_NUMBER}"
sh "buildah push ${full_name}"
if (env.BRANCH_NAME == 'main') {
@ -89,7 +93,7 @@ def buildStage(args) {
container('buildah') {
withBuildahCreds(registry) {
sh "buildah build -t '${full_name}' ."
sh "buildah push '${full_name}' oci-archive:\${PWD}/${escapeImageName(name)}-${arch}.tar"
sh "buildah push '${full_name}' oci-archive:\${PWD}/${escapeImageName(name)}-${arch}.tar:${full_name}"
stash name: arch, includes: "${escapeImageName(name)}-*.tar"
}
}