From e2a03cda5069ccdfc070d537f78cff09e5798f7b Mon Sep 17 00:00:00 2001 From: Enol Fernandez Date: Wed, 11 Dec 2024 12:14:20 +0000 Subject: [PATCH] Better GitHub integration --- validate.sh | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/validate.sh b/validate.sh index 46f40543..d17676cb 100755 --- a/validate.sh +++ b/validate.sh @@ -20,21 +20,19 @@ NOVA_ENDPOINT=$(mktemp) for f in sites/*.yaml; do goc_site=$(grep "^gocdb:" "$f" | cut -f2 -d":" | tr -d "[:space:]") endpoint=$(grep "^endpoint:" "$f" | cut -f2- -d":" | tr -d "[:space:]") - printf "Searching for endpoint %s in %s site (%s)\n" \ - "$endpoint" "$goc_site" "$f" + echo "::debug::Searching for endpoint $endpoint in $goc_site site ($f)" curl --silent "$goc_method&sitename=$goc_site&service_type=org.openstack.nova" \ >"$NOVA_ENDPOINT" if ! grep -q "$goc_site" "$NOVA_ENDPOINT"; then - printf "\033[0;31m[ERROR] Site %s not found in GOC\033[0m\n" "$goc_site" + echo "::error file=$f title=Missing site::Site $goc_site not found in GOC" exit_value=1 continue fi if ! grep -q "$endpoint" "$NOVA_ENDPOINT"; then - printf "\033[0;31m[ERROR] URL %s for %s not found in GOC\033[0m\n" \ - "$endpoint" "$goc_site" + echo "::error file=$f title=URL not found::URL $endpoint for $goc_site not found in GOC" exit_value=1 else - printf "\033[0;32m[OK]\033[0m\n" + echo "::notice file=$f title=OK::Site $goc_site is ok" fi # check if all VOs configured do exist # Try to use FQAN @@ -42,25 +40,24 @@ for f in sites/*.yaml; do # - just the name of the VO # - //some more extra/ # - /VO=/some more stuff/ + # Won't cause error in validation! for vo in $(yq -r ".vos[].name" <"$f" | cut -f2 -d"/" | sed "s/^VO=//"); do if ! grep -q "^$vo\$" "$VO_LIST"; then - printf "\033[0;31m[ERROR] VO %s not found in ops portal\033[0m\n" \ - "$vo" - exit_value=1 + echo "::warning file=$f title=VO not in ops portal::VO $vo not found in ops portal" fi done # check if site is also on: # https://github.com/tdviet/fedcloudclient/blob/master/config/sites.yaml if ! grep -q "$f" "$FEDCLOUD_CLI_SITES"; then - printf "\033[0;31m[ERROR] Site %s not found in fedcloudclient\033[0m\n" "$goc_site" + echo "::error file=$f title=Site not in fedcloudclient::Site $goc_site not found in fedcloudclient" exit_value=1 fi done for site in $(yq -r '.[]' <"$FEDCLOUD_CLI_SITES"); do if ! test -s "sites/$(basename "$site")"; then - printf "\033[0;31m[ERROR] Site %s not found in fedcloud-catchall-operations\033[0m\n" "$(basename "$site")" + echo "::error::Site $(basename "$site") not found in fedcloud-catchall-operations" exit_value=1 fi done @@ -68,8 +65,8 @@ done # check that the VO mappings are up to date according to ops portal for vo in $(yq -r '.vos | keys[]'