简体   繁体   English

Jenkins多分支管道具有多个具有相同分支名称的来源

[英]Jenkins Multibranch Pipeline with multiple sources with the same branch name

I have 3 interdependent micro service apps that I want to have builds/tests/deployments triggered for in Jenkins. 我有3个相互依赖的微服务应用程序,想要在Jenkins中触发构建/测试/部署。 My desired strategy is to use a single multibranch pipeline with multiple sources (one per micro service) that starts a pipeline every time there's a commit to their respective git repository. 我理想的策略是使用具有多个源的单个多分支管道(每个微服务一个),每次提交各自的git存储库时都会启动管道。

Since the services are interdependent (functionality-wise, not build-wise), my over-simplified ideal output/layout would look something like: 由于服务是相互依赖的(在功能上而不是在构建方面),因此我过度简化的理想输出/布局看起来像这样:

My_Product (multibranch pipeline) \\- sprint-55 |- micro_service_1_97dd2ae0 (pipeline) |- micro_service_2_8199aabb (pipeline) \\- micro_service_3_9900ccff (pipeline)

The problem I am running into with this approach is that our "main line" branches are named after the current sprint. 我使用这种方法遇到的问题是,我们的“主线”分支以当前的sprint命名。 So, as an example, micro_service_1 has a "sprint-55" branch as does micro_service_2 and micro_service_3. 因此,例如,micro_service_1和micro_service_2和micro_service_3都具有“ sprint-55”分支。 With the multibranch pipeline only the first micro service with a commit gets created. 使用多分支管道,仅创建具有提交的第一个微服务。 The remaining commits generate the following error: 其余提交会产生以下错误:

Error creating sprint-55 from source #2 as source #1 owns the branch name

Is there a way to support what I want to do? 有什么方法可以支持我想做的事吗? I am open to other Jenkins-based options. 我愿意接受其他基于詹金斯的选择。 I'd rather not have a multibranch pipeline for each micro service, but I can do that if it's the only way. 我宁愿没有针对每个微服务的多分支管道,但是如果这是唯一的方法,我可以这样做。

I also encountered the same problem. 我也遇到了同样的问题。 I didn't find a way to run this setup under a single multibranch pipeline. 我没有找到在单个多分支管道下运行此设置的方法。 So my solution was to create multiple multibranch pipelines. 因此,我的解决方案是创建多个多分支管道。 In your case that would be one multibranch pipeline per each microservice. 在您的情况下,每个微服务将是一个多分支管道。

That makes the pipelines independent from each other and makes it possible to use same branch names in different repos. 这使管道彼此独立,并可以在不同的存储库中使用相同的分支名称。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Jenkinsfile:如何在多分支管道中检出多个分支源? - Jenkinsfile: how to checkout multiple branch sources in multibranch pipeline? Jenkins Multibranch(管道)/分支跟踪 - Jenkins Multibranch (Pipeline) / Branch tracking 在拉取请求 jenkins 多分支管道的情况下获取分支名称 - Get branch name in case of pull request jenkins multibranch pipeline 如何在 jenkins 多分支脚本管道中获取最新的 git 提交作者姓名或消息并在分支条件下使用 - How to get latest git commit author name or message in jenkins multibranch scripted pipeline and use under branch condition 如何使用 Jenkins 多分支管道检查同一分支上的先前构建是否已开始 &lt;3 小时或 &gt;3 小时 - How to check if the previous build on the same branch has started <3 hrs or >3 hrs using Jenkins Multibranch Pipeline Jenkins 多分支管道的分支名称变量是什么? - What is the branch name variable for Jenkins multibranch pipelines? 如果另一个分支在詹金斯多分支管道中不稳定,则防止分支的建立 - Prevent build of branch if another branch is not stable in jenkins multibranch pipeline Jenkins multibranch管道有多个起点 - Jenkins multibranch pipeline with multiple starting points 每个分支的基于作业的安全性 - Jenkins Multibranch管道 - Job based security per branch - Jenkins Multibranch pipeline 为 Jenkins 多分支管道中的每个分支设置通用构建参数 - Set common build parameters for every branch in Jenkins multibranch pipeline
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM