Issue
I'm trying to build a pipeline script which basically works. Now I tried to move the pollSCM trigger from the configuration, where it is unchecked now, into the pipeline script. See screenshot:
src="https://i.stack.imgur.com/o4gKY.png" alt="pipeline script" />
It works with the checkbox, so new code triggers the build, but I want to get it working via pipeline script. Unfortunately, nothing is being triggered, although I checked in some new code.
The syntax seems to be correct, see https://www.jenkins.io/doc/book/pipeline/syntax/#triggers
Any idea why the job is not triggered from the pipeline script?
Solution
You need to trigger the Pipeline once manually for those configurations to be picked up. Once you execute the Pipeline after adding the triggers you should see the check mark automatically getting added.
Answered By - ycr
Answer Checked By - Dawn Plyler (JavaFixing Volunteer)