Reputation: 1629
We use CloudBees-2.138.2.2 Jenkins and have had lot of challenges to trigger jenkins jobs only based on commits in our Github repo. I am still looking for the exact working script for scripted pipeline and not declarative one.
so For example :- pipelineTriggers([cron('0-59/2 * * * *')]), works but pipelineTriggers([pollSCM('0-59/2 * * * *')]), never works despite new commits
Upvotes: 1
Views: 1465
Reputation: 4144
You can try adding the following in your scripted pipeline
properties([pipelineTriggers([githubPush()])])
Upvotes: 1
Reputation: 1629
was able to make it work using :-
pipelineTriggers([pollSCM('* * * * *')]) under properties
This way the job polls the repo every minute and will trigger build only when it detects a new commit.
Upvotes: 1