Common Config
Optional Params for all Steps.
site- Optional param which will overrideJIRA_SITEglobal variable.failOnError- is optional and by default it istrue.
Global 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
}