diff --git a/task/fbc-related-image-check/0.1/fbc-related-image-check.yaml b/task/fbc-related-image-check/0.1/fbc-related-image-check.yaml index 697f98c6db..b899b2197c 100644 --- a/task/fbc-related-image-check/0.1/fbc-related-image-check.yaml +++ b/task/fbc-related-image-check/0.1/fbc-related-image-check.yaml @@ -34,25 +34,20 @@ spec: trap 'handle_error $(results.TEST_OUTPUT.path)' EXIT FAILEDIMAGES="" - catalog="$(find $(workspaces.workspace.path)/hacbs/fbc-validation/ -name catalog.yaml)" + catalog="$(opm render $(workspaces.workspace.path)/hacbs/fbc-validation/confdir/)" # OPM generates catalog file in a way that yaml file could contain stream of JSON objects # thats why we need jq in for this situation, because yq can't parse this file # however there is also posibility that catalog.yaml has yaml data in it status=0 - relImgs="$(yq -r '.relatedImages[]?.image' $catalog)" || status=$? + relImgs="$(jq -r '.relatedImages[]?.image' <<< ${catalog)" || status=$? if [ $status -ne 0 ]; then - echo "Processing the catalog with yq failed because catalog.yaml contains data type other than yaml. Attempting to process with jq..." - status=0 - relImgs="$(jq -r '.relatedImages[]?.image' $catalog)" || status=$? - if [ $status -ne 0 ]; then - echo "Could not get related images. Make sure catalog.yaml exists in FBC fragment image and it is valid .yaml format." - note="Task $(context.task.name) failed: Could not fetch related images. Make sure you have catalog.yaml formatted correctly in your file-based catalog (FBC) fragment image." - TEST_OUTPUT=$(make_result_json -r FAILURE -f 1 -t "$note") - echo "${TEST_OUTPUT}" | tee "$(results.TEST_OUTPUT.path)" + echo "Could not get related images. Make sure catalog.yaml exists in FBC fragment image and it is valid .yaml or .json format." + note="Task $(context.task.name) failed: Could not fetch related images. Make sure you have catalog.yaml or catalog.json formatted correctly in your file-based catalog (FBC) fragment image." + TEST_OUTPUT=$(make_result_json -r FAILURE -f 1 -t "$note") + echo "${TEST_OUTPUT}" | tee "$(results.TEST_OUTPUT.path)" exit 0 - fi fi echo -e "These are related images:\n$relImgs."