如何从 Jenkins 中的构建中排除 git branch

编程入门 行业动态 更新时间:2024-10-23 01:31:07
本文介绍了如何从 Jenkins 中的构建中排除 git branch的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

这是我当前为一个项目设置的 Jenkins:

Here is my current Jenkins setup for a project:

  • 一个作业运行所有开发分支
  • 一个作业运行所有拉取请求
  • 一个作业只运行 master 分支
  • 只有当master通过时,一项工作才会自动发布

此设置使我能够在开发过程中持续进行自动化交付以及持续反馈.前 3 个作业还运行所有测试和覆盖率报告.

This setup allows me to have continuous automated delivery as well as constant feedback during development. The first 3 jobs also run all tests and coverage reports.

问题是我找不到从所有开发分支"作业中排除主分支的方法.每次我合并一个拉取请求时,它都会不必要地构建两次 master.

The problem is that I could not find a way to exclude the master branch from the "all development branches" job. It unnecessarily builds master twice every time I merge a pull-request.

有人知道如何从 Jenkins 的工作中排除一个分支吗?

Does anybody know how to exclude one branch from the job in Jenkins ?

ps:我正在使用 Git 和 Github 插件.我的项目存储在 Github 上.

ps: I am using the Git and the Github plugins. My project is stored on Github.

推荐答案

您可以选择反向"策略来定位要构建的分支.

You can choose "Inverse" strategy for targeting branches to build.

查看 Jenkins 作业配置,

Check out Jenkins job configuration,

  • 源代码管理"部分(选择Git")
  • 其他行为
  • 点击添加"按钮
  • 选择选择构建内容的策略"
  • 在组合框中选择反向"策略.

(不要忘记用master"填写Branches to build"文本字段)

(Don't forget to fill in "Branches to build" text field by "master")

另见附件截图:

更多推荐

如何从 Jenkins 中的构建中排除 git branch

本文发布于:2023-11-16 17:02:18,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1606177.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Jenkins   git   branch

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!