简体   繁体   English

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

[英]Jenkins Multi-Branch Pipeline Not Pruning Branches Deleted from Remote

I have a multi-branch pipeline job setup in Jenkins set to automatically build open branches. 我在Jenkins中有一个多分支管道作业设置,可以自动建立开放的分支。 However when I close a branch and delete it from the remote it does not seem to remove the project. 但是,当我关闭分支并将其从远程删除时,它似乎并没有删除项目。 I checked the discarded items settings to ensure it was unset, but it seems that Jenkins is picking up the branch even though it was deleted from the remote. 我检查了丢弃的物品设置以确保未设置它,但是Jenkins似乎正在拾取分支,即使该分支已从远程删除。

For example below, the branch feature/INT-542-Sample was deleted from the remote, but it still is being detected as a branch in Jenkins even after pruning. 例如,在下面的示例中,分支功能部件/ 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

There are two possible solutions for your issue. 有两种可能的解决方案来解决您的问题。

  1. Setup JGit as Git executable on Jenkins. 在Jenkins上将JGit设置为Git可执行文件。 See this answer or 看到这个答案
  2. The Git version you use is too old. 您使用的Git版本太旧。 I've had 1.7.something on my system and got the same issue. 我的系统上安装了1.7.something,出现了同样的问题。 After upgrading Git to 2.13.1, the jobs for removed branches where properly disabled. 将Git升级到2.13.1之后,已删除分支的作业将被正确禁用。

Kind regards, Yves 亲切的问候,伊夫

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 GitSCMExtension 或 GitSCM 分支源配置以获取 Jenkins 多分支管道中的所有/一些其他远程分支 - GitSCMExtension or GitSCM branch source configuration to fetch all/some additional remote branches in Jenkins multi-branch pipeline 如何使用 Gitlab Webhook 触发 Jenkins 多分支流水线 - How to trigger Jenkins Multi-Branch Pipeline with Gitlab Webhook 使用多分支管道 Jenkins 时? - When using multi-branch pipline Jenkins? “java.lang.Exception: None or multiple repos”与 Jenkins 多分支管道中的 BitBucket Notifier - "java.lang.Exception: None or multiple repos" with BitBucket Notifier in Jenkins multi-branch pipeline EGit:修剪远程回购中已删除的远程跟踪分支 - EGit: Pruning Remote Tracking Branches that have been Deleted on the Remote Repo 如何使用Jenkins DSL插件创建多分支项目? - How to create multi-branch project with Jenkins DSL plugin? Jenkins 多分支管道卡在旧的 Jenkinsfile 上 - Jenkins multi-branch pipeling stuck on an old Jenkinsfile git多分支差异? - Multi-branch diff with git? Jenkins 多分支管道错误与 Jenkins 文件 - Jenkins Multi Branch Pipeline error with Jenkins file Git 分支上的 Jenkins 管道多触发器选项 - Jenkins pipeline multi trigger options on Git branch
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM