📣 Attention Salesforce Certified Trailblazers! Link your Trailhead and Webassessor accounts and maintain your credentials by December 14th. Learn more.
close
trailhead

Run Tasks with Release Phase

Learning Objectives

After completing this unit, you’ll be able to:

  • Set up and use Release Phase.
  • Check activity and release logs.

Let’s see how Release Phase works. The most common use case for release phase is database migration, or to upload assets remotely if you’re using a content delivery network (CDN). To keep things simple and show you how the feature works, we’re just going to add an echo command.

  1. In GitHub, go to the flow-demo repo and click Procfile. A Procfile is a mechanism for declaring what commands are run by your application on the Heroku platform. It should be named Procfile exactly (for example, Procfile.txt is not valid) and placed in the root directory of your repository. It won't function if placed in a subdirectory.
  2. Click the small pencil in the top right corner to edit the Procfile.
  3. Now define a release process type in the proc file, as well as a command to run. The release command is run when a new release is created. Add the following line at the end of the file: release: echo "You created a new release on Heroku. Here's a cookie! 🍪" Add release phase
  4. Scroll down and enter commit title and description. Select Create a new branch for this commit and start a pull request, and leave the name as the default. Click Propose file change.
  5. Click Create pull request on the next screen. Since a review app is created for any pull request, you’ll notice a new review app created from your changes to the proc file if you go back to your Heroku dashboard. New review app is created
  6. If there are no issues with the review app, we can merge code changes back to master. Opening the app in the browser won’t show any changes since we didn’t make any visual changes to the code, but helps make sure the app is still running and has the final changes we made in the previous unit.
  7. Go back to GitHub, click Merge Pull Request. Leave the text as the default, and click Confirm Merge.
  8. If you go to your Heroku dashboard, you can see that the review app has moved to the Staging column. Since we enabled automatic deploys, every push to master deploys a new version of this app.
  9. To finish setting up Release Phase, select Promote to production from under the flow-staging-demoapp staging app, double check the name of the production app, and select Promote.
  10. Now you can see all the build and release details. Click the flow-production-demoapp app, then the latest view release log link and you can see the comment we added to the proc file echoed here: You created a new release on Heroku! Here's a cookie! 🍪”. Build and release detailsIf our Release Phase task was for a database migration instead, for example, you would see all the logs related to that process and whether there’s been any problems or not. If you go back to the activity feed now by selecting Activity from under the top menu, you will notice a Roll back to here option, which is a key feature of the Heroku platform. With Heroku rollback, you can roll back to a previous, known good release with one click, providing a fast way to revert in case of bad deploys or config changes. We don’t need to use this feature now, but keep it in mind if you ever need to go back to a healthy deploy and make the changes all over again. Activity feedNote: Heroku CI is not enabled yet, and your Pipeline isn’t connected to an external CI system. If CI were configured, there would be tests running when changes were merged to master, ensuring changes to the code are error-free and aligned with the code base. You’ve learned about many of the features of Heroku Flow. Although Heroku CI is one of the main features of Heroku Flow, we didn’t work with it in this module. Why? Because free CI test runs are susceptible to abuse, we need to make sure that each Heroku CI user is backed by a valid payment identity. If you want to complete your Heroku Flow education by learning about Heroku CI, add a valid credit card and read our developer documentation.

Welcome to the Heroku CI family!

retargeting