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

Allow stage to operate as a labelled block

    XMLWordPrintable

Details

    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

            svanoort Sam Van Oort added a comment -

            mac110 

            stage('named') {
              sh 'my special shell step'
            }
            svanoort Sam Van Oort added a comment - mac110   stage( 'named' ) { sh 'my special shell step' }
            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

            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

            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).

            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).
            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?

            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?

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

            marcellodesales Marcello de Sales added a comment - batmat I actually used other CI solutions where it naming an "sh" operation was very useful. 

            People

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

              Dates

                Created:
                Updated:
                Resolved: