UploadAttachment
jiraUploadAttachment
This step uploads a file from worksapce to issue.
Input
- idOrKey - Issue Id or Key.
- file - File name with/without path from workspace. Ex:
test.txtortest/test.txt. - site - Optional, default:
JIRA_SITEenvironment variable. - failOnError - Optional. default:
true.
Output
- Each step generates generic output, please refer to this link for more information.
- The api response of this 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') { def attachment = jiraUploadAttachment idOrKey: 'TEST-1', file: 'test.txt' echo attachment.data.toString() } } -
withEnvto override the default site (or if there is not global site)node { stage('JIRA') { withEnv(['JIRA_SITE=LOCAL']) { def attachment = jiraUploadAttachment idOrKey: 'TEST-1', file: 'test/test.txt' echo attachment.data.toString() } } } -
Without environment variables.
def attachment = jiraUploadAttachment idOrKey: 'TEST-1', file: 'test.txt', site: 'LOCAL' echo attachment.data.toString()