Skip to content

Commit

Permalink
Better GitHub integration
Browse files Browse the repository at this point in the history
  • Loading branch information
enolfc committed Dec 11, 2024
1 parent 2998005 commit e2a03cd
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,56 +20,53 @@ 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 "<SITENAME>$goc_site</SITENAME>" "$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 "<URL>$endpoint</URL>" "$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
# So the VO that comes from the file, it will be either:
# - just the name of the VO
# - /<name of the VO>/some more extra/
# - /VO=<name of the 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

# check that the VO mappings are up to date according to ops portal
for vo in $(yq -r '.vos | keys[]' <vo-mappings.yaml | 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"
line="$(grep -n $vo vo-mappings.yaml | head -1 | cut -f1 -d:)"
echo "::error file=vo-mappings.yaml line=$line title=VO not in ops portal::VO $vo not found in ops portal"
exit_value=1
fi
done
Expand Down

0 comments on commit e2a03cd

Please sign in to comment.