4

We have a gitlab enterpise that host multiple project in one repo. Something like:

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_BRANCH

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?

2
  • 4
    Have you tried using a multibranch pipeline job? See jenkins.io/doc/book/pipeline/multibranch
    – mghicks
    Commented Nov 21, 2017 at 18:13
  • Yes, I definitely recommend the multibranch pipeline plugin. You can also filter by branch name if there is a common naming convention.
    – Preston Martin
    Commented Nov 16, 2018 at 15:18

1 Answer 1

1

One could use the PollSCM plugin.

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.