简体   繁体   中英

Jenkins - Multibranch pipeline build on push

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.

在此处输入图片说明

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.

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.

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.

我在这篇文章中分享了一个指南/教程,它是关于Gitlab和Jenkins的,但是有些类似的部分可能会对您有所帮助。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM