Permalink
Browse files

Merge pull request #21 from doylejd/feature/PSI-278-post-code-update-…

…hook-example

PSI-278 Post Code Update hook example
  • Loading branch information...
2 parents 8670f16 + 102eba3 commit a56ebc706b45d6a9606f4693c1e4aa8c1fe6ec7f @bjaspan bjaspan committed Nov 4, 2015
Showing with 27 additions and 0 deletions.
  1. +1 −0 README.md
  2. +26 −0 samples/post-code-update.tmpl
View
@@ -95,6 +95,7 @@ The samples directory contains bare-bones example scripts for each of the suppor
Sample scripts currently include:
* post-code-deploy.tmpl: Template for post-code-deploy hook scripts.
+* post-code-update.tmpl: Template for post-code-update hook scripts.
* post-db-copy.tmpl: Template for post-db-copy hook scripts.
* post-files-copy.tmpl: Template for post-files-copy hook scripts.
* update-db.sh: Run drush updatedb to perform database updates.
@@ -0,0 +1,26 @@
+#!/bin/sh
+#
+# Cloud Hook: post-code-update
+#
+# The post-code-update hook runs in response to code commits.
+# When you push commits to a Git branch, the post-code-update hooks runs for
+# each environment that is currently running that branch. See
+# ../README.md for details.
+#
+# Usage: post-code-update site target-env source-branch deployed-tag repo-url
+# repo-type
+
+site="$1"
+target_env="$2"
+source_branch="$3"
+deployed_tag="$4"
+repo_url="$5"
+repo_type="$6"
+
+
+if [ "$target_env" != 'prod' ]; then
+ echo "$site.$target_env: The $source_branch branch has been updated on $target_env. Clearing the cache."
+ drush @$site.$target_env cc all
+else
+ echo "$site.$target_env: The $source_branch branch has been updated on $target_env."
+fi

0 comments on commit a56ebc7

Please sign in to comment.