[JIRA] (JENKINS-59736) No new commits used if LocalBranch checked in same workspace

5 views
Skip to first unread message

vladislav.piskunov.92@gmail.com (JIRA)

unread,
Oct 10, 2019, 5:11:02 PM10/10/19
to jenkinsc...@googlegroups.com
vladislav piskunov created an issue
 
Jenkins / Bug JENKINS-59736
No new commits used if LocalBranch checked in same workspace
Issue Type: Bug Bug
Assignee: Mark Waite
Components: git-plugin
Created: 2019-10-10 21:10
Environment: Any version from
Priority: Minor Minor
Reporter: vladislav piskunov

Reproduce steps:

  • Create branch
  • Execute pipeline with LocalBranch
  • Add commits to branch
  • Repeat pipeline in same workspace - no new commits will be used from original

Criteria to reproduce:

  • Usage of LocalBranch extension
  • Usage of original branch name containig '/' symbol

Problem in class:

hudson.plugins.git.util.DefaultBuildChooser#getCandidateRevisions

Example Pipeline:

node('master') {
    stage('Checkout'){
        script {
            String url = 'https://example.com/repository.git'
            //: Branch name containing `/` symbol
            String branch = 'feature/branch'
            String credentialsId = 'secret-credentials'

            //: Checkout original
            checkout scm: [
                $class: 'GitSCM',
                userRemoteConfigs: [
                    [
                        url: url,
                        credentialsId: credentialsId
                    ]
                ],
                extensions: [[$class: 'LocalBranch']],
                branches: [
                    [name: branch]
                ]
            ]

            //: Change local history
            sh('git reset --hard HEAD^')

            //: Checkout one more time - local history will be used
            checkout scm: [
                $class: 'GitSCM',
                userRemoteConfigs: [
                    [
                        url: url,
                        credentialsId: credentialsId
                    ]
                ],
                extensions: [[$class: 'LocalBranch']],
                branches: [
                    [name: branch]
                ]
            ]

        }
    }
}

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

vladislav.piskunov.92@gmail.com (JIRA)

unread,
Oct 10, 2019, 5:12:02 PM10/10/19
to jenkinsc...@googlegroups.com
vladislav piskunov updated an issue
Change By: vladislav piskunov
Reproduce steps:
* Create branch
* Execute pipeline with LocalBranch
* Add commits to branch
* Repeat pipeline in same workspace - no new commits will be used from original

Criteria to reproduce:
* Usage of LocalBranch extension
* Usage of original branch name containig '/' symbol

Problem in class:
{code:java}
hudson.plugins.git.util.DefaultBuildChooser#getCandidateRevisions
{code}
Example Pipeline:
{code:java}
{code}
Workaround:

Execute before checkout
{code :java }
sh('rm -rf .git/refs/heads/*')
{code}
To remove local branches refs

mark.earl.waite@gmail.com (JIRA)

unread,
Oct 11, 2019, 1:47:02 AM10/11/19
to jenkinsc...@googlegroups.com
Mark Waite assigned an issue to Unassigned
Change By: Mark Waite
Assignee: Mark Waite
Reply all
Reply to author
Forward
0 new messages