diff --git a/README.md b/README.md index 227d0ba2..d0279942 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/lib/mrsk/cli/templates/sample_hooks/post-rollback.sample b/lib/mrsk/cli/templates/sample_hooks/post-rollback.sample deleted file mode 100755 index 79e5680d..00000000 --- a/lib/mrsk/cli/templates/sample_hooks/post-rollback.sample +++ /dev/null @@ -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" diff --git a/test/cli/main_test.rb b/test/cli/main_test.rb index ed6d32b9..270e09b7 100644 --- a/test/cli/main_test.rb +++ b/test/cli/main_test.rb @@ -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 diff --git a/test/integration/docker/deployer/app/.mrsk/hooks/post-rollback b/test/integration/docker/deployer/app/.mrsk/hooks/post-rollback deleted file mode 100755 index af1e7944..00000000 --- a/test/integration/docker/deployer/app/.mrsk/hooks/post-rollback +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -echo "Rolled back!" -mkdir -p /tmp/${TEST_ID} && touch /tmp/${TEST_ID}/post-rollback diff --git a/test/integration/main_test.rb b/test/integration/main_test.rb index 866cd03b..9fecf6b1 100644 --- a/test/integration/main_test.rb +++ b/test/integration/main_test.rb @@ -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