Setup

Authentication

Authentication This plugin supports both Basic and OAuth, OAuth is preferred over the Basic authentication. Basic Authentication Goto Manage Jenkins > Configure System > JIRA Steps > Add Site > Choose Basic. Name = Jira Site Name URL = Jira Site URL User Name = Jira Account Username Password = Jira Account Password role="alert"> Please take note that above screenshot missing ReadTimeout(ms) OAuth Authentication Follow the jira-rest-api-oauth-authentication guide to setup OAuth Authentication. »

Create New Fix Version

Add new fix version to existing issue. JQL Search. Create new version. Edit an issue. node { stage('JIRA') { def searchResults = jiraJqlSearch jql: "project = TEST AND issuekey = 'TEST-1'" def issues = searchResults.data.issues for (i = 0; i <issues.size(); i++) { def fixVersion = jiraNewVersion version: [name: "new-fix-version-1.0", project: "TEST"] def testIssue = [fields: [fixVersions: [fixVersion.data]]] response = jiraEditIssue idOrKey: issues[i].key, issue: testIssue } } } »

Install

Jenkins provides a couple of different methods for installing plugins Installing from UI. Installing Plugin From Web UI Updating Plugin Manual installation - For snapshots Clone the repository. Run mvn package to build a deployable hpi bundle for Jenkins. jira-steps.hpi file can be found in jira-steps-plugin/target folder. For more information Advanced installation »

Append Fix Version

Append new fix version to existing issue. JQL Search. Create new version. Edit an issue. node { stage('JIRA') { def searchResults = jiraJqlSearch jql: "project = TEST AND issuekey = 'TEST-1'" def issues = searchResults.data.issues for (i = 0; i <issues.size(); i++) { def result = jiraGetIssue idOrKey: issues[i].key def newVersion = jiraNewVersion version: [name: "new-fix-version-1.1", project: "TEST"] def fixVersions = result.data.fields.fixVersions << newVersion.data def testIssue = [fields: [fixVersions: fixVersions]] response = jiraEditIssue idOrKey: issues[i]. »

Common Config

Optional Params for all Steps. site - Optional param which will override JIRA_SITE global variable. failOnError - is optional and by default it is true. Global Environment Variables. JIRA_SITE - Global variable to set default site for all JIRA steps. JIRA_FAIL_ON_ERROR - By default all steps fail the job when there is an error, by setting this to false all steps won’t fail the job. Common Response & Error Handling. »

Jenkins Script

Automate configuring via Jenkins Script Console The following Jenkins Script Console script will automatically configure the global settings of this plugin. import net.sf.json.JSONArray import net.sf.json.JSONObject import org.thoughtslive.jenkins.plugins.jira.JiraStepsConfig import org.thoughtslive.jenkins.plugins.jira.Site //global user-defined configuration JSONArray sitesConf = [ [ name: 'another', url: 'http://example.com', timeout: 10000, readTimeout: 10000, loginType: 'BASIC', userName: 'foo', password: 'some pass' ], [ name: 'moar jira', url: 'http://example.com', timeout: 10000, readTimeout: 10000, loginType: 'OAUTH', consumerKey: 'my consumer key', privateKey: 'my private key', secret: 'super secret', token: 'my token' ] ] as JSONArray //get global Jenkins configuration JiraStepsConfig. »

Releasing a Project?

Releasing a project? For instance, if you are releasing more than one project and you want to create a release review jira issue, add Description, Fix version, comment on the issue with error message for a failure in the release process or close the issue, if release is successful. JIRA transitions for any given ticket can be found via this endpoint: /rest/api/2/issue/${issueIdOrKey}/transitions. Create new Release review JIRA. Release your project. »

Configuration as Code Plugin

Automate configuring via Configuration as Code Plugin The following snippet will automatically configure the global settings of this plugin. unclassified: jiraStepsConfig: sites: - name: 'another' url: 'http://example.com' timeout: 10000 readTimeout: 10000 loginType: 'BASIC' userName: 'foo' password: 'some pass' - name: 'moar jira' url: 'http://example.com' timeout: 10000 readTimeout: 10000 loginType: 'OAUTH' consumerKey: 'my consumer key' privateKey: 'my private key' secret: 'super secret' token: 'my token' »