Closed TimStallard closed 2 years ago
I've written a dumb check script which reads a list of repos, and checks the status of them
I think it would be good to put this in the monitoring repo, and deploy it via ansible - perhaps one for @Tyler-Ward? we could do this in the next workshop and make sure it's a documented process
#!/bin/bash
if [ ! -f /etc/git-repos ]; then
echo "GIT no repos"
exit 0
fi
for repo in $(cat /etc/git-repos); do
if [ $(git -C $repo status --porcelain | wc -l) -ne 0 ]; then
echo "Repo $repo has uncommitted changes"
exit 1
fi
if [ $(git -C $repo log @{u}.. | wc -l) -ne 0 ]; then
echo "Repo $repo has unpushed changes"
exit 1
fi
if [ $(git -C $repo log ..@{u} | wc -l) -ne 0 ]; then
echo "Repo $repo is behind upstream"
exit 1
fi
done
echo "GIT check OK"
exit 0
We should check for uncommitted changes, as well as local commits that haven't yet been pushed. I think this could simply be run from icinga2, via NRPE.
There's an old system in place which reports repo status back to auth2 (to MySQL!) and then a cron which reports that into SOWN-Bot - it'd be nice if we could replace that at the same time, so we'd be one step closer to moving stuff off auth2