We recently released our ‘Mark as Deployed’ UI, which allows people to manually mark things as deployed. For a bit longer than that, we’ve had the hooks to do this through an automated deploy process. We finally got around to setting that up and it’s been really neat. Now, when we issue our automated deploy process, it results in an email with all of the tickets that were just deployed, which feels a lot like magic.
The steps to reproduce this are:
- Get the current production version.
- Get the sha for the current production version.
- Get the SHA for the build we’re deploying (based off of Travis)
- Read through the git logs, looking for “fixes #1234” or PR merges.
- Pull out any tickets referenced in PRs.
- Make a call out to the Sprintly API with the relevant tickets.
We get our current production version by looking at the remote filesystem. We link the folder sprintly-1234
to sprintly
which is for the 1234 build on Travis CI. We query Travis for this build ID and the to-be-deployed build ID to figure out their SHAs.
From here, we have 2 SHAs, the old one and the new one. We do a git log, and use Sprintly’s python library for parsing commit messages to read those in and see what tickets were affected. We also pull out any merged pull request. With these merged pull requests, we look them up in Sprintly’s pull request API (because Sprintly has already parsed the PR -> item parts once).
Now that we have a list of all of the items, we can push this list to Sprintly’s deploy API.
You can find some of our actual code for this in this gist.
The result is when we deploy our code via Fabric, we automatically create deploys to the specific environment in Sprintly.
When developers initiate the build to production, everyone following the related Sprintly items get notified via email. This is awesome because it means Phuong, our Managing Director, doesn’t need to bug each developer individually about what’s been shipped and when.
This fulfills one of Sprintly’s core values: don’t ask how things are going; get information before you even know you need it.