-
Improvement
-
Resolution: Duplicate
-
Minor
-
None
Not fully designed in my mind but a very handy when condition would be to run based on the build cause.
For example to run lengthy performance tests only when triggered by a timer or auto deploy to staging when run by a specific user/role.
Example:
stage {
when {
triggeredBy timer
}
}
stage {
when {
triggeredBy user
}
}
stage {
when {
triggeredBy user('bobby')
}
}
Some more trigger specific parameters might be needed so probably an extension point is needed for this that plugin authors can implement:
stage {
when {
triggeredBy gerrit(event: patchSetCreated, project: 'platform/my-module')
}
}
But a lower level plain "class comparer" might solve most general cases until a more specific extension point is implemented by a plugin author
stage { when { triggeredBy cause($class: 'DockerRegistryWebHookCause', 'pushNotification.repoName': 'acme/my-app') } }
Though getting the syntax right will be tricky, so snippetizer support would be good for that.
- duplicates
-
JENKINS-46894 Provide means of detecting cause of build from declarative pipeline
- Closed