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

Allow dynamic stage names

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      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}") {
                  // ...
              }
          }
      }
      

        Attachments

          Activity

          Hide
          bitwiseman Liam Newman added a comment -

          Stage names must be resolved before the pipeline starts.

          Since matrix construction is also done before pipeline start, the exact scenario above could be supported.
          However, users would then quite reasonably assume that they could put other variables into those interpolations and would get problems.

          I do not know the reason stage names must be resolved before the pipeline starts, but figuring out how to change that more generally would require some digging.

          Show
          bitwiseman Liam Newman added a comment - Stage names must be resolved before the pipeline starts. Since matrix construction is also done before pipeline start, the exact scenario above could be supported. However, users would then quite reasonably assume that they could put other variables into those interpolations and would get problems. I do not know the reason stage names must be resolved before the pipeline starts, but figuring out how to change that more generally would require some digging.
          Hide
          smd Stefan Drissen added a comment -

          I'm revisiting replacing a big xml template based multi-job project with a declarative matrix pipeline. While the matrix implementation was really nice and quick to setup, the visualization was a bit of let down. Dynamic stage names would really really really help.

          Current state:

          With stage names based on matrix values:

           

          Show
          smd Stefan Drissen added a comment - I'm revisiting replacing a big xml template based multi-job project with a declarative matrix pipeline. While the matrix implementation was really nice and quick to setup, the visualization was a bit of let down. Dynamic stage names would really really really help. Current state: With stage names based on matrix values:  
          Hide
          tophergopher Topher Sterling added a comment -

          Big +1 on this. I was able to get a massive job chopped way down thanks to matrix magic, but now the display on Blue Ocean leaves a lot to be desired. Our pipeline view looks very similar to Stefan's ^^ - there's not a clear indicator when one test fails of which one it was.

          I think either:

          a) Display the axes value(s) next to the stage name

          b) Allow for the option to add a variable to a stage name - only invalid inside a matrix directive

          c) Add an option to rename a stage - only valid inside a matrix directive

          Show
          tophergopher Topher Sterling added a comment - Big +1 on this. I was able to get a massive job chopped way down thanks to matrix magic, but now the display on Blue Ocean leaves a lot to be desired. Our pipeline view looks very similar to Stefan's ^^ - there's not a clear indicator when one test fails of which one it was. I think either: a) Display the axes value(s) next to the stage name b) Allow for the option to add a variable to a stage name - only invalid inside a matrix directive c) Add an option to rename a stage - only valid inside a matrix directive
          Hide
          allout58 James Hollowell added a comment -

          I think option (a) above would cover enough use cases without making it confusing why dynamic stage names only work inside a matrix.

          Show
          allout58 James Hollowell added a comment - I think option (a) above would cover enough use cases without making it confusing why dynamic stage names only work inside a matrix.
          Hide
          krobarr9 James added a comment -

          Another big +1 to this. Implementing one of my regression runs as a matrix just shaved almost 10 hours off of a test regression run, but the results in Blue Ocean are a pain to navigate.

           

          I agree with Topher Sterling and James Hollowell above that option a) would solve all my problems.

          Show
          krobarr9 James added a comment - Another big +1 to this. Implementing one of my regression runs as a matrix just shaved almost 10 hours off of a test regression run, but the results in Blue Ocean are a pain to navigate.   I agree with Topher Sterling  and James Hollowell  above that option a) would solve all my problems.
          Hide
          bitwiseman Liam Newman added a comment -

          JamesJames HollowellTopher Sterling
          What you are mostly describing is a Blue Ocean display issue. If you hover over the labels with ellipses, you'll see the text is there. If you go to classic view you'll be able to see it.

          I would love to see this fixed as well, but Blue Ocean is in maintenance mode, so it is unlikely that the display issue you describe this will get fixed. Due to the Blue Ocean design it isn't as simple as it might seem. I tried manually turning off the "whitespace: nowrap" that those label have on them and it doesn't improve matters. If any of you want to devote time to this, I'd be happy to point you in the right direction.

          Show
          bitwiseman Liam Newman added a comment - James James Hollowell Topher Sterling What you are mostly describing is a Blue Ocean display issue. If you hover over the labels with ellipses, you'll see the text is there. If you go to classic view you'll be able to see it. I would love to see this fixed as well, but Blue Ocean is in maintenance mode, so it is unlikely that the display issue you describe this will get fixed. Due to the Blue Ocean design it isn't as simple as it might seem. I tried manually turning off the "whitespace: nowrap" that those label have on them and it doesn't improve matters. If any of you want to devote time to this, I'd be happy to point you in the right direction.
          Hide
          smd Stefan Drissen added a comment -

          Liam Newman

          Are you sure that is just a Blue Ocean display issue and not some underlying matrix issue?

          If I look at the classic display of a matrix pipeline it is rather unusable as well , each matrix combination is started (in 1s) with a matrix description, followed by the actual work in a block with the stage name:

          There is no easy way to see what these steps were. So while the Blue Ocean view may be limited, it beats the classic view hands down.

           

          Show
          smd Stefan Drissen added a comment - Liam Newman Are you sure that is just a Blue Ocean display issue and not some underlying matrix issue? If I look at the classic display of a matrix pipeline it is rather unusable as well , each matrix combination is started (in 1s) with a matrix description, followed by the actual work in a block with the stage name: There is no easy way to see what these steps were. So while the Blue Ocean view may be limited, it beats the classic view hands down.  
          Hide
          jncarlic John added a comment -

          Adding my vote for this feature.  It makes both the stage view and blue ocean views ugly and overly complicated for no reason.

          Show
          jncarlic John added a comment - Adding my vote for this feature.  It makes both the stage view and blue ocean views ugly and overly complicated for no reason.

            People

            Assignee:
            bitwiseman Liam Newman
            Reporter:
            rittneje Jesse Rittner
            Votes:
            15 Vote for this issue
            Watchers:
            17 Start watching this issue

              Dates

              Created:
              Updated: