Open joxoby opened 3 years ago
One of the issues that I encountered is that there's no way to select (or deselect) which stages you want to notify about. Consider the following case:
pipeline { agent any stages { stage('Stage 1') { ... } stage('Stage 2') { when { branch 'master' } ... } } }
If a user opens a PR (not master branch), Stage 2 will not run, and thus they will get a constant PENDING notification for that stage.
master
Stage 2
PENDING
I am considering adding functionality to prevent similar cases and would be nice to get some ideas on how to attack the problem.
What I thought about is adding some filtering in the function getDeclarativeStages.
getDeclarativeStages
protected static List<BuildStage> getDeclarativeStages(Run<?, ?> run) { ExecutionModelAction executionModelAction = run.getAction(ExecutionModelAction.class); if (null == executionModelAction) { return null; } ModelASTStages stages = executionModelAction.getStages(); if (null == stages) { return null; } List<ModelASTStage> stageList = stages.getStages(); if (null == stageList) { return null; } // do filtering ... return convertList(filteredStageList); }
The problem is that I'm not sure how would we could add a property (notify: (true/false)) to each stage of the pipeline and retrieve it here.
notify: (true/false)
Maybe it would be better to have the correct status reported (skipped in this case) and have a configuration option to "not report skipped jobs".
One of the issues that I encountered is that there's no way to select (or deselect) which stages you want to notify about. Consider the following case:
If a user opens a PR (not
master
branch),Stage 2
will not run, and thus they will get a constantPENDING
notification for that stage.I am considering adding functionality to prevent similar cases and would be nice to get some ideas on how to attack the problem.
What I thought about is adding some filtering in the function
getDeclarativeStages
.The problem is that I'm not sure how would we could add a property (
notify: (true/false)
) to each stage of the pipeline and retrieve it here.