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

Pipeline: Matrix and Lockable don't play well together

XMLWordPrintable

      I have a declarative-pipeline and am using a matrix to perform system tests.  One of the axis of the matrix is name=PLATFORM (values=Windows, Linux).   I'd like to create a step with a lock on it based on the value of platform, hence, something like this:

      matrix {
          axes { 
              axis { 
                  name = 'PLATFORM'
                  values = Windows', 'Linux'
              }
          }
          options {
              lock( label: "LOCK_${PLATFORM}", quantity: 1 )
          }
          stages {
             ...
             // the above lock could also be applied to a stage within this stages block
          }
      }
      
      

      If I read the documentation, I think this is supposed to work as the axis values are supposed to be able to be referenced from 'options' setup.  However, when I run this, I get one of two errors:

      • Referenced as "LOCK_${env.PLATFORM}" yields lock does not exist "LOCK_null"
      • Referenced as "LOCK_${PLATFORM}" yields no such property "PLATFORM"

      I have tried it at various levels - 1) as above, on the stages block, and 2) on a stage within the stages.  They both fail in similar ways.

      The intent here is that we would grab (or wait for) the LOCK_Windows or the LOCK_Linux as appropriate.

      It seems like the axis value is not passed through to the options-block, or to the lock-command within the option.  

            Unassigned Unassigned
            jbennett20912 Jeffrey Bennett
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: