0

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.

Carlos Gomez
  • 275
  • 5
  • 13

3 Answers3

3

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.

Carlos Gomez
  • 275
  • 5
  • 13
2

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.

SmartTom
  • 691
  • 7
  • 14
  • I already did the webhook configuration in my repository, with content type: application/json and the events "commit comments", "pull requests" and "pushes". I forgot to specify that Jenkins is running in a pod in Kubernetes – Carlos Gomez Mar 12 '19 at 13:09
1

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

Anton Bärwald
  • 798
  • 1
  • 6
  • 15