-
New Feature
-
Resolution: Fixed
-
Major
-
None
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).
- is duplicated by
-
JENKINS-40443 Possibility to know the current stage in a Pipeline
-
- Resolved
-
- is related to
-
JENKINS-48315 Add env variable LAST_STAGE_NAME which will persist when stage ends prematurely
-
- Open
-
- links to
[JENKINS-44456] Provide a way to access a stage name from within the stage and its contents
Component/s | New: pipeline-stage-step-plugin [ 21709 ] | |
Component/s | Original: pipeline-model-definition-plugin [ 21706 ] |
Status | Original: Open [ 1 ] | New: In Progress [ 3 ] |
Status | Original: In Progress [ 3 ] | New: In Review [ 10005 ] |
Remote Link | New: This issue links to "Stage Step plugin PR #10 (Web Link)" [ 16913 ] |
Resolution | New: Fixed [ 1 ] | |
Status | Original: In Review [ 10005 ] | New: Resolved [ 5 ] |
Link |
New:
This issue is duplicated by |
Link | New: This issue is related to JENKINS-48315 [ JENKINS-48315 ] |
Comment |
[ I have another issue... The environment variable does not seem to persist when the stage ends prematurely. here's an example: {code:java} node('windows') { try { stage('MY STAGE') { echo "before=" + env.STAGE_NAME error('something bad happened') echo "after=" + env.STAGE_NAME } } catch (def e) { echo "after failure="+env.STAGE_NAME throw e } }{code} console output: {code:java} Started by user admin [Pipeline] node Running on SLAVE01 in F:\jenkins-remote\workspace\stagename [Pipeline] { [Pipeline] stage [Pipeline] { (MY STAGE) [Pipeline] echo before=MY STAGE [Pipeline] error [Pipeline] } [Pipeline] // stage [Pipeline] echo after failure=null [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline ERROR: something bad happened Finished: FAILURE {code} I will open a new issue for it ] |