Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-66376

Can't download attachment using jiraDownloadAttachment

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical Critical
    • jira-steps-plugin
    • None
    • JIRA Pipeline Steps 1.6.0
      Jenkins 2.235.5

      Jenkins Worker Node:
      os.name Linux
      os.version 4.15.0-151-generic

      I recently installed the Jenkins JIRA Pipeline Steps 1.6.0 plugin.  I would like to use the plugin to download an attachment in a Jira task.

      I am using the following in my jenkinsfile:

      def attachment = jiraGetAttachmentInfo id: '3418787'
      echo attachment.data.toString()
      def attachment2 = jiraDownloadAttachment id: '3418787', file: 'DSWCPLAT-1537_ver1.zip', override: true
      echo attachment2.data.toString()
      def attachment3 = jiraDownloadAttachment id: '3454761', file: 'test.txt'
      echo attachment3.data.toString()
      sh 'ls -al'
      sh 'ls -al /'

      i am just not sure of the expectation here.  it looks like the call is working, as when i use an invalid id, it will throw a 401 exception and fail, but using the correct information for 2 different attachments, I get the following:

      [Pipeline] jiraGetAttachmentInfo
      JIRA: Site - DSWCJira - Querying attachment with Id: 3418787
      Successful. Code: 200
      [Pipeline] echo
      [self:https://jsw.ibm.com/rest/api/2/attachment/3418787, filename:DSWCPLAT-1537_ver1.zip, author:[self:https://jsw.ibm.com/rest/api/2/user?username=bstrayer@us.ibm.com, key:bstrayer@us.ibm.com, name:bstrayer@us.ibm.com, avatarUrls:[48x48:https://jsw.ibm.com/secure/useravatar?ownerId=bstrayer%40us.ibm.com&avatarId=30814, 24x24:https://jsw.ibm.com/secure/useravatar?size=small&ownerId=bstrayer%40us.ibm.com&avatarId=30814, 16x16:https://jsw.ibm.com/secure/useravatar?size=xsmall&ownerId=bstrayer%40us.ibm.com&avatarId=30814, 32x32:https://jsw.ibm.com/secure/useravatar?size=medium&ownerId=bstrayer%40us.ibm.com&avatarId=30814], displayName:Bill Strayer, active:true], created:2021-08-12T14:42:31.982-0500, size:84740, mimeType:application/zip, properties:[:], content:https://jsw.ibm.com/secure/attachment/3418787/DSWCPLAT-1537_ver1.zip]
      [Pipeline] jiraDownloadAttachment
      JIRA: Site - DSWCJira - Downloading attachment with Id: 3418787
      [Pipeline] echo
      null
      [Pipeline] jiraDownloadAttachment
      JIRA: Site - DSWCJira - Downloading attachment with Id: 3454761
      [Pipeline] echo
      null
      [Pipeline] sh
      + ls -al

      Why am I not seeing this on my worker node?

      Is there something that I need to do in addition to the jiraDownloadAttachment to write the file to the worker node?

            nrayapati Naresh Rayapati
            adrianj Adrian
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: