I have a pipeline with multiple stages. One of them should not be executed when code is pushed from SCM. It should only execute when we have a Time Trigger or when anyone build the job manually.
This work for Time Trigger but doesn't build my stage if build manually when { triggeredBy 'TimerTrigger' }
This build no matter what. Even on SCM push: when { not {triggeredBy 'SCMTrigger' }}
CodePudding user response:
This will be used for when the build started by user or time triggered.
when {
anyOf {
triggeredBy 'TimerTrigger'
triggeredBy cause: 'UserIdCause'
}
}