0
votes

I'm trying to setup a multi-branch pipeline project in Jenkins. Ideally, I would like the branch pipelines to be build once the developers push new code. For example, if a developer pushes to a 'dev' branch then the 'dev' pipeline will build automatically.

I know that under the "Scan Multibranch Pipeline Triggers" option you can set how often Jenkins will look for changes, but I would prefer it to be the other way around, meaning that once new code is in the branch then Jenkins will build the pipeline.

enter image description here

I have my Jenkinsfile configured and also set the web-hook in my GitHub project, but I don't know if what I want to do can be done or if I'm missing a plugin or configuration. In addition, Jenkins is currently running as a Kubernetes pod.

3
You are looking for a 'webhook'. Depending on your SCM seting up one differs. Which SCM do do you use? - Michael Kemmerzell
Based on the tags, the user seems to be using git - Sushant Sonker
Hello, yes I'm using Git - Carlos Gomez
Also I forgot to specify but Jenkins is running as a Kubernetes pod - Carlos Gomez

3 Answers

2
votes

You have to install Github Branch Source Plugin on Jenkins and configure the URL to <JENKINS_URL>/github-webhook/ for your GitHub webhook.

You can check this support documentation from cloudbees for step by step configuration help.

2
votes

I saw the problem, for the multi-branch pipeline project the source must be GitHub instead of Git. Configure the web-hook with the desired events, build the project manually one time and then do a test push, it should work.

1
votes

I shared a guide/tutorial in this post, it was about Gitlab and Jenkins but there are some similar parts which might help you.