Following Git workflows, there is a branch called activesprint or develop. It is the release candidate. Most active branches should base on it.
Teams need to be notified whenever a new activesprint branch has been created. To lower the communication effort, we can automate the detection process and get Slack notifications.
Why We Need Slack Notifications
For one, when a new active Sprint is created, we usually need to merge our private branches as soon as possible. The earlier we do the branch merge, the less merge effort we should expect.
Secondly, config files might need to be updated accordingly (especially the bump version).
Backbone: Jenkins and Slack
First of all, we need to detect when a new Git branch has been created.
We have two ways: push or poll. If we have the admin privilege of Git repo, we can define a Git hook. The hook subscribes to the Git branch to create an event. Or, we can define a crontab, which will periodically poll latest branch list of Git ls-remote –heads origin.
Fortunately, activesprint usually has a strong naming convention (say sprint-37/sprint-38 or 1.37/1.38). Once we figure out latest branch list, we can easily detect whether a new activesprint branch has been created.
For a bigger adoption, we use the poll mechanism:
Whenever we detect a new activesprint, we fail the job and it sends out Slack notifications.
This is how the Jenkins job looks:
Once we have it properly configured, we will get a lovely Slack notification:
Any improvements or suggestions? Share your experience!
Check out the original article here.