Skip to content

Commit

Permalink
Log activity when recording base image digests
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphbean committed Jan 7, 2025
1 parent 6fa1651 commit 6ac8f40
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 8 deletions.
3 changes: 2 additions & 1 deletion task/buildah-oci-ta/0.2/buildah-oci-ta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -547,12 +547,13 @@ spec:
echo $container >/shared/container_name
touch /shared/base_images_digests
echo "Recording base image digests used"
for image in $BASE_IMAGES; do
base_image_digest=$(buildah images --format '{{ .Name }}:{{ .Tag }}@{{ .Digest }}' --filter reference="$image")
# In some cases, there might be BASE_IMAGES, but not any associated digest. This happens
# if buildah did not use that particular image during build because it was skipped
if [ -n "$base_image_digest" ]; then
echo "$image $base_image_digest" >>/shared/base_images_digests
echo "$image $base_image_digest" | tee -a /shared/base_images_digests
fi
done
computeResources:
Expand Down
3 changes: 2 additions & 1 deletion task/buildah-oci-ta/0.3/buildah-oci-ta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -535,12 +535,13 @@ spec:
echo $container >/shared/container_name
touch /shared/base_images_digests
echo "Recording base image digests used"
for image in $BASE_IMAGES; do
base_image_digest=$(buildah images --format '{{ .Name }}:{{ .Tag }}@{{ .Digest }}' --filter reference="$image")
# In some cases, there might be BASE_IMAGES, but not any associated digest. This happens
# if buildah did not use that particular image during build because it was skipped
if [ -n "$base_image_digest" ]; then
echo "$image $base_image_digest" >>/shared/base_images_digests
echo "$image $base_image_digest" | tee -a /shared/base_images_digests
fi
done
computeResources:
Expand Down
3 changes: 2 additions & 1 deletion task/buildah-remote-oci-ta/0.2/buildah-remote-oci-ta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -581,12 +581,13 @@ spec:
echo $container >/shared/container_name
touch /shared/base_images_digests
echo "Recording base image digests used"
for image in $BASE_IMAGES; do
base_image_digest=$(buildah images --format '{{ .Name }}:{{ .Tag }}@{{ .Digest }}' --filter reference="$image")
# In some cases, there might be BASE_IMAGES, but not any associated digest. This happens
# if buildah did not use that particular image during build because it was skipped
if [ -n "$base_image_digest" ]; then
echo "$image $base_image_digest" >>/shared/base_images_digests
echo "$image $base_image_digest" | tee -a /shared/base_images_digests
fi
done
Expand Down
3 changes: 2 additions & 1 deletion task/buildah-remote-oci-ta/0.3/buildah-remote-oci-ta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -569,12 +569,13 @@ spec:
echo $container >/shared/container_name
touch /shared/base_images_digests
echo "Recording base image digests used"
for image in $BASE_IMAGES; do
base_image_digest=$(buildah images --format '{{ .Name }}:{{ .Tag }}@{{ .Digest }}' --filter reference="$image")
# In some cases, there might be BASE_IMAGES, but not any associated digest. This happens
# if buildah did not use that particular image during build because it was skipped
if [ -n "$base_image_digest" ]; then
echo "$image $base_image_digest" >>/shared/base_images_digests
echo "$image $base_image_digest" | tee -a /shared/base_images_digests
fi
done
Expand Down
3 changes: 2 additions & 1 deletion task/buildah-remote/0.2/buildah-remote.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -557,12 +557,13 @@ spec:
echo $container > /shared/container_name
touch /shared/base_images_digests
echo "Recording base image digests used"
for image in $BASE_IMAGES; do
base_image_digest=$(buildah images --format '{{ .Name }}:{{ .Tag }}@{{ .Digest }}' --filter reference="$image")
# In some cases, there might be BASE_IMAGES, but not any associated digest. This happens
# if buildah did not use that particular image during build because it was skipped
if [ -n "$base_image_digest" ]; then
echo "$image $base_image_digest" >> /shared/base_images_digests
echo "$image $base_image_digest" | tee -a /shared/base_images_digests
fi
done
Expand Down
3 changes: 2 additions & 1 deletion task/buildah-remote/0.3/buildah-remote.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -545,12 +545,13 @@ spec:
echo $container > /shared/container_name
touch /shared/base_images_digests
echo "Recording base image digests used"
for image in $BASE_IMAGES; do
base_image_digest=$(buildah images --format '{{ .Name }}:{{ .Tag }}@{{ .Digest }}' --filter reference="$image")
# In some cases, there might be BASE_IMAGES, but not any associated digest. This happens
# if buildah did not use that particular image during build because it was skipped
if [ -n "$base_image_digest" ]; then
echo "$image $base_image_digest" >> /shared/base_images_digests
echo "$image $base_image_digest" | tee -a /shared/base_images_digests
fi
done
Expand Down
3 changes: 2 additions & 1 deletion task/buildah/0.2/buildah.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -478,12 +478,13 @@ spec:
echo $container > /shared/container_name
touch /shared/base_images_digests
echo "Recording base image digests used"
for image in $BASE_IMAGES; do
base_image_digest=$(buildah images --format '{{ .Name }}:{{ .Tag }}@{{ .Digest }}' --filter reference="$image")
# In some cases, there might be BASE_IMAGES, but not any associated digest. This happens
# if buildah did not use that particular image during build because it was skipped
if [ -n "$base_image_digest" ]; then
echo "$image $base_image_digest" >> /shared/base_images_digests
echo "$image $base_image_digest" | tee -a /shared/base_images_digests
fi
done
Expand Down
3 changes: 2 additions & 1 deletion task/buildah/0.3/buildah.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -467,12 +467,13 @@ spec:
echo $container > /shared/container_name
touch /shared/base_images_digests
echo "Recording base image digests used"
for image in $BASE_IMAGES; do
base_image_digest=$(buildah images --format '{{ .Name }}:{{ .Tag }}@{{ .Digest }}' --filter reference="$image")
# In some cases, there might be BASE_IMAGES, but not any associated digest. This happens
# if buildah did not use that particular image during build because it was skipped
if [ -n "$base_image_digest" ]; then
echo "$image $base_image_digest" >> /shared/base_images_digests
echo "$image $base_image_digest" | tee -a /shared/base_images_digests
fi
done
Expand Down

0 comments on commit 6ac8f40

Please sign in to comment.