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

Allow dynamic stage names

XMLWordPrintable

      I would like the ability to have stage names be dynamic strings. This is useful, for instance, when defining stages within a matrix, so that the stage names can contain the values of the axes. (Part of the problem here is that Blue Ocean doesn't render matrixes well at all.) Right now attempting to do this yields an error because stage names can only be string literals, not Groovy strings (interpolation).

      Note that I am not looking for the steps within the stage to be dynamic.

      Example:

      matrix {
          axes {
              axis {
                  name 'PLATFORM'
                  values 'linux', 'mac', 'windows'
              }
          }
          stages {
              stage("Build ${PLATFORM}") {
                  // ...
              }
              stage("Test ${PLATFORM}") {
                  // ...
              }
              stage("Deploy ${PLATFORM}") {
                  // ...
              }
          }
      }
      

        1. image-2020-03-19-17-20-23-015.png
          65 kB
          Stefan Drissen
        2. image-2020-03-19-17-22-05-861.png
          65 kB
          Stefan Drissen
        3. image-2021-01-27-08-24-59-432.png
          38 kB
          Stefan Drissen
        4. jenkins-pipeline-changed.png
          13 kB
          sascha inu
        5. jenkins-pipeline-original.PNG
          11 kB
          sascha inu
        6. workaround1.png
          82 kB
          Guillaume DeMengin

            bitwiseman Liam Newman
            rittneje Jesse Rittner
            Votes:
            58 Vote for this issue
            Watchers:
            58 Start watching this issue

              Created:
              Updated: