Skip to content

imclean557/slack-pantheon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Overview

This is a slight reworking of the Quicksilver script for integrating Pantheon with Slack notifications. It fixes a problem where commit messages were not being sent to Slack. It also includes stronger differentiation between the actions commit, deploy and clear cache in the Slack channel and cuts out some things (which can be uncommented) to keep the information succinct and useful.

A slightly altered version of the original README continues below.

Slack Integration

This script shows how easy it is to integrate Slack notifications from your Pantheon project using Quicksilver. As a bonus, we also show you how to manage API keys outside of your site repository.

Instructions

  1. Enable Incoming Webhooks for your Slack instance.
  2. Copy the secret Webhook URL into a file called secrets.json and store it in the private files directory of every environment where you want to trigger Slack notifications.
  $> echo '{"slack_url": "https://hooks.slack.com/services/MY/SECRET/URL"}' > secrets.json
  # Note, you'll need to copy the secrets into each environment where you want to trigger Slack notifications.
  $> `terminus connection:info  --field=sftp_command site.env`
      Connected to appserver.dev.d1ef01f8-364c-4b91-a8e4-f2a46f14237e.drush.in.
  sftp> cd files  
  sftp> mkdir private
  sftp> cd private
  sftp> put secrets.json
  sftp> quit
  1. Add, and update as needed, the example slack_pantheon.php script to the private directory in the root of your site's codebase, that is under version control. Note this is a different private directory than where the secrets.json is stored.
  2. Add Quicksilver operations to your pantheon.yml
  3. Test a deploy out!

Optionally, you may want to use the terminus workflows watch command to get immediate debugging feedback. You may also want to customize your notifications further. The Slack API documentation has more on your options.

Example pantheon.yml

Here's an example of what your pantheon.yml would look like if this were the only Quicksilver operation you wanted to use. Pick and choose the exact workflows that you would like to see notifications for.

api_version: 1

workflows:
  deploy_product:
    after:
        - type: webphp
          description: Post to Slack after site creation
          script: private/scripts/slack_pantheon.php
  create_cloud_development_environment:
    after: 
        - type: webphp
          description: Post to Slack after Multidev creation
          script: private/scripts/slack_pantheon.php
  deploy:
    after:
        - type: webphp
          description: Post to Slack after deploy
          script: private/scripts/slack_pantheon.php
  sync_code:
    after:
        - type: webphp
          description: Post to Slack after code commit
          script: private/scripts/slack_pantheon.php
  clear_cache:
    after:
        - type: webphp
          description: Someone is clearing the cache again
          script: private/scripts/slack_pantheon.php

About

Slack integration for Pantheon hosting.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages