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

Provide a way to access a stage name from within the stage and its contents

      Please provide a way to access the stage name from within the stage and its contents (like post).

      Background

      I have a multibranch declarative script. I am struggling with the limitation of one JenkinsFile per branch. I want to run various tasks (i.e. stages) on the branch (e.g. build several separate apps) and have a clear indication of which stage failed in the email notification subject sent on failure. I assume that stage processing will stop as soon as one stage fails. The post clause can then call the email-ext plugin and specify in Subject the stage that failed. Developers will then see quickly which task failed, rather than having to look through the console log (or email body).

          [JENKINS-44456] Provide a way to access a stage name from within the stage and its contents

          David Aldrich created issue -

          Andrew Bayer added a comment -

          Actually moving this to pipeline-stage-step-plugin for a more general solution. It'll still need a followup in Declarative for JENKINS-41334 and the special casing of emulating stages via parallel branches, but that's trivial.

          Andrew Bayer added a comment - Actually moving this to pipeline-stage-step-plugin for a more general solution. It'll still need a followup in Declarative for JENKINS-41334 and the special casing of emulating stages via parallel branches, but that's trivial.
          Andrew Bayer made changes -
          Component/s New: pipeline-stage-step-plugin [ 21709 ]
          Component/s Original: pipeline-model-definition-plugin [ 21706 ]
          Andrew Bayer made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Andrew Bayer made changes -
          Status Original: In Progress [ 3 ] New: In Review [ 10005 ]

          Andrew Bayer added a comment -

          Initial PR in pipeline-stage-step up at https://github.com/jenkinsci/pipeline-stage-step-plugin/pull/10 - a little followup in Declarative still to come.

          Andrew Bayer added a comment - Initial PR in pipeline-stage-step up at https://github.com/jenkinsci/pipeline-stage-step-plugin/pull/10 - a little followup in Declarative still to come.
          Andrew Bayer made changes -
          Remote Link New: This issue links to "Stage Step plugin PR #10 (Web Link)" [ 16913 ]

          Andrew Bayer added a comment -

          Added explicit setting of STAGE_NAME for parallel "stages" in Declarative over in https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/152.

          Andrew Bayer added a comment - Added explicit setting of STAGE_NAME for parallel "stages" in Declarative over in https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/152 .

          Code changed in jenkins
          User: Andrew Bayer
          Path:
          pom.xml
          src/main/java/org/jenkinsci/plugins/workflow/support/steps/StageStepExecution.java
          src/test/java/org/jenkinsci/plugins/workflow/support/steps/StageStepTest.java
          http://jenkins-ci.org/commit/pipeline-stage-step-plugin/2e7f175432c014945de3bc6a8941733cb370541c
          Log:
          [FIXED JENKINS-44456] Add STAGE_NAME to environment

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: pom.xml src/main/java/org/jenkinsci/plugins/workflow/support/steps/StageStepExecution.java src/test/java/org/jenkinsci/plugins/workflow/support/steps/StageStepTest.java http://jenkins-ci.org/commit/pipeline-stage-step-plugin/2e7f175432c014945de3bc6a8941733cb370541c Log: [FIXED JENKINS-44456] Add STAGE_NAME to environment
          Andrew Bayer made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: In Review [ 10005 ] New: Resolved [ 5 ]

            abayer Andrew Bayer
            davida2009 David Aldrich
            Votes:
            0 Vote for this issue
            Watchers:
            14 Start watching this issue

              Created:
              Updated:
              Resolved: