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

Matrix structure for Declarative Pipeline

    XMLWordPrintable

    Details

    • Similar Issues:
    • Epic Link:
    • Sprint:
      Declarative backlog

      Attachments

        Issue Links

          Activity

          Hide
          simon_lg Simon Larouche-Gagne added a comment -

          +1 on the exclude syntax, it's taking a lot of space.
          Also, can the values field of the axis block be dynamic instead of using a filter parameter?
          I have a use case with axes with a lot of values depending on a parameter, so if I can't act on the matrix values, my only option is to handle it in a when block?
          Also, in most cases, I would rather use a global variable to store my axes values as well, makes it easier to maintain and I could re-use it in another matrix block further down in the script.
          But overall I'm very happy to see a matrix block in declarative pipeline.

          Show
          simon_lg Simon Larouche-Gagne added a comment - +1 on the exclude syntax, it's taking a lot of space. Also, can the values field of the axis block be dynamic instead of using a filter parameter? I have a use case with axes with a lot of values depending on a parameter, so if I can't act on the matrix values, my only option is to handle it in a when block? Also, in most cases, I would rather use a global variable to store my axes values as well, makes it easier to maintain and I could re-use it in another matrix block further down in the script. But overall I'm very happy to see a matrix block in declarative pipeline.
          Hide
          wohali Joan Touzet added a comment -

          One enhancement that might be nice, if possible, is to have the values for an axis name be supported as non-literals. I don't seem to be able to make this work in the current version. Sorry if this isn't the right place, but you were asking for examples above...

           

          Example:

          pipeline {
            environment {
               LOW_ERLANG_VER = '19.3.6.8'
               MID_ERLANG_VER = '20.3.8.24'
               HIGH_ERLANG_VER = '22.2'
          {{  }}}

            stages {
              // ...
              // Other stages that need the values above
              // ...
              stage("Build") {
                matrix {
                  axes {
                    axis {
                      name 'ERLANG_VERSION'
                      values "{$env.LOW_ERLANG_VER}", "${env.MID_ERLANG_VER}", "${env.HIGH_ERLANG_VER}"
          {{          }}}
                  } // axes
                  // ...
                  // do the build with ${ERLANG_VERSION}
                  // ...
                } // matrix
              } // stage
            } // stages
          } // pipeline

          if that makes sense.
          Show
          wohali Joan Touzet added a comment - One enhancement that might be nice, if possible, is to have the values for an axis name be supported as non-literals. I don't seem to be able to make this work in the current version. Sorry if this isn't the right place, but you were asking for examples above...   Example: pipeline {   environment {      LOW_ERLANG_VER = '19.3.6.8'      MID_ERLANG_VER = '20.3.8.24'      HIGH_ERLANG_VER = '22.2' {{  }}}   stages {     // ...     // Other stages that need the values above     // ...     stage("Build") {       matrix {         axes {           axis {             name 'ERLANG_VERSION'             values "{$env.LOW_ERLANG_VER}", "${env.MID_ERLANG_VER}", "${env.HIGH_ERLANG_VER}" {{          }}}         } // axes         // ...         // do the build with ${ERLANG_VERSION }         // ...       } // matrix     } // stage   } // stages } // pipeline if that makes sense.
          Hide
          bitwiseman Liam Newman added a comment -

          Joan Touzet
          This totally makes sense. An issue has been opened for it. https://issues.jenkins-ci.org/browse/JENKINS-61047

          Show
          bitwiseman Liam Newman added a comment - Joan Touzet This totally makes sense. An issue has been opened for it. https://issues.jenkins-ci.org/browse/JENKINS-61047
          Hide
          kon Kalle Niemitalo added a comment -

          Matrix stages in declarative pipelines have already been implemented and documented: https://www.jenkins.io/doc/book/pipeline/syntax/#declarative-matrix

          Can this issue be closed now, or is something still missing?

          Show
          kon Kalle Niemitalo added a comment - Matrix stages in declarative pipelines have already been implemented and documented: https://www.jenkins.io/doc/book/pipeline/syntax/#declarative-matrix Can this issue be closed now, or is something still missing?
          Hide
          kon Kalle Niemitalo added a comment -

          It seems the last matrix-specific change without a separate Jira issue was in pipeline-model-definition-1.6.0:

          • Add support for matrix to the directive generator (#380)

          So, I'd consider this issue resolved in that version. Please reopen if you disagree.

          Show
          kon Kalle Niemitalo added a comment - It seems the last matrix-specific change without a separate Jira issue was in pipeline-model-definition-1.6.0 : Add support for matrix to the directive generator ( #380 ) So, I'd consider this issue resolved in that version. Please reopen if you disagree.

            People

            Assignee:
            bitwiseman Liam Newman
            Reporter:
            arthurlutz Arthur Lutz
            Votes:
            32 Vote for this issue
            Watchers:
            43 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: