If you are a Jira admin and your teams are using both Jenkins and Jira, we’re happy to announce that your life has just become a bit simpler 🙂.
In March, we have released the new and free Jenkins for Jira app on the Jira Marketplace, making it easier to connect your Jenkins servers with your Jira projects than it was before. Read on to find out what has changed and how it can help your team.
If you haven’t connected your Jenkins pipelines to your Jira site before, you might wonder what value this connection provides. In a nutshell, it’s to increase the visibility of your builds and deployments so that your team has complete visibility of your builds and deployments in Jira. For example, they can see which build might be failing or which Jira issue has been deployed to which environment.
Once connected, every time a build pipeline is triggered, Jenkins will send information about the status of this build to Jira. Jira will then show the builds in the “Development” section of the issue view:
If the build pipeline also contains a step that deploys your software to a runtime environment, Jenkins will additionally send information about this deployment to Jira. You can see in the “Releases” section of the screenshot above that the change made for this specific Jira issue has been successfully deployed to a production environment.
How does Jenkins know which Jira issue a build or deployment to associate to? A Jenkins pipeline is usually triggered by a commit pushed to a Git repository. Jenkins looks for Jira issue keys like “PROJ-1” in the all the commit messages since the last time the pipeline has run. If it finds any, it will add the build and deployment information to those issues in Jira.
But seeing the builds and deployments in the issue view is not all! Jira also shows your deployments on a timeline:
This gives the whole team (including non-developers) a nice overview of which features have been deployed into staging and/or production already. QA engineers will know which features can be tested where and product managers will know which features are already live. You can read more about deployments in Jira here.
There are some other nice features Jira provides when it gets deployment information from your Jenkins server (or other CI/CD tool), like a cycle time report or a deployment frequency report. Also, you can use the events “Deployment successful”, “Deployment failed”, and “Deployment status failed” in automation rules to automatically trigger some actions in Jira. Powerful stuff!
If you have connected a Jenkins server with Jira before, you might have used Jira’s OAuth feature and version 1.x of the Atlassian Jira Software Cloud Plugin.
The user experience was a bit bumpy, though. As a Jira admin, you might have searched for “Jenkins” in the Jira Marketplace, found the “Jenkins for Jira” app, only to realize that this wasn’t a real app but instead it would just point you to a wall of text explaining how to set everything up. You would have to:
work through the docs to understand everything,
install the Jenkins plugin,
create OAuth credentials in Jira,
paste them into the Jenkins plugin,
and finally modify your Jenkinsfiles to add specific build steps that would send build and deployment information to Jira.
With the new “Jenkins for Jira” app we want to make this experience much simpler.
Instead of just redirecting to the docs, the Marketplace listing is now a real app that you can install into your Jira site.
After installing the app, when you navigate to the “Manage apps” page, you now get an entry in the navigation:
This link leads you to the new app within Jira, which leads you through the process of setting everything up without you having to read through a long page of docs:
You still need to install the Jenkins plugin (the most recent version 2.x!), but we hope that it’s much clearer now how to do it!
Then, you register your Jenkins server and get a webhook URL and secret in return:
You then copy the webhook URL and secret into the configuration of the Jenkins plugin that you have installed to your Jenkins server:
Currently, you still have to do this copy & pasting manually, but we’re looking into ways to automate this step in the future.
Finally, and this is a great improvement to before, you don’t have to modify your Jenkinsfiles to have Jenkins send builds and deployments to Jira anymore!
With the previous version of the Jenkins plugin, you would have to add steps like these to your Jenkinsfile:
post {
always {
jiraSendBuildInfo site: 'example.atlassian.net', branch: 'TEST-123-awesome-feature'
}
}
post {
always {
jiraSendDeploymentInfo environmentId: 'us-prod-1', environmentName: 'us-prod-1', environmentType: 'production'
}
}
With version 2.x, the Jenkins plugin will now automatically send build information to Jira. It will also automatically send deployment information to Jira if your build steps are named according to the convention “deploy to <environment_name>”:
stage('deploy to prod') {
steps {
echo 'Deploying...'
}
}
You can change the naming convention by providing a regular expression in the configuration settings of the Jenkins plugin:
While the old way of connecting via OAuth credentials is still working (with version <= 1.4.5 of the Jenkins plugin and OAuth credentials created in Jira), we invite you to try out the new Jenkins for Jira app.
We hope that this makes the experience of integrating Jenkins with Jira much smoother than it has been.
Where can we improve it? What is missing? Any questions? Let us know.
Get started with our support docs.
Tom Hombergs
7 comments