Combine post-deploy and post-rollback
This commit is contained in:
@@ -885,14 +885,14 @@ firing a JSON webhook. These variables include:
|
|||||||
- `MRSK_DESTINATION` - optional: destination, e.g. "staging"
|
- `MRSK_DESTINATION` - optional: destination, e.g. "staging"
|
||||||
- `MRSK_ROLE` - optional: role targeted, e.g. "web"
|
- `MRSK_ROLE` - optional: role targeted, e.g. "web"
|
||||||
|
|
||||||
There are three hooks:
|
There are two hooks:
|
||||||
|
|
||||||
1. pre-build
|
1. pre-build
|
||||||
Used for pre-build checks - e.g. there are no uncommitted changes or that CI has passed.
|
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.
|
This could be used to broadcast a deployment message, or register the new version with an APM.
|
||||||
|
|
||||||
|
|||||||
@@ -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"
|
|
||||||
@@ -205,7 +205,7 @@ class CliMainTest < CliTestCase
|
|||||||
test "rollback runs post deploy hook" do
|
test "rollback runs post deploy hook" do
|
||||||
Mrsk::Cli::Main.any_instance.stubs(:container_available?).returns(true)
|
Mrsk::Cli::Main.any_instance.stubs(:container_available?).returns(true)
|
||||||
|
|
||||||
ensure_hook_runs("post-rollback")
|
ensure_hook_runs("post-deploy")
|
||||||
run_command("rollback", "123")
|
run_command("rollback", "123")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
echo "Rolled back!"
|
|
||||||
mkdir -p /tmp/${TEST_ID} && touch /tmp/${TEST_ID}/post-rollback
|
|
||||||
@@ -17,7 +17,7 @@ class MainTest < IntegrationTest
|
|||||||
assert_hooks_ran "pre-build", "post-deploy"
|
assert_hooks_ran "pre-build", "post-deploy"
|
||||||
|
|
||||||
mrsk :rollback, first_version
|
mrsk :rollback, first_version
|
||||||
assert_hooks_ran "post-rollback"
|
assert_hooks_ran "post-deploy"
|
||||||
assert_app_is_up version: first_version
|
assert_app_is_up version: first_version
|
||||||
|
|
||||||
details = mrsk :details, capture: true
|
details = mrsk :details, capture: true
|
||||||
|
|||||||
Reference in New Issue
Block a user