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

StageStep should reject duplicate stage names

    Details

    • Similar Issues:

      Description

      If you run

      stage 'Dev'
      stage 'Dev'
      

      the second call should be treated as an error.

        Attachments

          Activity

          Hide
          jglick Jesse Glick added a comment -

          TBD if there need to be any uniqueness guarantees for blocky stage. I suspect it no longer matters, since the only reason this would have been a bug for the original stage is due to ambiguities with concurrency.

          Show
          jglick Jesse Glick added a comment - TBD if there need to be any uniqueness guarantees for blocky stage. I suspect it no longer matters, since the only reason this would have been a bug for the original stage is due to ambiguities with concurrency .
          Hide
          timothy_clarke Timothy Clarke added a comment -

          While stage "Dev" may be bad as a duplicate, stage "Restarting Services" would be entirely valid.
          I have long complex pipelines where people want to see detail in the stages (Yes for some there are too many stages). We often have the same steps repeat in each environment as a build progresses.

          Show
          timothy_clarke Timothy Clarke added a comment - While stage "Dev" may be bad as a duplicate, stage "Restarting Services" would be entirely valid. I have long complex pipelines where people want to see detail in the stages (Yes for some there are too many stages). We often have the same steps repeat in each environment as a build progresses.
          Hide
          jglick Jesse Glick added a comment -

          Right. I think at most a brief warning should be issued to the log in cases where a stage uses the same name as an earlier stage at the same nesting level. Thus in Timothy Clarke’s case, no warning would be issued for

          for (env in ['linux', 'win']) {
            stage(env) {
              node(env) {
                stage('Building') {
                  // …
                }
                stage('Testing') {
                  // …
                }
              }
            }
          }
          

          Here win » Building would not be considered a duplicate of linux » Building, since a sufficiently discriminating UI, such as the Pipeline Steps table, would show the structure. (Currently the Stage View plugin shows all stages undifferentiated at top level, and last I checked Blue Ocean is still working out a policy.)

          Show
          jglick Jesse Glick added a comment - Right. I think at most a brief warning should be issued to the log in cases where a stage uses the same name as an earlier stage at the same nesting level . Thus in Timothy Clarke ’s case, no warning would be issued for for (env in [ 'linux' , 'win' ]) { stage(env) { node(env) { stage( 'Building' ) { // … } stage( 'Testing' ) { // … } } } } Here win » Building would not be considered a duplicate of linux » Building , since a sufficiently discriminating UI, such as the Pipeline Steps table, would show the structure. (Currently the Stage View plugin shows all stages undifferentiated at top level, and last I checked Blue Ocean is still working out a policy.)
          Hide
          abayer Andrew Bayer added a comment -

          For what it's worth, this exact behavior is already in place in Declarative: it rejects duplicate stage names in the same context (i.e., top-level stages can't be dupes of each other and parallel stages within a single parent can't be dupes, but a nested parallel stage can have the same name as a top level stage or another nested parallel stage within a different parent stage).

          Show
          abayer Andrew Bayer added a comment - For what it's worth, this exact behavior is already in place in Declarative: it rejects duplicate stage names in the same context (i.e., top-level stages can't be dupes of each other and parallel stages within a single parent can't be dupes, but a nested parallel stage can have the same name as a top level stage or another nested parallel stage within a different parent stage).
          Hide
          jglick Jesse Glick added a comment -

          So I think this is now unnecessary.

          Show
          jglick Jesse Glick added a comment - So I think this is now unnecessary.

            People

            • Assignee:
              jglick Jesse Glick
              Reporter:
              jglick Jesse Glick
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: