-
Bug
-
Resolution: Won't Fix
-
Minor
-
Jenkins 2.46.2
Git Plugin 3.3.0
Pipeline: Multibranch 2.16
Today i was wondering why a branch that was deleted on the remote repository does not get marked as removed in the Pipeline Multibranch Projekt.
So I did a couple of "Scan Multibranch Pipeline Now" and had a closer look at the log, but while the statements seemed ok in the first place, the branches are still all listed and even though a prune option is on the fetch they did not get removed.
> /usr/bin/git rev-parse --is-inside-work-tree # timeout=10 Setting origin to gitserver:/data/git/Repository.git > /usr/bin/git config remote.origin.url gitserver:/data/git/Repository.git # timeout=10 Fetching origin... Fetching upstream changes from origin > /usr/bin/git --version # timeout=10 using GIT_SSH to set credentials Jenkins private Key zur Authentifizierung auf gitserver > /usr/bin/git fetch --tags --progress origin +refs/heads/*:refs/remotes/origin/* using GIT_SSH to set credentials Jenkins private Key zur Authentifizierung auf gitserver > /usr/bin/git ls-remote gitserver:/data/git/Repository.git # timeout=10 > /usr/bin/git rev-parse --is-inside-work-tree # timeout=10 Setting origin to gitserver:/data/git/Repository.git > /usr/bin/git config remote.origin.url gitserver:/data/git/Repository.git # timeout=10 Fetching & pruning origin... Fetching upstream changes from origin > /usr/bin/git --version # timeout=10 using GIT_SSH to set credentials Jenkins private Key zur Authentifizierung auf gitserver > /usr/bin/git fetch --tags --progress origin +refs/heads/*:refs/remotes/origin/* --prune Getting remote branches... Seen branch in repository origin/bugfix/JIRA-6365 Seen branch in repository origin/development Seen branch in repository origin/release/14.1 ...
so i was looking into the <JENKINS_HOME>/cache directory and fired a couple of git commands manually:
git prune git fetch --prune git remote prune origin
but nothing happened to the refs/remotes/origin/bugfix... (that should haved been removed)
after more investigation I stumbled upon the following command and compared the output to my local copy and the surprise was that all branches in the jenkins cache does not seem to be tracked:
# in the Jenkins cache (used for the multi branch indexing) git remote show origin * remote origin Fetch URL: gitserver:/data/git/Repository.git Push URL: gitserver:/data/git/Repository.git HEAD branch: development
# locally cloned repository git remote show origin * remote origin Fetch URL: gitserver:/data/git/Repository.git Push URL: gitserver:/data/git/Repository.git HEAD branch: development Remote branches: bugfix/JIRA-6365 tracked development tracked release/14.1 tracked Local branches configured for 'git pull': ... Local refs configured for 'git push': ...
The only difference I could find was that in the .git/config
[remote "origin"] url = gitserver:/data/git/Repository.git fetch = +refs/heads/*:refs/remotes/origin/*
the fetch line was missing. After I added that in a local copy and made a git fetch --prune the stale branches got removed.
git fetch --prune From gitserver:/data/git/Repository.git - [deleted] (none) -> origin/bugfix/JIRA-6365
I also replayed the commands from the Multibranch Scan Log with a local git (git version 2.13.0.windows.1) and had the same problems - the remote references where fetched but not tracked.
I hope I did not miss a thing here and you can fix this.
Update: Jenkins is using the command line git in version 1.7.1
[JENKINS-45175] Multibranch Pipeline does not prune/track remote branches with git 1.7.1
Summary | Original: Multibranch Pipeline does not prune/tack remote branches | New: Multibranch Pipeline does not prune/track remote branches |
Description |
Original:
Today i was wondering why a branch that was deleted on the remote repository does not get marked as removed in the Pipeline Multibranch Projekt. So I did a couple of "{{Scan Multibranch Pipeline Now"}} and had a closer look at the log, but while the statements seemed ok in the first place, the branches are still all listed and even though a prune option is on the fetch they did not get removed. {noformat} > /usr/bin/git rev-parse --is-inside-work-tree # timeout=10 Setting origin to gitserver:/data/git/Repository.git > /usr/bin/git config remote.origin.url gitserver:/data/git/Repository.git # timeout=10 Fetching origin... Fetching upstream changes from origin > /usr/bin/git --version # timeout=10 using GIT_SSH to set credentials Jenkins private Key zur Authentifizierung auf gitserver > /usr/bin/git fetch --tags --progress origin +refs/heads/*:refs/remotes/origin/* using GIT_SSH to set credentials Jenkins private Key zur Authentifizierung auf gitserver > /usr/bin/git ls-remote gitserver:/data/git/Repository.git # timeout=10 > /usr/bin/git rev-parse --is-inside-work-tree # timeout=10 Setting origin to gitserver:/data/git/Repository.git > /usr/bin/git config remote.origin.url gitserver:/data/git/Repository.git # timeout=10 Fetching & pruning origin... Fetching upstream changes from origin > /usr/bin/git --version # timeout=10 using GIT_SSH to set credentials Jenkins private Key zur Authentifizierung auf gitserver > /usr/bin/git fetch --tags --progress origin +refs/heads/*:refs/remotes/origin/* --prune Getting remote branches... Seen branch in repository origin/bugfix/JIRA-6365 Seen branch in repository origin/development Seen branch in repository origin/release/14.1 ...{noformat} so i was looking into the <JENKINS_HOME>/cache directory and fired a couple of git commands manually: {code:java} git prune git fetch --prune git remote prune origin {code} but nothing happened to the {{refs/remotes/origin/bugfix...}} (that should haved been removed) after more investigation I stumbled upon the following command and compared the output to my local copy and the surprise was that all branches in the jenkins cache does not seem to be tracked: {noformat} # in the Jenkins cache (used for the multi branch indexing) git remote show origin * remote origin Fetch URL: gitserver:/data/git/Repository.git Push URL: gitserver:/data/git/Repository.git HEAD branch: development {noformat} {noformat} # locally cloned repository git remote show origin * remote origin Fetch URL: gitserver:/data/git/Repository.git Push URL: gitserver:/data/git/Repository.git HEAD branch: development Remote branches: bugfix/JIRA-6365 tracked development tracked release/14.1 tracked Local branches configured for 'git pull': ... Local refs configured for 'git push': ... {noformat} The only difference I could find was that in the {{.git/config}} {noformat} [remote "origin"] url = gitserver:/data/git/Repository.git fetch = +refs/heads/*:refs/remotes/origin/* {noformat} the fetch line was missing. After I added that in a local copy and made a {{git fetch --prune}} the stale branches got removed. {noformat} git fetch --prune From gitserver:/data/git/Repository.git - [deleted] (none) -> origin/bugfix/JIRA-6365 {noformat} I also replayed the commands from the Multibranch Scan Log with a local git (git version 2.13.0.windows.1) and had the same problems - the remote references where fetched but not tracked. I hope I did not miss a thing here and you can fix this. |
New:
Today i was wondering why a branch that was deleted on the remote repository does not get marked as removed in the Pipeline Multibranch Projekt. So I did a couple of "{{Scan Multibranch Pipeline Now"}} and had a closer look at the log, but while the statements seemed ok in the first place, the branches are still all listed and even though a prune option is on the fetch they did not get removed. {noformat} > /usr/bin/git rev-parse --is-inside-work-tree # timeout=10 Setting origin to gitserver:/data/git/Repository.git > /usr/bin/git config remote.origin.url gitserver:/data/git/Repository.git # timeout=10 Fetching origin... Fetching upstream changes from origin > /usr/bin/git --version # timeout=10 using GIT_SSH to set credentials Jenkins private Key zur Authentifizierung auf gitserver > /usr/bin/git fetch --tags --progress origin +refs/heads/*:refs/remotes/origin/* using GIT_SSH to set credentials Jenkins private Key zur Authentifizierung auf gitserver > /usr/bin/git ls-remote gitserver:/data/git/Repository.git # timeout=10 > /usr/bin/git rev-parse --is-inside-work-tree # timeout=10 Setting origin to gitserver:/data/git/Repository.git > /usr/bin/git config remote.origin.url gitserver:/data/git/Repository.git # timeout=10 Fetching & pruning origin... Fetching upstream changes from origin > /usr/bin/git --version # timeout=10 using GIT_SSH to set credentials Jenkins private Key zur Authentifizierung auf gitserver > /usr/bin/git fetch --tags --progress origin +refs/heads/*:refs/remotes/origin/* --prune Getting remote branches... Seen branch in repository origin/bugfix/JIRA-6365 Seen branch in repository origin/development Seen branch in repository origin/release/14.1 ...{noformat} so i was looking into the <JENKINS_HOME>/cache directory and fired a couple of git commands manually: {code:java} git prune git fetch --prune git remote prune origin {code} but nothing happened to the {{refs/remotes/origin/bugfix...}} (that should haved been removed) after more investigation I stumbled upon the following command and compared the output to my local copy and the surprise was that all branches in the jenkins cache does not seem to be tracked: {noformat} # in the Jenkins cache (used for the multi branch indexing) git remote show origin * remote origin Fetch URL: gitserver:/data/git/Repository.git Push URL: gitserver:/data/git/Repository.git HEAD branch: development {noformat} {noformat} # locally cloned repository git remote show origin * remote origin Fetch URL: gitserver:/data/git/Repository.git Push URL: gitserver:/data/git/Repository.git HEAD branch: development Remote branches: bugfix/JIRA-6365 tracked development tracked release/14.1 tracked Local branches configured for 'git pull': ... Local refs configured for 'git push': ... {noformat} The only difference I could find was that in the {{.git/config}} {noformat} [remote "origin"] url = gitserver:/data/git/Repository.git fetch = +refs/heads/*:refs/remotes/origin/* {noformat} the fetch line was missing. After I added that in a local copy and made a {{git fetch --prune}} the stale branches got removed. {noformat} git fetch --prune From gitserver:/data/git/Repository.git - [deleted] (none) -> origin/bugfix/JIRA-6365 {noformat} I also replayed the commands from the Multibranch Scan Log with a local git (git version 2.13.0.windows.1) and had the same problems - the remote references where fetched but not tracked. I hope I did not miss a thing here and you can fix this. *Update*: Jenkins is using the command line git in version 1.7.1 |
Assignee | Original: Mark Waite [ markewaite ] |
Priority | Original: Critical [ 2 ] | New: Minor [ 4 ] |
Summary | Original: Multibranch Pipeline does not prune/track remote branches | New: Multibranch Pipeline does not prune/track remote branches with git 1.7.1 |
Resolution | New: Won't Fix [ 2 ] | |
Status | Original: Open [ 1 ] | New: Resolved [ 5 ] |
Status | Original: Resolved [ 5 ] | New: Closed [ 6 ] |