Skip to content

Instantly share code, notes, and snippets.

@grasmash
Created October 1, 2014 15:32
Show Gist options
  • Save grasmash/65e2d0fadb8ff43d527c to your computer and use it in GitHub Desktop.
Save grasmash/65e2d0fadb8ff43d527c to your computer and use it in GitHub Desktop.
Acquia Cloud Slack integration
TOKEN=obfuscation
SLACK_WEBHOOK_URL=https://yoursite.slack.com/services/hooks/incoming-webhook?token=$TOKEN
#!/bin/sh
#
# Cloud Hook: post-code-deploy
#
# The post-code-deploy hook is run whenever you use the Workflow page to
# deploy new code to an environment, either via drag-drop or by selecting
# an existing branch or tag from the Code drop-down list. See
# ../README.md for details.
#
# Usage: post-code-deploy 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"
# Load the Slack webhook URL (which is not stored in this repo).
. $HOME/slack_settings
# Post deployment notice to Slack
curl -X POST --data-urlencode "payload={\"username\": \"Acquia Cloud\", \"text\": \"A new deployment has been made to *$target_env* using tag *$deployed_tag* on <https://insight.acquia.com/cloud/workflow?s=1456541|Acquia Cloud>.\", \"icon_emoji\": \":information_source:\"}" $SLACK_WEBHOOK_URL
#!/bin/sh
#
# Cloud Hook: post-db-copy
#
# The post-db-copy hook is run whenever you use the Workflow page to copy a
# database from one environment to another. See ../README.md for
# details.
#
# Usage: post-db-copy site target-env db-name source-env
site="$1"
target_env="$2"
db_name="$3"
source_env="$4"
# Load the Slack webhook URL (which is not stored in this repo).
. $HOME/slack_settings
# Post deployment notice to Slack
curl -X POST --data-urlencode "payload={\"username\": \"Acquia Cloud\", \"text\": \"The database *$db_name* has been copied from *$source_env* to *$target_env* on <https://insight.acquia.com/cloud/workflow?s=1456541|Acquia Cloud>.\", \"icon_emoji\": \":information_source:\"}" $SLACK_WEBHOOK_URL
#!/bin/sh
#
# Cloud Hook: post-files-copy
#
# The post-files-copy hook is run whenever you use the Workflow page to
# copy the files directory from one environment to another. See
# ../README.md for details.
#
# Usage: post-files-copy site target-env source-env
site="$1"
target_env="$2"
source_env="$3"
# Load the Slack webhook URL (which is not stored in this repo).
. $HOME/slack_settings
# Post deployment notice to Slack
curl -X POST --data-urlencode "payload={\"username\": \"Acquia Cloud\", \"text\": \"Files have been copied from *$source_env* to *$target_env* on <https://insight.acquia.com/cloud/workflow?s=1456541|Acquia Cloud>.\", \"icon_emoji\": \":information_source:\"}" $SLACK_WEBHOOK_URL
@froboy
Copy link

froboy commented Oct 15, 2015

You might not want to put your acquia cloud url in the code here. I forked and took the site url out into the settings file. https://gist.github.com/froboy/81efc50345c73b959cc9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment