Skip to content

Commit

Permalink
Sprinkle some log statements in inject-and-push
Browse files Browse the repository at this point in the history
Just to help users see what's going on.
  • Loading branch information
ralphbean committed Jul 30, 2024
1 parent 8a2d1f0 commit 248d5a2
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 8 deletions.
7 changes: 6 additions & 1 deletion task/buildah-oci-ta/0.1/buildah-oci-ta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -538,17 +538,22 @@ spec:
- mountPath: /var/lib/containers
name: varlibcontainers
script: |
echo "Inspecting $IMAGE to find its base image name and digest"
base_image_name=$(buildah inspect --format '{{ index .ImageAnnotations "org.opencontainers.image.base.name"}}' $IMAGE | cut -f1 -d'@')
base_image_digest=$(buildah inspect --format '{{ index .ImageAnnotations "org.opencontainers.image.base.digest"}}' $IMAGE)
container=$(buildah from --pull-never $IMAGE)
echo "Injecting sbom files into /root/buildinfo/content_manifests/ of $IMAGE"
buildah copy $container sbom-cyclonedx.json sbom-purl.json /root/buildinfo/content_manifests/
echo "Re-applying base image annotations and labels"
buildah config -a org.opencontainers.image.base.name=${base_image_name} -a org.opencontainers.image.base.digest=${base_image_digest} $container
BUILDAH_ARGS=()
if [ "${SQUASH}" == "true" ]; then
BUILDAH_ARGS+=("--squash")
fi
echo "Committing that change..."
buildah commit "${BUILDAH_ARGS[@]}" $container $IMAGE
status=-1
Expand All @@ -557,7 +562,7 @@ spec:
for run in $(seq 1 $max_run); do
status=0
[ "$run" -gt 1 ] && sleep $sleep_sec
echo "Pushing sbom image to registry"
echo "Pushing modified image with sboms included in the filesystem back to the registry at $IMAGE"
buildah push \
--tls-verify=$TLSVERIFY \
--digestfile /var/workdir/image-digest $IMAGE \
Expand Down
7 changes: 6 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 @@ -539,17 +539,22 @@ spec:
script: |
#!/bin/bash
set -e
echo "Inspecting $IMAGE to find its base image name and digest"
base_image_name=$(buildah inspect --format '{{ index .ImageAnnotations "org.opencontainers.image.base.name"}}' $IMAGE | cut -f1 -d'@')
base_image_digest=$(buildah inspect --format '{{ index .ImageAnnotations "org.opencontainers.image.base.digest"}}' $IMAGE)
container=$(buildah from --pull-never $IMAGE)
echo "Injecting sbom files into /root/buildinfo/content_manifests/ of $IMAGE"
buildah copy $container sbom-cyclonedx.json sbom-purl.json /root/buildinfo/content_manifests/
echo "Re-applying base image annotations and labels"
buildah config -a org.opencontainers.image.base.name=${base_image_name} -a org.opencontainers.image.base.digest=${base_image_digest} $container
BUILDAH_ARGS=()
if [ "${SQUASH}" == "true" ]; then
BUILDAH_ARGS+=("--squash")
fi
echo "Committing that change..."
buildah commit "${BUILDAH_ARGS[@]}" $container $IMAGE
status=-1
Expand All @@ -558,7 +563,7 @@ spec:
for run in $(seq 1 $max_run); do
status=0
[ "$run" -gt 1 ] && sleep $sleep_sec
echo "Pushing sbom image to registry"
echo "Pushing modified image with sboms included in the filesystem back to the registry at $IMAGE"
buildah push \
--tls-verify=$TLSVERIFY \
--digestfile /var/workdir/image-digest $IMAGE \
Expand Down
7 changes: 6 additions & 1 deletion task/buildah-remote-oci-ta/0.1/buildah-remote-oci-ta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -609,17 +609,22 @@ spec:
image: quay.io/konflux-ci/buildah:latest@sha256:3fe211715717eca9eca1f19d326e19dd052c92fc6eb4f2434d8f903fe5b9aeb7
name: inject-sbom-and-push
script: |
echo "Inspecting $IMAGE to find its base image name and digest"
base_image_name=$(buildah inspect --format '{{ index .ImageAnnotations "org.opencontainers.image.base.name"}}' $IMAGE | cut -f1 -d'@')
base_image_digest=$(buildah inspect --format '{{ index .ImageAnnotations "org.opencontainers.image.base.digest"}}' $IMAGE)
container=$(buildah from --pull-never $IMAGE)
echo "Injecting sbom files into /root/buildinfo/content_manifests/ of $IMAGE"
buildah copy $container sbom-cyclonedx.json sbom-purl.json /root/buildinfo/content_manifests/
echo "Re-applying base image annotations and labels"
buildah config -a org.opencontainers.image.base.name=${base_image_name} -a org.opencontainers.image.base.digest=${base_image_digest} $container
BUILDAH_ARGS=()
if [ "${SQUASH}" == "true" ]; then
BUILDAH_ARGS+=("--squash")
fi
echo "Committing that change..."
buildah commit "${BUILDAH_ARGS[@]}" $container $IMAGE
status=-1
Expand All @@ -628,7 +633,7 @@ spec:
for run in $(seq 1 $max_run); do
status=0
[ "$run" -gt 1 ] && sleep $sleep_sec
echo "Pushing sbom image to registry"
echo "Pushing modified image with sboms included in the filesystem back to the registry at $IMAGE"
buildah push \
--tls-verify=$TLSVERIFY \
--digestfile /var/workdir/image-digest $IMAGE \
Expand Down
7 changes: 6 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 @@ -610,17 +610,22 @@ spec:
script: |
#!/bin/bash
set -e
echo "Inspecting $IMAGE to find its base image name and digest"
base_image_name=$(buildah inspect --format '{{ index .ImageAnnotations "org.opencontainers.image.base.name"}}' $IMAGE | cut -f1 -d'@')
base_image_digest=$(buildah inspect --format '{{ index .ImageAnnotations "org.opencontainers.image.base.digest"}}' $IMAGE)
container=$(buildah from --pull-never $IMAGE)
echo "Injecting sbom files into /root/buildinfo/content_manifests/ of $IMAGE"
buildah copy $container sbom-cyclonedx.json sbom-purl.json /root/buildinfo/content_manifests/
echo "Re-applying base image annotations and labels"
buildah config -a org.opencontainers.image.base.name=${base_image_name} -a org.opencontainers.image.base.digest=${base_image_digest} $container
BUILDAH_ARGS=()
if [ "${SQUASH}" == "true" ]; then
BUILDAH_ARGS+=("--squash")
fi
echo "Committing that change..."
buildah commit "${BUILDAH_ARGS[@]}" $container $IMAGE
status=-1
Expand All @@ -629,7 +634,7 @@ spec:
for run in $(seq 1 $max_run); do
status=0
[ "$run" -gt 1 ] && sleep $sleep_sec
echo "Pushing sbom image to registry"
echo "Pushing modified image with sboms included in the filesystem back to the registry at $IMAGE"
buildah push \
--tls-verify=$TLSVERIFY \
--digestfile /var/workdir/image-digest $IMAGE \
Expand Down
7 changes: 6 additions & 1 deletion task/buildah-remote/0.1/buildah-remote.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -606,17 +606,22 @@ spec:
echo "WARNING: provided deprecated BUILDER_IMAGE parameter has no effect."
fi
echo "Inspecting $IMAGE to find its base image name and digest"
base_image_name=$(buildah inspect --format '{{ index .ImageAnnotations "org.opencontainers.image.base.name"}}' $IMAGE | cut -f1 -d'@')
base_image_digest=$(buildah inspect --format '{{ index .ImageAnnotations "org.opencontainers.image.base.digest"}}' $IMAGE)
container=$(buildah from --pull-never $IMAGE)
echo "Injecting sbom files into /root/buildinfo/content_manifests/ of $IMAGE"
buildah copy $container sbom-cyclonedx.json sbom-purl.json /root/buildinfo/content_manifests/
echo "Re-applying base image annotations and labels"
buildah config -a org.opencontainers.image.base.name=${base_image_name} -a org.opencontainers.image.base.digest=${base_image_digest} $container
BUILDAH_ARGS=()
if [ "${SQUASH}" == "true" ]; then
BUILDAH_ARGS+=("--squash")
fi
echo "Committing that change..."
buildah commit "${BUILDAH_ARGS[@]}" $container $IMAGE
status=-1
Expand All @@ -625,7 +630,7 @@ spec:
for run in $(seq 1 $max_run); do
status=0
[ "$run" -gt 1 ] && sleep $sleep_sec
echo "Pushing sbom image to registry"
echo "Pushing modified image with sboms included in the filesystem back to the registry at $IMAGE"
buildah push \
--tls-verify=$TLSVERIFY \
--digestfile $(workspaces.source.path)/image-digest $IMAGE \
Expand Down
7 changes: 6 additions & 1 deletion task/buildah-remote/0.2/buildah-remote.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -592,17 +592,22 @@ spec:
script: |
#!/bin/bash
set -e
echo "Inspecting $IMAGE to find its base image name and digest"
base_image_name=$(buildah inspect --format '{{ index .ImageAnnotations "org.opencontainers.image.base.name"}}' $IMAGE | cut -f1 -d'@')
base_image_digest=$(buildah inspect --format '{{ index .ImageAnnotations "org.opencontainers.image.base.digest"}}' $IMAGE)
container=$(buildah from --pull-never $IMAGE)
echo "Injecting sbom files into /root/buildinfo/content_manifests/ of $IMAGE"
buildah copy $container sbom-cyclonedx.json sbom-purl.json /root/buildinfo/content_manifests/
echo "Re-applying base image annotations and labels"
buildah config -a org.opencontainers.image.base.name=${base_image_name} -a org.opencontainers.image.base.digest=${base_image_digest} $container
BUILDAH_ARGS=()
if [ "${SQUASH}" == "true" ]; then
BUILDAH_ARGS+=("--squash")
fi
echo "Committing that change..."
buildah commit "${BUILDAH_ARGS[@]}" $container $IMAGE
status=-1
Expand All @@ -611,7 +616,7 @@ spec:
for run in $(seq 1 $max_run); do
status=0
[ "$run" -gt 1 ] && sleep $sleep_sec
echo "Pushing sbom image to registry"
echo "Pushing modified image with sboms included in the filesystem back to the registry at $IMAGE"
buildah push \
--tls-verify=$TLSVERIFY \
--digestfile $(workspaces.source.path)/image-digest $IMAGE \
Expand Down
7 changes: 6 additions & 1 deletion task/buildah/0.1/buildah.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -502,17 +502,22 @@ spec:
echo "WARNING: provided deprecated BUILDER_IMAGE parameter has no effect."
fi
echo "Inspecting $IMAGE to find its base image name and digest"
base_image_name=$(buildah inspect --format '{{ index .ImageAnnotations "org.opencontainers.image.base.name"}}' $IMAGE | cut -f1 -d'@')
base_image_digest=$(buildah inspect --format '{{ index .ImageAnnotations "org.opencontainers.image.base.digest"}}' $IMAGE)
container=$(buildah from --pull-never $IMAGE)
echo "Injecting sbom files into /root/buildinfo/content_manifests/ of $IMAGE"
buildah copy $container sbom-cyclonedx.json sbom-purl.json /root/buildinfo/content_manifests/
echo "Re-applying base image annotations and labels"
buildah config -a org.opencontainers.image.base.name=${base_image_name} -a org.opencontainers.image.base.digest=${base_image_digest} $container
BUILDAH_ARGS=()
if [ "${SQUASH}" == "true" ]; then
BUILDAH_ARGS+=("--squash")
fi
echo "Committing that change..."
buildah commit "${BUILDAH_ARGS[@]}" $container $IMAGE
status=-1
Expand All @@ -521,7 +526,7 @@ spec:
for run in $(seq 1 $max_run); do
status=0
[ "$run" -gt 1 ] && sleep $sleep_sec
echo "Pushing sbom image to registry"
echo "Pushing modified image with sboms included in the filesystem back to the registry at $IMAGE"
buildah push \
--tls-verify=$TLSVERIFY \
--digestfile $(workspaces.source.path)/image-digest $IMAGE \
Expand Down
7 changes: 6 additions & 1 deletion task/buildah/0.2/buildah.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -488,17 +488,22 @@ spec:
script: |
#!/bin/bash
set -e
echo "Inspecting $IMAGE to find its base image name and digest"
base_image_name=$(buildah inspect --format '{{ index .ImageAnnotations "org.opencontainers.image.base.name"}}' $IMAGE | cut -f1 -d'@')
base_image_digest=$(buildah inspect --format '{{ index .ImageAnnotations "org.opencontainers.image.base.digest"}}' $IMAGE)
container=$(buildah from --pull-never $IMAGE)
echo "Injecting sbom files into /root/buildinfo/content_manifests/ of $IMAGE"
buildah copy $container sbom-cyclonedx.json sbom-purl.json /root/buildinfo/content_manifests/
echo "Re-applying base image annotations and labels"
buildah config -a org.opencontainers.image.base.name=${base_image_name} -a org.opencontainers.image.base.digest=${base_image_digest} $container
BUILDAH_ARGS=()
if [ "${SQUASH}" == "true" ]; then
BUILDAH_ARGS+=("--squash")
fi
echo "Committing that change..."
buildah commit "${BUILDAH_ARGS[@]}" $container $IMAGE
status=-1
Expand All @@ -507,7 +512,7 @@ spec:
for run in $(seq 1 $max_run); do
status=0
[ "$run" -gt 1 ] && sleep $sleep_sec
echo "Pushing sbom image to registry"
echo "Pushing modified image with sboms included in the filesystem back to the registry at $IMAGE"
buildah push \
--tls-verify=$TLSVERIFY \
--digestfile $(workspaces.source.path)/image-digest $IMAGE \
Expand Down

0 comments on commit 248d5a2

Please sign in to comment.