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

Allow stage to operate as a labelled block

    Details

    • Similar Issues:

      Description

      Useful to give a label to one or more steps that are otherwise opaque in the log.

      stage('Deploying') {
          sh './deploy.sh --some-long-arguments'
      }
      

      FlowGraphTable should hide the body of the label step by default.

      Alternatives considered:

      sh script: './deploy.sh', label: 'Deploying'
      

      which does not scale well as a design (labeling should be orthogonal to step definitions); or implicit label creation when Groovy label expressions are encountered:

      LABEL: sh '/bin/perl abc def'
      

      which may break down:

      FOO:
      def x = 1;
      for (...) {
          ...
      }
      

        Attachments

          Issue Links

            Activity

            Hide
            marcellodesales Marcello de Sales added a comment -

            Baptiste Mathus I actually used other CI solutions where it naming an "sh" operation was very useful. 

            Show
            marcellodesales Marcello de Sales added a comment - Baptiste Mathus I actually used other CI solutions where it naming an "sh" operation was very useful. 
            Hide
            greg_k Greg Knapp added a comment -

            What about being able to label a script block, so you can group several commands and display it as a single operation?

            Show
            greg_k Greg Knapp added a comment - What about being able to label a script block, so you can group several commands and display it as a single operation?
            Hide
            batmat Baptiste Mathus added a comment -

            Yes, possibly. But you generally wouldn't "label a command", probably more a couple of them to produce not just a serie of staged named after the called commands, but that stage is actually doing ("checking code coverage" or whatever).

            Show
            batmat Baptiste Mathus added a comment - Yes, possibly. But you generally wouldn't "label a command", probably more a couple of them to produce not just a serie of staged named after the called commands, but that stage is actually doing ("checking code coverage" or whatever).
            Hide
            greg_k Greg Knapp added a comment -

            So we should use a `stage` block for each command we want to label? Seems like that would lead to a verbose Jenkinsfile

            Show
            greg_k Greg Knapp added a comment - So we should use a `stage` block for each command we want to label? Seems like that would lead to a verbose Jenkinsfile
            Hide
            svanoort Sam Van Oort added a comment -

            Alex S. 

            stage('named') {
              sh 'my special shell step'
            }
            Show
            svanoort Sam Van Oort added a comment - Alex S.   stage( 'named' ) { sh 'my special shell step' }

              People

              • Assignee:
                jglick Jesse Glick
                Reporter:
                jglick Jesse Glick
              • Votes:
                44 Vote for this issue
                Watchers:
                80 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: