With simplicity laying at its core, Slack has always seemed like a perfect complement to Buddy. And so it happened: with over 50% share in active accounts, it is our most popular integration of all-time.
The most common use-case for Slack and Buddy is sending notifications on finished builds and deployments to your team channel. Not many developers know, however, that you can also run deployments directly from Slack:
Use case: a WordPress Project
Let’s assume you have a WordPress application with the following delivery workflow:
- Prepare assets by running tasks in Gulp
- Deploy compiled assets to FTP server
- Notify your team of finished deployment or send message to QA that something went wrong
With Buddy, you can trigger all of the above with a simple
WARNING: Before you start, make sure that Slash command integration is enabled in Slack.
Set up a project with Buddy
- Sign up to Buddy with your GitHub/Bitbucket account or email
- Create a new project, select your Git provider, and choose your project:
INFO: For the purpose of this guide we’ll use a Git repository with an existing WP theme: https://github.com/buddy-works/buddy-wp-theme.git
<div class="video"><iframe src="//player.vimeo.com/video/238380570?badge=0" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe></div>
Set up a delivery pipeline
Now let’s add a delivery pipeline that will build and deliver your project upon receiving the command:
- Click Add a new pipeline
- Set the trigger mode to ‘On click’
- Select the branch from which you want to deploy
- Click Add a new pipeline when ready
Define the delivery actions
Now it’s time to reproduce your workflow into actions:
- Add a build action to process your files before the deployment. In this example we’ll use Gulp to compile SCSS to CSS.
- Add a transfer action to your type of server. In this example we’ll deploy to FTP.
- Add the Slack action to receive notifications of finished deployments. You can also add a second notification in the ‘Actions run on failure’ section that will send a custom message in case something goes wrong (eg. the build has failed)
INFO: You don’t have to add Slack actions to a pipeline to be able to run the pipeline. However, we do recommend adding so that you know what’s going on in your project.
When you’re done, the whole pipeline will look like this:
Run the pipeline from Slack
If your Slack command integration is properly configured, fire up your Slack and enter the command to run the deployment:
pipeline_name is the name of the command that you’ve entered in your Slash commands integration.
Congratulations! You have just mastered Slack to an extent you don’t even have to leave it to build and deploy WordPress. How many developers do you know who can do that?
Here is the complete list of actions that you can run with slash commands:
/[name] status– displays pipeline status
/[name] run– runs execution
/[name] cancel– cancels execution (must be in progress)
/[name] refresh– refreshes execution
/[name] retry– runs execution again (must be terminated or canceled)
/[name] clear run– deploy and refresh can be used with the clear cache trigger
/[name] refresh 1c002dd– deploy and refresh can be used with any revision
/[name] clear run 1c002dd– clear and revision can be run together