patternMinor
Declarative Jenkins Pipeline to Poll different branches?
Viewed 0 times
declarativebranchesjenkinspolldifferentpipeline
Problem
We have a gitlab enterpise that host multiple project in one repo. Something like:
We have three pipelines that will run base on changes(whitelist region) when polling. They will start polling when received a
However, the pipeline can only work on
I have also try to use parameters $branch on
but, it still will only poll the last run branch.
Does anyone know how we can have the declarative pipeline to poll multiple branches and run only base on whitelist directory changes?
Repo/
projectA/
projectB/
projectC/We have three pipelines that will run base on changes(whitelist region) when polling. They will start polling when received a
curl via the notifyCommit? in another job.However, the pipeline can only work on
branch that is run previously. I have also try to use parameters $branch on
branch to build and update the curl job with parameters like:http://ourjenkins/git/notifyCommit?url=git_url.git&branch=$GIT_BRANCHbut, it still will only poll the last run branch.
Does anyone know how we can have the declarative pipeline to poll multiple branches and run only base on whitelist directory changes?
Solution
One could use the PollSCM plugin.
https://jenkins.io/doc/book/pipeline/syntax/
The pollSCM trigger is only available in Jenkins 2.22 or later.
https://jenkins.io/doc/book/pipeline/syntax/
triggers { pollSCM('H 4/* 0 0 1-5') }The pollSCM trigger is only available in Jenkins 2.22 or later.
Code Snippets
triggers { pollSCM('H 4/* 0 0 1-5') }Context
StackExchange DevOps Q#1832, answer score: 1
Revisions (0)
No revisions yet.