如何从詹金斯的建筑物中排除git分支 [英] How to exclude git branch from building in Jenkins

查看:163
本文介绍了如何从詹金斯的建筑物中排除git分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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


  • 一个作业运行所有开发分支 li>
  • 一个作业运行所有请求

  • 一个作业仅运行master 分支

  • 一项工作只在主人通过时才会自动发布



这种设置使我可以持续自动交付,并在开发过程中持续反馈。前3个工作也运行所有测试和覆盖报告。



问题是我无法找到一种方法从所有开发分支作业中排除主分支。每次我合并pull-request时,它都会不必要地建立master。



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



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

解决方案

您可以选择反向 b
$ b

检查Jenkins作业配置,
$ b


  • 源代码管理部分(选择Git)

  • 其他行为

  • 点击添加按钮 / li>

  • (不要忘记填写分支机构构建文本字段由主)



    另请参阅附件截图图片:





    Here is my current Jenkins setup for a project:

    • one job runs all development branches
    • one job runs all pull requests
    • one job runs only the master branch
    • one job makes the automated release only when master passes

    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.

    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.

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

    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.

    Check out Jenkins job configuration,

    • "Source Code Management" section (choose "Git")
    • Additional Behaviours
    • click "Add" button
    • choose "Strategy for choosing what to build"
    • select "Inverse" strategy in combo box.

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

    See also attachment screenshot image:


    这篇关于如何从詹金斯的建筑物中排除git分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆