-
Type:
Improvement
-
Resolution: Duplicate
-
Priority:
Minor
-
Component/s: pipeline-model-definition-plugin
-
Environment:Jenkins ver. 2.138.2
Pipeline: Model API 1.3.2
Hello,
Would be nice to add a when conditions to pipeline post actions. Here is an example:
pipeline {
agent any;
stages { ... }
// run only for master branch
post {
when { branch 'master' }
failure {
// send slack notification about failure build
}
}
// run without any additional conditions (it works now)
post {
success { ... }
cleanup { ... }
}
}
I don't have a good idea how to implement this without breaking-changes. In this example
there is an idea that we can add multiple pipeline post blocks (one for every when condition)
Motivation:
I would like to send notification about failed builds, but only for releases braches. We don't want to receive notifications about failed pull requests builds.
- duplicates
-
JENKINS-42688 Provide a way to enable a post/* to run only under some context
-
- In Progress
-