Jenkins 没有将 pruneTags 选项设置为 true

Jenkins does not set pruneTags option to true

Git plugin for Jenkins allows pruning stale tags.

当我通过 Jenkins 仪表板添加(并保存)这样一个选项时:

配置更改如下:

构建运行时,此选项将被忽略。为什么该选项设置为 false 而不是 true?

詹金斯版本:2.222.4

Jenkins Git插件版本:4.6.0

这似乎是一个要报告给 git-plugin Jira 的错误。

管道形式(由插件测试)为:

node {  
  checkout([ $class: 'GitSCM',
             branches: [[name: '*/master']],
             doGenerateSubmoduleConfigurations: false,
             extensions: [pruneTags(true)],
             submoduleCfg: [],
             userRemoteConfigs: [[url: 'remoteURL']]
           ])"
}

但如果您不使用管道并依赖经典 GUI,则永远不会调用 pruneTags (boolean pruneTags)
由于代码在过去 2 年内没有更改,这可能是您的 Jenkins 版本的副作用 2.x.

还是先把插件升级到最新的4.10.1,测试一下


但是,OP Marc points out to their issue JENKINS-67473:“Git 插件不添加来自 UI 的 pruneTags”。
由于难以可靠地重现而被关闭(使用 Jenkins 2.319.1 和 git 插件 4.10.1。)。

Steps I took to try to duplicate the problem:

  1. Create a freestyle project using git SCM and include the "prune stale tags" setting
  2. Run the job and confirm that the "Pruning obsolete local tags that do not exist on remotes" message is included in the log
  3. Create a different freestyle project using git SCM with the JGit implementation instead of command line git and include the "prune stale tags" setting
  4. Run the job and confirm that the "Pruning obsolete local tags that do not exist on remotes" message is included in the log
  5. Confirm that the XML definitions of the jobs include pruneStaleTags set to true

Since there have been multiple security advisories published for Jenkins core since 2.222.4 and multiple security advisories for the git plugin, I recommend upgrading to see if it resolves the issue.