Skip to content

Commit

Permalink
[ISV-5440] Extend relatedImages error message handling
Browse files Browse the repository at this point in the history
  • Loading branch information
mantomas committed Dec 20, 2024
1 parent 4d39461 commit b70b591
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
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

0 comments on commit b70b591

Please sign in to comment.