Combine post-deploy and post-rollback

This commit is contained in:
Donal McBreen
2023-05-23 12:14:37 +01:00
parent 004f1b04e6
commit cc2b321d93
5 changed files with 5 additions and 26 deletions

View File

@@ -885,14 +885,14 @@ firing a JSON webhook. These variables include:
- `MRSK_DESTINATION` - optional: destination, e.g. "staging"
- `MRSK_ROLE` - optional: role targeted, e.g. "web"
There are three hooks:
There are two hooks:
1. pre-build
Used for pre-build checks - e.g. there are no uncommitted changes or that CI has passed.
2. post-deploy and post-rollback
2. post-deploy - run after a deploy, redeploy or rollback
These two hooks are also passed a `MRSK_RUNTIME` env variable.
This hook is also passed a `MRSK_RUNTIME` env variable.
This could be used to broadcast a deployment message, or register the new version with an APM.

View File

@@ -1,18 +0,0 @@
#!/bin/sh
# A sample post-rollback hook
#
# Checks:
# 1. We have a clean checkout
# 2. A remote is configured
# 3. The branch has been pushed to the remote
# 4. The version we are deploying matches the remote
#
# These environment variables are available:
# MRSK_RECORDED_AT
# MRSK_PERFORMER
# MRSK_VERSION
# MRSK_DESTINATION (if set)
# MRSK_RUNTIME
echo "$MRSK_PERFORMER rolled back to $MRSK_VERSION on $MRSK_DESTINATION in $MRSK_RUNTIME seconds"

View File

@@ -205,7 +205,7 @@ class CliMainTest < CliTestCase
test "rollback runs post deploy hook" do
Mrsk::Cli::Main.any_instance.stubs(:container_available?).returns(true)
ensure_hook_runs("post-rollback")
ensure_hook_runs("post-deploy")
run_command("rollback", "123")
end

View File

@@ -1,3 +0,0 @@
#!/bin/sh
echo "Rolled back!"
mkdir -p /tmp/${TEST_ID} && touch /tmp/${TEST_ID}/post-rollback

View File

@@ -17,7 +17,7 @@ class MainTest < IntegrationTest
assert_hooks_ran "pre-build", "post-deploy"
mrsk :rollback, first_version
assert_hooks_ran "post-rollback"
assert_hooks_ran "post-deploy"
assert_app_is_up version: first_version
details = mrsk :details, capture: true