Return value unpacking in pipelinescript causes function to execute twice.

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      Consider the following pipeline script.

      jenkinsfile
      def str1 = ''
      def str2 = ''
      (str1, str2) = addStage()
      
      def addStage()
      {
          stage('Stage 1')
          {
              node('master')
              {
                  sh 'echo run stage'
              }
          }
          
          return ['foo', 'bar']
      }
      

      When running the pipeline it will execute the shell command twice. This came unexpected to me and I think it is a bug. When the parameter unpacking is removed from the third line, the script behaves as expected.

            Assignee:
            Andrew Bayer
            Reporter:
            Uli Hierl
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: