Common Config
Optional Params for all Steps.
site
- Optional param which will overrideJIRA_SITE
global 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 stepsfail
the job when there is an error, by setting this tofalse
all 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
- Returnstrue
orfalse
. Status of the step. -
code
- HTTP code, response code returned from JIRA. or-1
if there is any internal server error. -
data
- Corresponding object being returned from JIRA when request was successful. For instancejiraGetProject
returnsProject
andjiraGetVersion
returnsFixVersion
. -
error
- Error message when the actual request to JIRA failed.Usually, if the error is
- From JIRA,
code
will 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
}