Jenkins integration with Jira simplified

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.

Why should I connect my Jenkins pipelines to Jira?

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:

image.png

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:

image.png

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!

Connecting with the “Jenkins for Jira” app

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.

Installing the app

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:

image.png

Installing the Jenkins plugin

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:

image.png

 

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!

Registering your Jenkins server

Then, you register your Jenkins server and get a webhook URL and secret in return:

 image.png

Configuring the Jenkins plugin

You then copy the webhook URL and secret into the configuration of the Jenkins plugin that you have installed to your Jenkins server:

image.png

Currently, you still have to do this copy & pasting manually, but we’re looking into ways to automate this step in the future.

Profit!

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:

image.png

Let us know how it goes

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.

7 comments

Tuncay Senturk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 7, 2022

Thanks @Tom Hombergs 

Like Tom Hombergs likes this
Muhammet Ayal
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 8, 2022

Thank you for sharing. @Tom Hombergs 

Like Tom Hombergs likes this
Lotta Löfwall May 25, 2022

Anybody who knows if this app is going to be available for Data Center as well?

Tom Hombergs
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 1, 2022

@Lotta Löfwall there are currently no plans to make it available for Data Center.

Bo Roth July 1, 2022

Not sure if this is the right place to post this, but I'm having a strange issue. I've gotten the Jenkins/Jira integrations setup and I can see the pipeline and successful builds in my Jenkins for Jira configuration section inside of Jira, but I'm not seeing the builds show up in the Development section on the tickets themselves. 

As far as I can tell, the branch name, PR title, and commit message all contain the ticket ID, so I'm not sure what's causing them to not show up in the Development section of the ticket. Any ideas?

 

Posted as a separate discussion: https://community.atlassian.com/t5/Jira-questions/Jenkins-for-Jira-is-detecting-builds-but-isn-t-pulling-issue-IDs/qaq-p/2071989

Jeanne Howe May 15, 2023

Will this be developed/deployed for Jira Data Center?

 

Seems wrong that your DC customers would have to pay for this integration when Atlassian has it for free to Cloud.

Tomas Galindo May 23, 2023

Hello, I can't get it to work in scripted pipelines, do you know if it is a limitation? Thanks.

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events