Skip to content

Commit

Permalink
Merge pull request #1029 from SaschaSchwarze0/sascha-1028-buildah-ima…
Browse files Browse the repository at this point in the history
…ge-digest

Use BuildAh --digestfile argument to store digest of pushed image
  • Loading branch information
openshift-merge-robot authored Mar 31, 2022
2 parents 4ba48bb + 2534414 commit 9a40e9c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 26 deletions.
14 changes: 1 addition & 13 deletions samples/buildstrategy/buildah/buildstrategy_buildah_cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -145,22 +145,10 @@ spec:
# Push the image
echo "[INFO] Pushing image ${image}"
buildah push \
--digestfile='$(results.shp-image-digest.path)' \
--tls-verify="${tlsVerify}" \
"${image}" \
"docker://${image}"
# Store the digest result. This is more complex than expected. BuildAh locally calculates a wrong digest.
# We therefore tag the image to a dummy name so that the layers are still present. Then we remove the local
# tag. Then we pull again. Then the local digest is correct.
# This should be validated again with a newer BuildAh version.
# https://github.com/containers/buildah/issues/3866
buildah tag "${image}" dummy
buildah rmi "${image}"
buildah pull --tls-verify="${tlsVerify}" "${image}"
buildah inspect \
--type=image \
--format='{{.FromImageDigest}}' \
"${image}" > '$(results.shp-image-digest.path)'
# That's the separator between the shell script and its args
- --
- --context
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,21 +109,9 @@ spec:
# Push the image
echo "[INFO] Pushing image ${image}"
buildah push \
--digestfile='$(results.shp-image-digest.path)' \
--tls-verify="${tlsVerify}" \
"docker://${image}"
# Store the digest result. This is more complex than expected. BuildAh locally calculates a wrong digest.
# We therefore tag the image to a dummy name so that the layers are still present. Then we remove the local
# tag. Then we pull again. Then the local digest is correct.
# This should be validated again with a newer BuildAh version.
# https://github.com/containers/buildah/issues/3866
buildah tag "${image}" dummy
buildah rmi "${image}"
buildah pull --tls-verify="${tlsVerify}" "${image}"
buildah inspect \
--type=image \
--format='{{.FromImageDigest}}' \
"${image}" > '$(results.shp-image-digest.path)'
# That's the separator between the shell script and its args
- --
- --image
Expand Down

0 comments on commit 9a40e9c

Please sign in to comment.