Jenkins 不会从多分支管道中删除旧分支

问题描述 投票:0回答:1

扫描我的多分支管道时,我期望从 bitbucket 中删除的旧分支在 Jenkins 中被删除。 这是扫描我的管道的输出:

Evaluating orphaned items in *****
Will remove ****
Will remove ****
Finished: NOT_BUILT

但它不会移除树枝。

我的修剪设置和孤立设置都设置为空

编辑: 尝试将

extensions: [[$class: 'PruneStaleBranch']]
添加到我的结账步骤中,它仍然没有删除旧分支

jenkins
1个回答
0
投票

TLDR

您必须设置removeLastBuild来删除旧的分支构建,但由于bug,这是不可能的。

调查

我也有类似的问题。在我的多分支管道中,构建被丢弃:

options {
   buildDiscarder(logRotator(numToKeepStr: '2', daysToKeepStr: '7'))
}

旧版本不会被删除。我检查了LogRotator的代码,发现

removeLastBuild
字段从未设置过。

尝试通过附加参数设置它:

options {
   buildDiscarder(logRotator(numToKeepStr: '2', daysToKeepStr: '7', removeLastBuild: true))
}

失败:

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 30: Invalid parameter "removeLastBuild", did you mean "numToKeepStr"? @ line 30, column 73.
   Str: '2', daysToKeepStr: '7', removeLast

即使相应的方法标有

@DataBoundSetter
注释。我假设注释仅适用于步骤而不适用于
Describable
对象。

问题已在 JENKINS-36364

中跟踪
© www.soinside.com 2019 - 2024. All rights reserved.