[JIRA] (JENKINS-49786) Jenkins uses the same directory for Jenkinsfile pull and project workspace, branches are mixed up
Title: Message Title Mark Waite closed an issue as Not A Defect Jenkins / JENKINS-49786 Jenkins uses the same directory for Jenkinsfile pull and project workspace, branches are mixed up Change By: Mark Waite Status: Resolved Closed Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-issues/JIRA.188735.1519794403000.10061.1563106080433%40Atlassian.JIRA. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-49786) Jenkins uses the same directory for Jenkinsfile pull and project workspace, branches are mixed up
Title: Message Title Anton Zimin commented on JENKINS-49786 Re: Jenkins uses the same directory for Jenkinsfile pull and project workspace, branches are mixed up The default checkout does not seem useful in your example since the checkout in the Jenkinsfile is reusing the workspace directory. I want to use Pipeline script from SCM option. That's why I need the default checkout. If additional checkout calls are needed, they are typically performed into new subdirectories of the workspace. Thanks, that solves the problem. Need to use ws statement in all stages that work with the second checkout. ws ('another-workspace') { checkout ... } Add Comment This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-49786) Jenkins uses the same directory for Jenkinsfile pull and project workspace, branches are mixed up
Title: Message Title Mark Waite assigned an issue to Unassigned Jenkins / JENKINS-49786 Jenkins uses the same directory for Jenkinsfile pull and project workspace, branches are mixed up Change By: Mark Waite Assignee: Mark Waite Add Comment This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-49786) Jenkins uses the same directory for Jenkinsfile pull and project workspace, branches are mixed up
Title: Message Title Mark Waite resolved as Not A Defect This is behaving as expected. Declarative Pipeline (which is what you are using) begins with an implicit checkout of the repository using the repository definition from the Jenkins job. In your case, the implicit checkout will create a branch named "wrong" in the workspace at the most recent commit on the origin/develop branch. Refer to skipDefaultCheckout in the Declarative Pipeline options if you do not need the default checkout. The default checkout does not seem useful in your example since the checkout in the Jenkinsfile is reusing the workspace directory. Most Declarative Pipeline users use the default checkout to avoid cluttering the Jenkinsfile with a checkout definition. If additional checkout calls are needed, they are typically performed into new subdirectories of the workspace. If you want the branch name in the implicit checkout to match the name provided in "Branches to build", the online help says to either leave the field blank or use the value '**'. Jenkins / JENKINS-49786 Jenkins uses the same directory for Jenkinsfile pull and project workspace, branches are mixed up Change By: Mark Waite Status: Open Resolved Resolution: Not A Defect Add Comment
[JIRA] (JENKINS-49786) Jenkins uses the same directory for Jenkinsfile pull and project workspace, branches are mixed up
Title: Message Title Anton Zimin updated an issue Jenkins / JENKINS-49786 Jenkins uses the same directory for Jenkinsfile pull and project workspace, branches are mixed up Change By: Anton Zimin Jenkins 2.89.3Git client plugin 2.7.1Git plugin 3.8.0Pipeline 2.5Create pipeline from SCM, use *wrong* as local branch name.!2018-02-28_1145.png!Jenkinsfile:{code:java}pipeline {agent anystages {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'}}}}}{code}*First build (Log1.txt)*Branches after Jenkinsfile checkout:{code}* wrong{code}Branches after project repo checkout:{code}* expected wrong{code}An unexpected branch *wrong* exists in the list.*Second build (Log2.txt)*Branches after Jenkinsfile checkout:{code} expected* wrong{code}An unexpected branch *expected* exists in the list.Branches after project repo checkout:{code}* expected wrong{code}An unexpected branch *wrong* exists in the list.*Build with WipeWorkspace extension (LogWipe.txt)*Branches after Jenkinsfile checkout:{code}* wrong{code}{code}* expected{code}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 Add Comment
[JIRA] (JENKINS-49786) Jenkins uses the same directory for Jenkinsfile pull and project workspace, branches are mixed up
Title: Message Title Anton Zimin updated an issue Jenkins / JENKINS-49786 Jenkins uses the same directory for Jenkinsfile pull and project workspace, branches are mixed up Change By: Anton Zimin Jenkins 2.89.3Git client plugin 2.7.1Git plugin 3.8.0Pipeline 2.5Create pipeline from SCM, use *wrong* as local branch name.!2018-02-28_1145.png!Jenkinsfile:{code:java}pipeline {agent anystages {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'}}}}}{code}*First build (Log1.txt)*Branches after Jenkinsfile checkout:{code}* wrong{code}Branches after project repo checkout:{code}* expected wrong{code}An unexpected branch *wrong* exists in the list.*Second build (Log2.txt)*Branches after Jenkinsfile checkout:{code} expected* wrong{code}An unexpected branch *expected* exists in the list.Branches after project repo checkout:{code}* expected wrong{code}An unexpected branch *wrong* exists in the list.*Build with WipeWorkspace extension (LogWipe.txt)*Branches after Jenkinsfile checkout:{code}* wrong{code}{code}* expected{code}Everything is good, but I don't need to clone the repository every time.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 Add Comment
[JIRA] (JENKINS-49786) Jenkins uses the same directory for Jenkinsfile pull and project workspace, branches are mixed up
Title: Message Title Anton Zimin updated an issue Jenkins / JENKINS-49786 Jenkins uses the same directory for Jenkinsfile pull and project workspace, branches are mixed up Change By: Anton Zimin Attachment: Log1.txt Attachment: Log2.txt Attachment: LogWipe.txt Add Comment This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-49786) Jenkins uses the same directory for Jenkinsfile pull and project workspace, branches are mixed up
Title: Message Title Anton Zimin created an issue Jenkins / JENKINS-49786 Jenkins uses the same directory for Jenkinsfile pull and project workspace, branches are mixed up Issue Type: Bug Assignee: Mark Waite Attachments: 2018-02-28_1145.png Components: git-client-plugin, pipeline Created: 2018-02-28 05:06 Priority: Minor Reporter: Anton Zimin 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: