In our final two articles, we explored find out how to configure CI/CD for Heroku utilizing Heroku pipelines. When viewing a pipeline inside the Heroku dashboard, you may simply begin a deployment or promote your code from one atmosphere to the subsequent with the clicking of a button. From the dashboard, you may monitor the deployment and think about its progress.
This all works very well, assuming that you’ve got Heroku open in your browser. However, what should you needed to do all of it from Slack?
Software program engineers use loads of apps at work. All through the day, we’re continually bouncing between Zoom conferences, Jira duties, Slack conversations, GitHub, e-mail, our calendar, and our IDE. This context switching may be exhausting and likewise result in loads of visible litter on our displays.
Typically, it’s good to only dwell in Slack, and that’s why many instruments provide Slack integrations. With these Slack integrations, you may monitor numerous processes and even use shortcut instructions to set off actions.
Heroku ChatOps, the Heroku Slack integration, permits you to begin and monitor deployments instantly from Slack. On this article, we’ll discover a number of the Slack instructions it affords.
Getting Began
When you’d prefer to comply with alongside all through this tutorial, you’ll want a Heroku account and a GitHub account. You may create a Heroku account right here, and you’ll create a GitHub account right here.
The demo app that we’ll use with our Heroku pipeline on this article is deployed to Heroku, and the code is hosted on GitHub.
Create Our Heroku Pipeline
We gained’t undergo the step-by-step course of for making a Heroku pipeline on this article. Refer to those articles for a walkthrough of making a Heroku pipeline:
You may also learn the Heroku docs for Heroku pipelines.
Configuring your Heroku pipeline consists of the next steps:
- Create a GitHub repo.
- Create a Heroku pipeline.
- Join the GitHub repo to the Heroku pipeline.
- Add a staging app to the pipeline.
- Add a manufacturing app to the pipeline.
The opposite actions that you simply’ll see in these articles, similar to configuring evaluate apps, Heroku CI, or automated deployments are non-obligatory. In reality, for the needs of this demo, I like to recommend not configuring automated deployments, since we’ll be utilizing some Slack instructions to start out the deployments.
While you’re completed, it is best to have a Heroku pipeline that appears one thing like this:
Instance Heroku Pipeline
Hook up with Slack
Now that you’ve got your Heroku pipeline created, it’s time for the enjoyable half: integrating with Slack. You may set up the Heroku ChatOps Slack app right here.
Clicking that hyperlink will immediate you to grant the Heroku ChatOps app permission to entry your Slack workspace:
Grant Heroku ChatOps entry to your Slack workspace
After that, you may add the Heroku ChatOps app to any Slack channel in your workspace.
Add the Heroku ChatOps app
After including the app, kind /h login
and hit Enter. This may immediate you to attach your Heroku and GitHub accounts. You’ll see a number of Heroku OAuth and GitHub OAuth screens the place you affirm connecting these accounts.
(As a private anecdote, I discovered that it took me a number of tries to attach my Heroku account and my GitHub account. It could be as a result of having a number of Slack workspaces to select from, however I’m unsure.)
After connecting your Heroku account and your GitHub account, you’re prepared to start out utilizing Heroku in Slack.
View All Pipelines
To view all deployable pipelines, you may kind /h pipelines
:
View all pipelines
View Pipeline Data
To see details about any given pipeline, kind /h data
. (Something you see in angle brackets all through this text needs to be changed by an precise worth. On this case, the worth could be the title of a pipeline — for instance, “heroku-flow-demo-pipeline”.)
View pipeline data
View Previous Releases
To view a historical past of previous releases for any given pipeline, kind /h releases
.
View previous releases
This command defaults to displaying you previous releases for the manufacturing app, so if you wish to see the previous releases for the staging app, you may kind /h releases
, the place
is “staging”.
View previous staging releases
Deploy To Staging
Now that we all know which pipelines can be found, we are able to see details about any given pipeline together with when the code was final launched for that pipeline. We’re able to set off a deployment.
Most engineering organizations have a Slack channel (or channels) the place they monitor deployments. Think about having the ability to begin a deployment proper from that channel and monitor it because it goes out! That’s precisely what we’ll do subsequent.
To begin a deployment to your staging atmosphere, kind /h deploy
, the place
is “staging.”
Deploy to staging
After operating that command, an preliminary message is posted to speak that the app is being deployed. Shortly after, you’ll additionally see a number of extra messages, this time in a Slack thread on the unique message:
Slack messages despatched when deploying to staging
If you wish to confirm what you’re seeing in Slack, you may at all times verify the Heroku pipeline in your Heroku dashboard. You’ll see the identical data: The staging app has been deployed!
Staging app proven within the Heroku dashboard
Promote to Manufacturing
Now, let’s promote our app to manufacturing. With out the Slack instructions, we might navigate to our Heroku pipeline, click on the “Promote to production” button, after which affirm that motion within the modal dialog that seems. Nonetheless, we’d desire to remain in Slack.
To advertise the app to manufacturing from Slack, kind /h promote
.
Promote to manufacturing
Identical to with the staging deployment, an preliminary Slack message will likely be despatched, adopted by a number of different messages because the manufacturing deployment goes out:
Slack messages despatched when selling to manufacturing
And — voilà — the newest adjustments to the app are actually in manufacturing!
Conclusion
Now you can begin and monitor Heroku app deployments all from Slack — no must context swap or transfer between a number of apps.
For extra use circumstances and superior setups, you too can try the docs.
Blissful deploying!