From cb4916e89b75f97de67db62071e8ab2bcbb665ab Mon Sep 17 00:00:00 2001 From: dirgim Date: Wed, 25 Sep 2024 08:19:18 +0200 Subject: [PATCH] fix(KFLUXBUGS-1601): move fbc base image label check Signed-off-by: dirgim rh-pre-commit.version: 2.2.0 rh-pre-commit.check-secrets: ENABLED --- task/fbc-validation/0.1/fbc-validation.yaml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/task/fbc-validation/0.1/fbc-validation.yaml b/task/fbc-validation/0.1/fbc-validation.yaml index a53f0398a1..9782d7b374 100644 --- a/task/fbc-validation/0.1/fbc-validation.yaml +++ b/task/fbc-validation/0.1/fbc-validation.yaml @@ -95,6 +95,15 @@ spec: exit 0 fi + status=0 + base_image_name=$(jq -r ".Labels.\"org.opencontainers.image.base.name\"" ../inspect-image/image_inspect.json) || status=$? + if [ $status -ne 0 ]; then + echo "Could not get labels from inspect-image/image_inspect.json. Make sure file exists and it contains this label: org.opencontainers.image.base.name" + TEST_OUTPUT="$(make_result_json -r ERROR)" + echo "${TEST_OUTPUT}" | tee "$(results.TEST_OUTPUT.path)" + exit 0 + fi + status=0 conffolder=$(jq -r '.Labels ."operators.operatorframework.io.index.configs.v1"' ../inspect-image/image_inspect.json) || status=$? if [ $status -ne 0 ]; then @@ -183,14 +192,6 @@ spec: # examines the base_image_name tag to derive the target OCP version # assumes this is in the form # image-path:[v]major-digits.minor-digits[@sha...] - status=0 - base_image_name=$(jq -r ".Labels.\"org.opencontainers.image.base.name\"" ../inspect-image/image_inspect.json) || status=$? - if [ $status -ne 0 ]; then - echo "Could not get labels from inspect-image/image_inspect.json. Make sure file exists and it contains this label: org.opencontainers.image.base.name" - TEST_OUTPUT="$(make_result_json -r ERROR)" - echo "${TEST_OUTPUT}" | tee "$(results.TEST_OUTPUT.path)" - exit 0 - fi OCP_VER_FROM_BASE=$(echo "${base_image_name}" | sed -e "s/@.*$//" -e "s/^.*://") # strips hash first due to greedy match # extracts major digits and filters out any leading alphabetic characters, for e.g. 'v4' --> '4' OCP_VER_MAJOR=$(echo "${OCP_VER_FROM_BASE}" | cut -d '.' -f 1 | sed "s/^[a-zA-Z]*//")