-
Bug
-
Resolution: Not A Defect
-
Minor
-
None
Jenkins 2.89.3
Git client plugin 2.7.1
Git plugin 3.8.0
Pipeline 2.5
Create pipeline from SCM, use wrong as local branch name.
Jenkinsfile:
pipeline { agent any stages { stage ('SCM') { steps { script { echo '1' bat script: 'git remote -v' bat script: 'git branch' checkout([$class: 'GitSCM', branches: [[name: 'develop']], extensions: [[$class: 'LocalBranch', localBranch: 'expected']], //extensions: [[$class: 'LocalBranch', localBranch: 'expected'], [$class: 'WipeWorkspace']], userRemoteConfigs: [[url: 'ssh://gitblit.example.com/anton/jenkins-project.git', credentialsId: 'jenkins-ssh-credential']]]) echo '2' bat script: 'git remote -v' bat script: 'git branch' } } } } }
First build (Log1.txt)
Branches after Jenkinsfile checkout:
* wrong
Branches after project repo checkout:
* expected wrong
An unexpected branch wrong exists in the list.
Second build (Log2.txt)
Branches after Jenkinsfile checkout:
expected * wrong
An unexpected branch expected exists in the list.
Branches after project repo checkout:
* expected wrong
An unexpected branch wrong exists in the list.
Build with WipeWorkspace extension (LogWipe.txt)
Branches after Jenkinsfile checkout:
* wrong
* expected
Everything is good, but I don't need to clone the repository every time.
PruneStaleBranch extension does not help (I guess it deletes only tracked branches).
1. Why does Jenkins use my workspace to checkout Jenkisfile? I expect it to use a temp dir, like libLoader does.
2. Why does it mix branches for unrelated repositories? Does it manually change .git/ content somehow?
Similar issue: JENKINS-30619