EditIssue
jiraEditIssue
Updates an existing issue based on given input, which should have some minimal information on that object.
Input
- idOrKey - issue id or key.
- issue - issue to be updated.
- queryParams - Optional. Map of query parameters.
- site - Optional, default:
JIRA_SITE
environment variable. - failOnError - Optional. default:
true
.
Output
- Each step generates generic output, please refer to this link for more information.
- The api response of this jira_edit_issue step can be reused later in your script by doing
response.data.required_field_name
. - You can see some example scenarios here
- All the available fields for a jira response can be found in JIRA API documentation depending on your JIRA version.
Examples
-
With default site from global variables.
node { stage('JIRA') { # Look at IssueInput class for more information. def testIssue = [fields: [ // id or key must present for project. project: [id: '10000'], summary: 'New JIRA Created from Jenkins.', description: 'New JIRA Created from Jenkins.', customfield_1000: 'customValue', // id or name must present for issuetype. issuetype: [id: '3']]] def queryParams = [notifyUsers: false] response = jiraEditIssue idOrKey: 'TEST-01', queryParams: queryParams, issue: testIssue echo response.successful.toString() echo response.data.toString() } }
-
withEnv
to override the default site (or if there is not global site)node { stage('JIRA') { withEnv(['JIRA_SITE=LOCAL']) { # Look at IssueInput class for more information. def testIssue = [fields: [ project: [id: '10000'], summary: 'New JIRA Created from Jenkins.', description: 'New JIRA Created from Jenkins.', issuetype: [id: '3']]] response = jiraEditIssue idOrKey: 'TEST-01', issue: testIssue echo response.successful.toString() echo response.data.toString() } } }
-
Without environment variables.
# Look at IssueInput class for more information. def testIssue = [fields: [ project: [id: '10000'], summary: 'New JIRA Created from Jenkins.', description: 'New JIRA Created from Jenkins.', issuetype: [id: '3']]] response = jiraEditIssue idOrKey: 'TEST-01', issue: testIssue, site: 'LOCAL' echo response.successful.toString() echo response.data.toString()