The implementation has to be adjusted to work with Linear
We regularly have tasks that need to be performed around a deploy. Be it to notify operations about changed application behavior, be it to run a little oneline script after the deploy. Most database-related stuff can be handled by migrations, but every once in a while, we have tasks that are much easier to be performed manually.
Writing deploy tasks
Here is how we manage the deploy tasks themselves:
- Deploy tasks are written inside the Pivotal Tracker story description, clearly marked (e.g. with a headline "Deploy task")
- We distinguish "before" and "after" as well as "staging" and "production deploy tasks
- Stories with pending deploy tasks get a label, describing when the deploy task has to be performed, e.g. "before staging deploy" or "after production deploy"
Now, before and after each deploy, the developer can filter by the respective label and see if there are any tasks to be performed. But what if this could be automated?
Automatically checking deploy tasks
- Make sure Geordi Show archive.org snapshot is installed (locally, don't put it into your Gemfile).
- Run
geordi commit
in order to set up API access for Pivotal Tracker. - Put the tracker_api Gem into your Gemfile.
- Store the attached pivotal_tracker_client.rb in app/util/. Note that it filters stories by their state. You may want to modify this.
- Store the attached deploy.rake in lib/capistrano/tasks/, or merge the tasks with an existing deploy.rake file in that location.
- Hook up the Rake tasks in Capfile:
before 'deploy:starting', 'deploy:before_deploy_tasks' # Before Slackistrano, if you're using it after 'deploy:finished', 'deploy:after_deploy_tasks' # Keep this last
- Deploy with
bundle exec
.
Now, when deploying, Capistrano will first check if there are any pending before deploy tasks. If so, it will print them and wait until you're ready to continue. After the deploy, it will check for after deploy tasks, and tell you if there are any.