Learn more about Jira Cloud products, features, plans, and migration.
Integrate Jira Cloud with Confluence, development tools, apps, and self-hosted tools using OAuth and feature flags.
Control who has access to your Jira Cloud products and give them the right permissions to perform their role.
Learn how to set up, customize, and manage Jira Cloud projects.
Explore issues, issue types, issue custom fields, issue screens, custom field context, and issue field configurations in Jira Cloud.
Define the lifecycle of your work and learn about issue workflow schemes and the issue collector.
Learn more on how you can set up Jira Cloud for your team.
This integration exists to provide a free, easy, secure, and reliable way to connect your Jenkins server, running behind the firewall, and Jira Software Cloud and/or Jira Service Management Cloud. Simply add a few extra lines in the Jenkinsfile that defines your pipeline steps and the integration will start sending build and deployment data to Jira and associate that information with the relevant Jira issues.
This gives your entire team additional visibility and context on every issue detail view in Jira, showing the latest build status or if that work has been successfully deployed to an environment.
You can also use this information to search across issues using the Jira Query Language (JQL), easily answering questions like “which issues in the current sprint have been deployed to production”. You can even add these as quick filters on your boards!
Before you begin
Time: 15-30 mins
You're a site administrator of your Jira Cloud site.
You're an admin in Jenkins and you can install, update, and delete plugins.
Your team should be adding issue keys (e.g. FUSE-123) as part of their commit messages (for deployment information) and branch names (for build information). If your team isn't already following this pattern, learn more about referencing issues in your development work.
You can edit the Jenkinsfile in your source code/repo for the pipeline(s) you want to use this integration with.
Link Jira Software Cloud with Jenkins
Create OAuth credentials in Jira for Jenkins
Navigate to Jira home > Jira settings > Apps.
Select OAuth credentials.
Select Create credentials.
Enter the following details:
Install the Jira Cloud plugin for Jenkins
Log in to your Jenkins server and navigate to the Plugin Manager.
Select the 'Available' tab and search for 'Atlassian Jira Software Cloud' as the plugin name then install it.
The open-source plugin is hosted at GitHub. You can check it out here.
Add your OAuth credentials to Jenkins
In Jenkins, go to Manage Jenkins > Configure System screen and scroll to the Jira Software Cloud integration section.
Select Add Jira Cloud Site > Jira Cloud Site. The Site name, ClientID, and Secret fields display.
Enter the following details:
Site name: The URL for your Jira Cloud site, for example yourcompany.atlassian.net.
Client ID: Copy from OAuth credentials screen (Client ID column).
Secret: Select Add > Jenkins.
For Kind, select Secret text.
For Secret, copy from OAuth credentials screen (Secret column).
For Description, provide a helpful description
Secret: Select your newly created secret.
Select Test connection to make sure your credentials are valid for your Jira site.
Use the Jira cloud plugin for Jenkins
Go into a specific pipeline in Jenkins.
From the left-hand menu, select Pipeline Syntax.
In the Snippet Generator, select jiraSendDeploymentInfo or jiraSendBuildInfo, or checkGatingStatus from the dropdown list of Sample Steps and fill in the relevant details.
Select Generate Pipeline Script and copy/paste the output into your Jenkinsfile, wherever you want to notify Jira.
Send build information to Jira
This is an example snippet of a very simple ‘build’ stage set up in a Jenkinsfile. After the pipeline is run, it will post the build information to your Jira Cloud site by looking at the branch name. If there is a Jira issue key (e.g. “TEST-123”) in the branch name, it will send the data over to Jira.
Send deployment information to Jira
This is an example snippet of a stage that runs on any change to the master branch. Again, we use a post step to send deployment data to Jira and the relevant issues. Here, the environmentId, environmentName, and environmentType need to be set to whatever you want to appear in Jira. Include State and ServiceIds to add more context to deployment progress, result, and what is affected.
Include environment and service details as parameters
Site, environment, and service details – as parameters – are exposed to build as environment variables.
To add your Jira site, environment, and service details as parameters in your Jenkins pipeline:
Go to Jenkins and select a pipeline.
Select the General tab.
Check This project is parameterized.
Select Add Parameter > String parameter.
Enter the name, default value, and description for your parameter.
Specify custom logic to get issue keys
By default, the plugin extracts issue keys from all the commits messages in the changelog of the build. It is possible to override this behavior to add your own logic and supply the list issue keys as an issueKeys parameter.
View development information to Jira
If set up properly, whenever you make a commit or merge a PR in your SCM tool, like Bitbucket or GitHub, it should run the Jenkins pipeline you have specified for that repo. The build and deployment information will be visible on the issue detail view along the right-hand side. Learn how to view development information for an issue.
Link Jira Service Management Cloud with Jenkins
Was this helpful?