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

preserveStashes does not work with parameter

XMLWordPrintable

    • Declarative backlog

      I tried the pipeline script below, I get 
           WorkflowScript: 4: "preserveStashes" should have 0 arguments but has 1 arguments instead. @ line 4, column 9.
       

      w/o parameter restart with unstash works (by the way, multiple unstashes in one pipe is working too, as expected!)

       
      http://kie-jenkinslts.ppe.kie.de.heidelberg.com:8080/blue/organizations/jenkins/StashUnstash/detail/StashUnstash/9/pipeline#log-12 preserveStashes(5)
      pipeline

      {     agent \{label 'master'}

          options

      {         preserveStashes(5)     }

          stages{
              stage('create stash'){
                  steps

      {                  //create file                  writeFile file: './myFile.txt', text: 'fun stuff'                  stash includes: '*.txt', name: 'funstufftxt'               }

               }
               stage('unstash first'){
               steps{
                   dir('first') {
                       unstash 'funstufftxt'
                       script

      {                        def funtxt = readFile 'myFile.txt'                        println funtxt                  }

                   }
               }
         }
         stage('unstash second'){

               steps{
                   dir('second') {
                        unstash 'funstufftxt'
                        script

      {                       def funtxt = readFile 'myFile.txt'                       println funtxt                   }

                   }
               }
           }
         }
      }

       

            abayer Andrew Bayer
            hoppej Jan Hoppe
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: