Jenkins多分支管道不修剪从远程删除的分支

时间:2017-06-07 18:05:55

标签: git jenkins jenkins-pipeline

我在Jenkins中设置了一个多分支管道作业设置,以自动构建开放分支。但是,当我关闭分支并从远程删除它时,它似乎不会删除项目。我检查了丢弃的项目设置,以确保它未被设置,但似乎Jenkins正在拿起分支,即使它已从遥控器中删除。

例如,如下所示,分支功能/ INT-542-Sample已从遥控器中删除,但即使在修剪后它仍被检测为Jenkins中的分支。

Started by user Jenkins User
[Wed Jun 07 13:51:52 EDT 2017] Starting branch indexing...
 > git rev-parse --is-inside-work-tree # timeout=10
Setting origin to git@bitbucket.org: company-ondemand/project-sync.git
 > git config remote.origin.url git@bitbucket.org: company-ondemand/project-sync.git # timeout=10
Fetching origin...
Fetching upstream changes from origin
 > git --version # timeout=10
using GIT_SSH to set credentials Master SSH Key for Git Creation
 > git fetch --tags --progress origin +refs/heads/*:refs/remotes/origin/*
using GIT_SSH to set credentials Master SSH Key for Git Creation
 > git ls-remote git@bitbucket.org: company-ondemand/project-sync.git # timeout=10
 > git rev-parse --is-inside-work-tree # timeout=10
Setting origin to git@bitbucket.org: company-ondemand/project-sync.git
 > git config remote.origin.url git@bitbucket.org:company-ondemand/project-sync.git # timeout=10
Fetching & pruning origin...
Fetching upstream changes from origin
 > git --version # timeout=10
using GIT_SSH to set credentials Master SSH Key for Git Creation
 > git fetch --tags --progress origin +refs/heads/*:refs/remotes/origin/* --prune
Getting remote branches...
Seen branch in repository origin/develop
Seen branch in repository origin/feature/INT-542
Seen branch in repository origin/feature/INT-542-Sample
Seen branch in repository origin/master
Seen 4 remote branches
Checking branch feature/INT-542
      ‘Jenkinsfile’ found
Met criteria
No changes detected: feature/INT-542 (still at a88426b7ac1dad632b5df7b4e165aafa12bddce7)
Checking branch develop
      ‘Jenkinsfile’ found
Met criteria
No changes detected: develop (still at ec776ac8e6c639ea2b395f92e8aad572945ae270)
Checking branch master
      ‘Jenkinsfile’ not found
Does not meet criteria
Checking branch feature/INT-542-Sample
      ‘Jenkinsfile’ found
Met criteria
No changes detected: feature/INT-542-Sample (still at ec776ac8e6c639ea2b395f92e8aad572945ae270)
Done.
[Wed Jun 07 13:51:54 EDT 2017] Finished branch indexing. Indexing took 2.2 sec
Finished: SUCCESS

1 个答案:

答案 0 :(得分:1)

您的问题有两种可能的解决方案。

  1. 在Jenkins上将JGit设置为Git可执行文件。请参阅this answer
  2. 你使用的Git版本太旧了。我的系统上有1.7.something并且遇到了同样的问题。将Git升级到2.13.1后,删除分支的作业将被正确禁用。
  3. 亲切的问候, 伊夫

相关问题