MRSK hooks

Adds hooks to MRSK. Currently just two hooks, pre-build and post-push.

We could break the build and push into two separate commands if we
found the need for post-build and/or pre-push hooks.

Hooks are stored in `.mrsk/hooks`. Running `mrsk init` will now create
that folder and add sample hook scripts.

Hooks returning non-zero exit codes will abort the current command.

Further potential work here:
- We could replace the audit broadcast command with a
post-deploy/post-rollback hook or similar
- Maybe provide pre-command/post-command hooks that run after every
mrsk invocation
- Also look for hooks in `~/.mrsk/hooks`
This commit is contained in:
Donal McBreen
2023-05-05 15:08:28 +01:00
parent 340ed94fa9
commit 58c1096a90
23 changed files with 292 additions and 51 deletions

View File

@@ -100,6 +100,14 @@ class Mrsk::Commander
@healthcheck ||= Mrsk::Commands::Healthcheck.new(config)
end
def hook
@hook ||= Mrsk::Commands::Hook.new(config)
end
def lock
@lock ||= Mrsk::Commands::Lock.new(config)
end
def prune
@prune ||= Mrsk::Commands::Prune.new(config)
end
@@ -112,10 +120,6 @@ class Mrsk::Commander
@traefik ||= Mrsk::Commands::Traefik.new(config)
end
def lock
@lock ||= Mrsk::Commands::Lock.new(config)
end
def with_verbosity(level)
old_level = self.verbosity