gpt4 book ai didi

git - Jenkins 在通过分支索引删除分支时删除作业

转载 作者:IT王子 更新时间:2023-10-29 00:51:10 34 4
gpt4 key购买 nike

有没有办法告诉 Jenkins (2.2) 删除已删除分支的作业?目前我的构建监视器充满了分支,因为作业没有被删除。是否有触发此行为的设置,或者是否应将其作为错误提交?

最佳答案

由于您使用的是最新的 Jenkins 版本,请考虑将您的工作切换到 multibranch pipeline setup

The Workflow Multibranch feature (provided by the workflow plugin) provides the following key abilities:

  • Automatic Workflow (job) creation in Jenkins per new branch in the repo (assuming webhooks are registered from GH to Jenkins).

  • Build specific to that child-branch and its unique scm change and build history.

  • Automatic job pruning/deletion for branches deleted from the repository, according to the settings.

  • Flexibility to individually configure branch properties, by overriding the parent properties, if required.

编辑:检查管道的“丢弃旧项目”设置。如果您有非零的“旧项目的最大数量”,那么如果您的分支机构的构建数量少于这个数字,它将永远不会被删除!您甚至可以在日志中看到:

Will not remove US12345 as it is only #1 in the list
Will not remove US23456 as it is only #2 in the list
Will not remove US34567 as it is only #3 in the list

编辑:您还可以通过添加名为“Prune stale remote-tracking branches”(“行为”->“添加”->从下 pull 列表中选择)的额外行为来试试运气。

关于git - Jenkins 在通过分支索引删除分支时删除作业,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37210799/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com