Add a pre-connect hook

This can be used for hooks that should run before connecting to remote
hosts. An example use case is pre-warming DNS.
This commit is contained in:
Donal McBreen
2023-05-24 11:39:48 +01:00
parent 483b893018
commit 66f9ce0e90
8 changed files with 75 additions and 9 deletions

View File

@@ -880,17 +880,21 @@ fine-grained audit reporting, e.g. for triggering deployment reports or
firing a JSON webhook. These variables include:
- `MRSK_RECORDED_AT` - UTC timestamp in ISO 8601 format, e.g. `2023-04-14T17:07:31Z`
- `MRSK_PERFORMER` - the local user performing the command (from `whoami`)
- `MRSK_MESSAGE` - the full audit message, e.g. "Deployed app@150b24f"
- `MRSK_SERVICE_VERSION` - an abbreviated version (for use in messages)
- `MRSK_SERVICE_VERSION` - an abbreviated service and version for use in messages, e.g. app@150b24f
- `MRSK_VERSION` - an full version being deployed
- `MRSK_DESTINATION` - optional: destination, e.g. "staging"
- `MRSK_HOSTS` - a comma separated list of the hosts targeted by the command
- `MRSK_ROLE` - optional: role targeted, e.g. "web"
There are two hooks:
There are three hooks:
1. pre-build
1. pre-connect
Called before taking the deploy lock. For checks that need to run before connecting to remote hosts - e.g. DNS warming.
2. pre-build
Used for pre-build checks - e.g. there are no uncommitted changes or that CI has passed.
2. post-deploy - run after a deploy, redeploy or rollback
3. post-deploy - run after a deploy, redeploy or rollback
This hook is also passed a `MRSK_RUNTIME` env variable.