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

[ISV-5440] Extend relatedImages error message handling #762

Merged
merged 1 commit into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,8 @@ spec:
value: "$(tasks.digest-pinning.results.dirty_flag)"
- name: related_images_flag
value: "$(tasks.digest-pinning.results.related_images_flag)"
- name: related_images_message
value: "$(tasks.digest-pinning.results.related_images_message)"

# Build images- bundle and index and push them to registry.
# Those steps are also a part of the CI pipeline.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ spec:
results:
- name: dirty_flag
- name: related_images_flag
- name: related_images_message
workspaces:
- name: source
- name: registry-credentials
Expand Down Expand Up @@ -117,13 +118,13 @@ spec:
set -xe

if [ -z "$(params.bundle_path)" ]; then
echo "No bundle added or changed"
echo -n "No bundle added or changed" | tee $(results.related_images_message.path)
echo -n "true" | tee $(results.related_images_flag.path)
exit 0
fi

if [ "$(params.enabled)" != "true" ]; then
echo "Digest pinning is not enabled"
echo -n "Digest pinning is not enabled" | tee $(results.related_images_message.path)
echo -n "true" | tee $(results.related_images_flag.path)
exit 0
fi
Expand All @@ -135,9 +136,12 @@ spec:
RELATED_IMAGE_COUNT=$(yq -e '.spec.relatedImages | length' $CSVFILE)

if [[ $RELATED_IMAGE_COUNT -ge $REFERENCE_COUNT ]]; then
echo "Related images section exists."
echo -n "Related images section exists." | tee $(results.related_images_message.path)
echo -n "true" | tee $(results.related_images_flag.path)
elif [[ $RELATED_IMAGE_COUNT -lt $REFERENCE_COUNT && $RELATED_IMAGE_COUNT -gt 0 ]]; then
echo -n "The relatedImages section in your CSV covers only $RELATED_IMAGE_COUNT of the $REFERENCE_COUNT images detected in your CSV." | tee $(results.related_images_message.path)
echo -n "false" | tee $(results.related_images_flag.path)
else
echo "The relatedImages section does not exist or is missing images."
echo -n "The relatedImages section is missing from the CSV" | tee $(results.related_images_message.path)
echo -n "false" | tee $(results.related_images_flag.path)
fi
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ spec:
default: "registry.access.redhat.com/ubi8-minimal@sha256:54ef2173bba7384dc7609e8affbae1c36f8a3ec137cacc0866116d65dd4b9afe"
- name: dirty_flag
- name: related_images_flag
- name: related_images_message
steps:
- name: check-dirty-flag
image: "$(params.ubi8_minimal_image)"
Expand All @@ -32,6 +33,6 @@ spec:
RELATED_IMAGES_FLAG="$(params.related_images_flag)"
echo $RELATED_IMAGES_FLAG
if [ $RELATED_IMAGES_FLAG == "false" ]; then
echo "The relatedImages section is missing from the CSV"
echo "$(params.related_images_message)"
exit 1
fi
Loading