Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAchilleas Pipinellis <axil@gitlab.com>2023-03-09 01:29:37 +0300
committerEvan Read <eread@gitlab.com>2023-03-09 01:29:37 +0300
commit16cbd61ffd8649c4960420341a7b21ab0cfc19de (patch)
tree9d13da94c8cb4bdf12e7c46abdf841ce9e7a8e86 /scripts
parent23c3a8d8d9ee0d4aedde2515c9a60763c097be69 (diff)
Add test for navigation SCHEMA validation
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/check-navigation.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/scripts/check-navigation.sh b/scripts/check-navigation.sh
index 9274e576..5180fa0f 100755
--- a/scripts/check-navigation.sh
+++ b/scripts/check-navigation.sh
@@ -36,4 +36,21 @@ else
printf "${COLOR_GREEN}INFO: No entries with index.html found!${COLOR_RESET}\n"
fi
+# shellcheck disable=2059
+printf "${COLOR_GREEN}INFO: Checking global navigation against schema...${COLOR_RESET}\n"
+JSON_NAVIGATION=$(ruby -ryaml -rjson -e "puts YAML.load_file('content/_data/navigation.yaml').to_json")
+echo "$JSON_NAVIGATION" | bin/json_schemer spec/lib/gitlab/navigation/navigation_schema.json - > /dev/null
+RETURN_CODE="$?"
+if [[ $RETURN_CODE == 0 ]]; then
+ # shellcheck disable=2059
+ printf "${COLOR_GREEN}INFO: Global navigation matches schema!${COLOR_RESET}\n"
+else
+ # shellcheck disable=2059
+ printf "${COLOR_RED}ERROR: Global navigation doesn't match schema${COLOR_RESET}\n"
+ echo "$JSON_NAVIGATION" | bin/json_schemer spec/lib/gitlab/navigation/navigation_schema.json - > error.log
+ # shellcheck disable=2002
+ cat error.log | while IFS= read -r error; do echo "$error" | jq; done
+ RETURN_CODE=1
+fi
+
if [[ $RETURN_CODE == 1 ]]; then exit 1; else exit 0; fi