Configuration options
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

- Goto Manage Jenkins > Configure System > JIRA Steps > Add Site > Choose Basic.
- OAuth Authentication
- Follow the jira-rest-api-oauth-authentication guide to setup OAuth Authentication.
- Add site to Jenkins.
- Goto Manage Jenkins > Configure System > JIRA Steps > Add Site > Choose OAuth.
- Name = Jira Site Name
- URL = Jira Site URL
- Consumer Key = consumer_key from
config.properties. - Private Key = private_key from
config.properties. - Secret = secret from
config.properties. - Token = access_token from
config.properties.

Optional Params for all Steps.
site- Optional param which will overrideJIRA_SITEglobal variable.-
failOnError- is optional and by default it istrue.NOTE: When set to true, then the step will abort the job as a failure when there is an error sending message. To make it false, it should always be provided as global environment variable
JIRA_FAIL_ON_ERROR.
Environment Variables.
JIRA_SITE- Global variable to set default site for all JIRA steps.JIRA_FAIL_ON_ERROR- By default all stepsfailthe job when there is an error, by setting this tofalseall steps won’t fail the job.
Common Response & Error Handling.
Every step returns a common response, which will have more information about the request like successful, error, data and code. Always try catch if we want to handle abort exception or can set failOrError to false to ignore all the error.
successful- Returnstrueorfalse. Status of the step.code- HTTP code, response code returned from JIRA. or-1if there is any internal server error.data- Corresponding object being returned from JIRA when request was successful. For instancejiraGetProjectreturnsProjectandjiraGetVersionreturnsFixVersion.-
error- Error message when the actual request to JIRA failed.Usually, if the error is
- From JIRA,
codewill be400. - Caused by the plugin it will be
-1.
- From JIRA,
Example:
def response = jiraGetComponent id: 10000
echo response.successful
echo response.code
echo response.error
echo response.data.toString()
try {
jiraGetComponent id: 10000
} catch (error) {
echo error
}