boaz barkan
boaz barkan

Reputation: 147

Jenkins job for multiple Github repo

I want to create one Jenkins job that is connected/listening to multiple Github repository, with a web-hook to trigger the job by opening a pull request in one of the repos using the "pull request builder" plugins.

I saw an option in Jenkins to select Github Organization type job, but it requires a jenkinsfile in each repo which defeats the purpose.

someone suggested that i create a job for each repo and then to trigger a generic job with the repo name as parameters, but if i have 20 repositories i don't want to make 20 jobs.

Does anyone know of a way to do this?

Upvotes: 2

Views: 2043

Answers (1)

matus
matus

Reputation: 724

You can achieve your objective by creating a single Pipeline-type project in Jenkins and by parsing the payload of the GitHub webhook to obtain the parameters that you need to figure out which of your 20+ repos you need to build on each case.

I use the Generic Webhook Trigger plugin to achieve a similar goal. This plugins allows you to parse all the fields of the json included with the webhook. There you can find repo/branch/PR information needed to customize your job run, and feed this parameters to your checkout stage, for example.

Upvotes: 2

Related Questions