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

Download from Artifactory doesn't work if called from function

XMLWordPrintable

      File download from Artifactory doesn't work if called from function.

       def server = Artifactory.server 'MyServerName'
      
       def downloadFile(fileName)
       {
         echo "FileName: ${fileName}" // prints "FileName: SomeFile.exe"
         def downloadSpec = """{
                                 "files": [
                                            {
                                              "pattern": "progs-gen-releases/SomeDirectory/${fileName}",
                                              "target": "./SomeDirectory/",
                                              "flat": "true"
                                            }
                                          ]
                               }"""
         server.download(downloadSpec) // <- unknown error in this line
       }
       
       node("NodeName")
       {
         ansiColor('xterm')
         {
           stage('Some stage')
           {
             /* ========= this script works fine =============================
             def downloadSpec = """{
                                     "files": [
                                               {
                                                 "pattern": "progs-gen-releases/SomeDirectory/SomeFile.exe",
                                                 "target": "./SomeDirectory/",
                                                 "flat": "true"
                                               }
                                              ]
                                   }"""
             server.download(downloadSpec) //it works
             ================================================================*/
             
             downloadFile("SomeFile.exe") //it doesn't work
           }
         }
       }
      

            eyalbe Eyal Ben Moshe
            marogo Marek Czyzewski
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: