The GBT is represented in software by the Monitor and Control System (M&C). The identify of the M&C System at a given time is comprised essentially of two parts:
- The various executable files compiled from a given version of
ygor
/gb
/gbt
- The various configuration files from which these executables derive much of their state/behavior
Historically, there has been no explicit management of either of these sets of files. This repository represents an effort to change that: use git to track the state of both sets of files over time. We'll call each of these repositories a "Warded Repo". We have two basic goals:
- Prevent "bad" changes from being made in the first place
- Notify us when changes (of any kind) are made
These goals are each implemented by two mechanisms (with some overlap in responsibility):
- Git Hooks: Prevent commits that violate policy; notify when checkouts are made
- Config Warden: Periodically check a Warded Repo for locally modified files, and notify if there are any
- Git Commits
- Only SDD members may commit to non-primary branch (where "the release branch" will be one of
19.4
,22.1
, etc.) - Commits may not be made as
monctrl
user (group accounts shield identity of the committer)
- Only SDD members may commit to non-primary branch (where "the release branch" will be one of
- File Changes
- SDD will be notified of "local modifications" to Warded files
- Notifications will continue until all local modifications are resolved (committed, deleted, etc.)
A Warded Repo contains a pre_commit
hook that checks the commit for any policy violations, and rejects it if there are any.
See hooks/pre_commit.py
for implementation.
A Warded Repo contains a post_checkout
hook that notifies SDD of every checkout that occurs. This is typically the result of the switchVersions
script, but not always. Regardless, we want to be kept apprised of this.
See hooks/post_checkout.py
for implementation.
A Repo Warden is a simple tool, intended to be run as a cron job, for checking on the status of the GBT config repository. If there are files that have been modified but not committed, this will be reported via email to RECIPIENT(S). If the repo is clean, only a debug email will go out via the cron daemon.
8 6 * * * /home/gbt1/gbt_config_warden/gbt_config_warden /home/gbt/etc/config <recipients>
8 6 * * * /home/gbt1/gbt_config_warden/gbt_config_warden /home/sim/etc/config <recipients>
8 6 * * * /home/gbt1/gbt_config_warden/gbt_release_warden /home/gbtversions/22.1 <recipients>
8 6 * * * /home/gbt1/gbt_config_warden/gbt_release_warden /home/simversions/22.1 <recipients>
Note that gbt_config_warden
and gbt_release_warden
are very thin wrappers around repo_warden
; all they do is set REPORT_NAME
, then call repo_warden
Testing notes:
-
Don't test in the production repo. Do a
$ cp -a
of the production GBT config and test there -
Change
gbtconfig.debug = true
viagit config -e
. This will prevent emails from being sent (don't worry; they'll be printed tostdout
instead) -
Make changes
-
Verify the following use cases prior to making changes here:
- As a whitelisted/non-blacklisted user:
- On release branch:
- Attempt commit (this should succeed):
git commit --allow-empty -m "test commit"
- Attempt commit as blacklist author (this should succeed):
git commit --allow-empty -m "test commit" --author=<blacklist-author>
- Attempt commit as non-blacklist author (this should fail):
git commit --allow-empty -m "test commit" --author=<non-blacklist-author>
- Attempt commit (this should succeed):
- On non-release branch:
- Attempt commit (this should succeed):
git commit --allow-empty -m "test commit"
- Attempt commit as blacklist author (this should succeed):
git commit --allow-empty -m "test commit" --author=<blacklist-author>
- Attempt commit as non-blacklist author (this should fail):
git commit --allow-empty -m "test commit" --author=<non-blacklist-author>
- Attempt commit (this should succeed):
- On release branch:
- As non-whitelisted/non-blacklisted user:
- On release branch:
- Attempt commit (this should succeed):
git commit --allow-empty -m "test commit"
- Attempt commit as blacklist author (this should succeed):
git commit --allow-empty -m "test commit" --author=<blacklist-author>
- Attempt commit as non-blacklist author (this should fail):
git commit --allow-empty -m "test commit" --author=<non-blacklist-author>
- Attempt commit (this should succeed):
- On non-release branch:
- Attempt commit (this should fail):
git commit --allow-empty -m "test commit"
- Attempt commit as blacklist author (this should fail):
git commit --allow-empty -m "test commit" --author=<blacklist-author>
- Attempt commit as non-blacklist author (this should fail):
git commit --allow-empty -m "test commit" --author=<non-blacklist-author>
- Attempt commit (this should fail):
- On release branch:
- As a whitelisted/non-blacklisted user: