Local Variables not available in declarative matrix pipeline

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

XMLWordPrintable

      This is the same issue described in this comment. Seemed like it would be better to make a new issue though since the previous issue was in reference to a scripted pipeline.

       

      We have a matrix pipeline which is used from a shared library. Sometime between version 1.7.2 and 1.8.4 of this plugin it broke our ability to reference local variables from our matrix pipeline. Here's a shortened version of our pipeline that no longer works.

      def call(Map<String, Object> pipelineParams) {
          def cronString = pipelineParams.getOrDefault('cronString', "")
          def testTimeoutInMinutes = pipelineParams.getOrDefault('testTimeoutInMinutes', 30)
          // add 2 hours to testTimeoutInMinutes to provide a buffer for getting an executor
          def expandedBuildAndTestTimeoutMinutes = testTimeoutInMinutes + 120
          debugEcho("expandedBuildAndTestTimeoutMinutes=$expandedBuildAndTestTimeoutMinutes")
      
          def office365Options = getTeamsOptions(pipelineParams)
          def jenkinsAgentLabel = pipelineParams.getOrDefault('jenkinsAgentLabel', 'linux_docker')
          def dockerImageName = 'customimagename'
          def dockerMaxMemory = pipelineParams.getOrDefault('dockerMaxMemory', "2g")
          def dockerRunArgs = pipelineParams.getOrDefault('dockerRunArgs', "-m $dockerMaxMemory".toString())
      
          pipeline {
              agent none
              options {
                  office365ConnectorWebhooks([office365Options])
                  timestamps()
                  ansiColor('xterm')
              }
              triggers {
                  cron(cronString)
              }
              stages {
                  stage('Windows Tests') {
                      matrix {
                          axes {
                              axis {
                                  name 'PLATFORM'
                                  values 'WINDOWS_10'
                              }
                              axis {
                                  name 'BROWSER'
                                  values 'CHROME', 'FIREFOX', 'EDGE'
                              }
                          }
                          stages {
                              stage('Execute Tests') {
                                  agent {
                                      docker {
                                          label jenkinsAgentLabel
                                          image dockerImageName
                                          args dockerRunArgs
                                      }
                                  }
                                  options { timeout(time: expandedBuildAndTestTimeoutMinutes, unit: 'MINUTES') }
                                  steps {
                                      echo 'here'
                                  }
                              }
                          }
                      }
                  }
              }
          }
      }
      

            Assignee:
            Unassigned
            Reporter:
            Joe Athman
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: