From adaae19d62bd639988acaf152064b3a7f8fb489d Mon Sep 17 00:00:00 2001 From: Alex Iribarren Date: Fri, 5 Mar 2021 14:38:06 +0100 Subject: [PATCH] Validator doesn't detect versions automatically --- ci_templates/.gitlab-ci-scripts.yml | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/ci_templates/.gitlab-ci-scripts.yml b/ci_templates/.gitlab-ci-scripts.yml index f7b7bbe..76deaa0 100644 --- a/ci_templates/.gitlab-ci-scripts.yml +++ b/ci_templates/.gitlab-ci-scripts.yml @@ -5,7 +5,31 @@ validate: image: 'gitlab-registry.cern.ch/linuxsupport/cs8-base' script: - dnf install -y pykickstart - - ls *.ks | xargs -i ksvalidator {} + - RET=0 + - |- + function validate { + VER=$1 + FILE=$2 + + echo -e "\e[1m\e[32mValidating ${FILE} for ${VER}:\e[0m" + # Don't fail immediately if ksvalidator finds an error + set +e + ksvalidator -v "${VER}" "${FILE}" + R=$? + set -e + + if [[ $R -ne 0 ]]; then + RET=$(($RET + $R)) + echo -e '\e[1m\e[31mValidation failed!\e[0m' + else + echo -e "\e[32mLooking good.\e[0m" + fi + } + # List each kickstart template and it's version + - validate RHEL7 cc7-cloud.ks + - validate RHEL8 c8-cloud.ks + - validate RHEL8 cs8-cloud.ks + - exit $RET .build_image: stage: build -- GitLab