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
          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
          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
          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
          maydjin Denis Dudarev added a comment -

          Results of my humble review:

          • It seems to be usable, it covers user cases
          • Excludes syntax is quite huge, but I have no fast good idea for much compact one without imperative expressions from original matrix functionality, it could be very annoying to avoid all uninterested combinations with axis count >2, especially in cases where *most* of combinations are uninterested (e.g. at the start of a project)
          Show
          maydjin Denis Dudarev added a comment - Results of my humble review: It seems to be usable, it covers user cases Excludes syntax is quite huge, but I have no fast good idea for much compact one without imperative expressions from original matrix functionality, it could be very annoying to avoid all uninterested combinations with axis count >2, especially in cases where * most * of combinations are uninterested (e.g. at the start of a project)
          Hide
          maydjin Denis Dudarev added a comment -

          Got it, thanks!

          Show
          maydjin Denis Dudarev added a comment - Got it, thanks!

            People

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

              Dates

              Created:
              Updated: