Integrating JIRA With Jenkins

Author: Kavya Saxena

Jenkins has become one of the most popular tools to create CI/CD pipelines. There are many reasons for this, and one is the number of plugins and integrations that allow users to work with almost any tool or platform out there.

For teams practicing DevOps, Jira Software is the backbone of Atlassian’s open, integrated toolchain known as Open DevOps. Jira Software integrates with first- and third-party tools throughout the DevOps lifecycle. 

  • Jenkins should be installed on your system. If not, click here to install it.
  • A JIRA account should be created.
Connecting the JIRA plugin:
  • Login to Jenkins.
  • Click on Manage Jenkins.
  • Click on Manage Plugins under the System Configurations.
  • In Plugin Manager type Jira Plugin under available and select install without restart.
  • Check under the installed tab by searching Jira.
Setup Jira Credentials:
  • Login to Jira account.
  • Click on your profile => Manage Accounts
  • Select Security => Click create and manage 
  • Click on create and manage API tokens => create API Token. Save the Password as it can be accessed only once (Note: if you forget the password then revoke this token and create a new one).
  • Go back to Jenkins => Manage Jenkins => System Configuration => Configure System
  • Search for Jira sites. Give it a name, URL of Jira Account eg. https://<username>
  • Choose Login type: Basic =>
    • Username: (Email id with which you registered to Jira)
    • Password: (The API token password saved earlier)
  • Click on the test connection to see if it’s a success.
Creating a Jenkins Job:
  • Go to Jenkins Dashboard
  • Click on +New Item to create a new job.
  • Create a pipeline with any name, eg. Jira-Jenkins Integration.
  • In General, Select the Jira Site which you configured under the Manage Jenkins => Configure System
  • In the pipeline tab select pipeline script and then select Hello-World script.
  • Write the above-shown script to Add comments in a specified Jira Task (Note: Other tasks can also be performed using the Jira Plugin. You can write the script with the help of Pipeline Syntax).
    • jiraAddComment: It is the groovy syntax to add comments in a Jira task.
    • Comment: mention the desired comment in single quotes (‘ ‘)
    • idOrkey: Write the name of the task created in Jira eg. see the below image idorkey is DEV-2
  • Site: mention the name of the Jira Site which you configured under Configure System
  • After performing the above steps, click on Build Now to build the pipeline.
  • Console Output:
  • You can visit the Jira task created/mentioned to add a comment and the comment will be seen on Jira.

Important links:

We use cookies on this site to enhance your user experience. For a complete overview of how we use cookies, please see our privacy policy.