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

Local Variables not available in declarative matrix pipeline

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      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'
                                  }
                              }
                          }
                      }
                  }
              }
          }
      }
      

        Attachments

          Activity

          Hide
          cyoung chris added a comment -

          I'm also reprodcing this error after an update.

          Show
          cyoung chris added a comment - I'm also reprodcing this error after an update.

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            jjathman Joe Athman
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: