mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-04 10:09:42 +00:00
Use the number of args to ensure old editions still succeed. Only commit in the "else" branch (same file)
19 lines
743 B
Bash
Executable File
19 lines
743 B
Bash
Executable File
#!/bin/bash
|
|
|
|
if [[ $# -eq 0 ]]; then
|
|
GIT_ROOT=/home/wiki/gitwiki
|
|
else
|
|
GIT_ROOT=$1
|
|
fi
|
|
PATH_TO_TRAC_TRAC_URLS="configuration/tractrac-json-urls"
|
|
urls=$(mongo --quiet "mongodb://dbserver.internal.sapsailing.com:10201/winddb?replicaSet=archive" --eval 'db.TRACTRAC_CONFIGURATIONS.find({}, {TT_CONFIG_JSON_URL : 1}).toArray()' | grep -v ObjectId | jq -r '.[].TT_CONFIG_JSON_URL' )
|
|
if [[ $urls == "null" ]]; then
|
|
echo "Mongo db returns null for tractrac url discovery" | notify-operators "MongoDB/tractrac urls issue"
|
|
exit 1
|
|
else
|
|
echo ${urls} | sort -u >"${GIT_ROOT}/${PATH_TO_TRAC_TRAC_URLS}"
|
|
cd "${GIT_ROOT}"
|
|
git add "${GIT_ROOT}/${PATH_TO_TRAC_TRAC_URLS}"
|
|
git commit -m "Updated tractrac-json-urls"
|
|
git push
|
|
fi |