Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sprinkle some log statements in inject-and-push #1219

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
echo "Re-applying base image annotations and labels"
echo "Re-applying base image annotations"

Here as well, if we're keeping the 0.1 changes

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doh, how did I miss that. Thanks!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding old task versions, I'd like to add it anyways since - it's for me. I need the visual aid when reviewing the output of buildah tasks and trying to confirm that manifests are being injected where they should be.

(Long story, but the ai-lab images are so huge that ec times out trying to verify that the files exist in /root/buildinfo/, but it appears to suppress the timeout and instead just reports that the files are missing. Related to enterprise-contract/ec-cli#1788)

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"
ralphbean marked this conversation as resolved.
Show resolved Hide resolved
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
Loading