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

Pipeline: Matrix and Lockable don't play well together

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      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.  

        Attachments

          Activity

          jbennett20912 Jeffrey Bennett created issue -
          jbennett20912 Jeffrey Bennett made changes -
          Field Original Value New Value
          Description 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:
          {code:java}
          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
              }
          }

          {code}
          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 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:
          {code:java}
          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
              }
          }

          {code}
          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.  
          tgr Tobias Gruetzmacher made changes -
          Assignee Tobias Gruetzmacher [ tgr ]

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            jbennett20912 Jeffrey Bennett
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: