feat(ops/auto-deploy): Support emergency stops via stop file
Adds a feature to emergency-stop deploys by simply running `touch /var/lib/auto-deploy/stop`. This can be useful in some situations, especially if there is a process that reconciles service state (so that e.g. stopping the unit's timer would be undone). Change-Id: I233dfac365a578bfa4110eb605b50be079974ba4 Reviewed-on: https://cl.tvl.fyi/c/depot/+/4827 Autosubmit: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI Reviewed-by: grfn <grfn@gws.fyi> Reviewed-by: wpcarro <wpcarro@gmail.com>
This commit is contained in:
parent
b8e011f792
commit
7cac51a995
1 changed files with 9 additions and 0 deletions
|
@ -1,5 +1,9 @@
|
|||
# Defines a service for automatically and periodically calling depot's
|
||||
# rebuild-system on a NixOS machine.
|
||||
#
|
||||
# Deploys can be stopped in emergency situations by creating an empty
|
||||
# file called `stop` in the state directory of the auto-deploy service
|
||||
# (typically /var/lib/auto-deploy).
|
||||
{ depot, config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
|
@ -15,6 +19,11 @@ let
|
|||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -f $STATE_DIRECTORY/stop ]]; then
|
||||
echo "stop file exists in $STATE_DIRECTORY, not deploying!" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
readonly depot=$STATE_DIRECTORY/depot.git
|
||||
readonly deploy=$STATE_DIRECTORY/deploy
|
||||
readonly git="git -C $depot"
|
||||
|
|
Loading…
Reference in a new issue