Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-50321

Git LFS fails for pull requests merged with the target branch with the GitHub Branch Source Plugin

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • git-plugin
    • None
    • Jenkins 2.89.4
      GitHub Branch Source Plugin 2.3.3 (latest)
      Git plugin 3.8.0 (latest)
      git 2.11.0
      git-lfs 2.4.0

      In a job created by the GitHub Branch Source plugin, git lfs pull fails with Bad credentials when building pull requests merged with the target branch.

      It works fine when building any branch separately. 

      Here's the build log:

      Started by user Anonymous
      Connecting to https://api.github.com using github-user/****** (GitHub username and password for github-user)
      Checking out git https://github.com/acme-inc/repo.git into /var/jenkins_home/jobs/some-job/branches/PR-512/workspace@script to read Jenkinsfile
      > git rev-parse --is-inside-work-tree # timeout=10
      Fetching changes from the remote Git repository
      > git config remote.origin.url https://github.com/acme-inc/repo.git # timeout=10
      Cleaning workspace
      > git rev-parse --verify HEAD # timeout=10
      Resetting working tree
      > git reset --hard # timeout=10
      > git clean -fdx # timeout=10
      Fetching without tags
      Fetching upstream changes from https://github.com/acme-inc/repo.git
      > git --version # timeout=10
      using GIT_ASKPASS to set credentials GitHub username and password for github-user
      > git fetch --no-tags --progress https://github.com/acme-inc/repo.git +refs/pull/512/head:refs/remotes/origin/PR-512 +refs/heads/master:refs/remotes/origin/master
      Merging remotes/origin/master commit ac1ba744ee37a24027fb05a662b8ad79a675a19f into PR head commit f2ccaf9bd99cf9596c9b0bfc9ae9e92bd747eeaf
      Enabling Git LFS pull
      > git config core.sparsecheckout # timeout=10
      > git checkout -f f2ccaf9bd99cf9596c9b0bfc9ae9e92bd747eeaf
      > git config --get remote.origin.url # timeout=10
      using GIT_ASKPASS to set credentials GitHub username and password for github-user
      > git lfs pull origin
      > git merge ac1ba744ee37a24027fb05a662b8ad79a675a19f # timeout=10
      Enabling Git LFS pull
      > git config core.sparsecheckout # timeout=10
      > git checkout -f f2ccaf9bd99cf9596c9b0bfc9ae9e92bd747eeaf
      > git config --get remote.origin.url # timeout=10
      using GIT_ASKPASS to set credentials GitHub username and password for github-user
      > git lfs pull origin
      
      GitHub has been notified of this commit’s build result
      
      hudson.plugins.git.GitException: Command "git merge ac1ba744ee37a24027fb05a662b8ad79a675a19f" returned status code 128:
      stdout: 
      stderr: Downloading path/to/some_file.zip (292 KB)
      Error downloading object: path/to/some_file.zip (b7bf2ce): Smudge error: Error downloading path/to/some_file.zip (b7bf2ceb57d399cd89d339f2cddf5c355979b580861346d7e1251a60bc3fbfe9): batch response: Bad credentials
      
      Errors logged to /var/jenkins_home/jobs/some-job/branches/PR-512/workspace@script/.git/lfs/logs/20180321T163523.475698065.log
      Use `git lfs logs last` to view the log.
      error: external filter 'git-lfs filter-process' failed
      fatal: path/to/some_file.zip: smudge filter lfs failed
      
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1996)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1964)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1960)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1597)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$3.execute(CliGitAPIImpl.java:697)
      at jenkins.plugins.git.MergeWithGitSCMExtension.decorateRevisionToBuild(MergeWithGitSCMExtension.java:122)
      at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:1068)
      at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1161)
      at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:113)
      at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:143)
      at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:120)
      at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:271)
      at hudson.model.ResourceController.execute(ResourceController.java:97)
      at hudson.model.Executor.run(Executor.java:429)
      Finished: FAILURE

      I have tried git-lfs 2.2.1 as described in -JENKINS-46921-, and 2.4.0, with no luck The git-lfs log is attached. The branch is built with a Jenkinsfile containing checkout scm. The repository is private.

          [JENKINS-50321] Git LFS fails for pull requests merged with the target branch with the GitHub Branch Source Plugin

          Mark Waite added a comment -

          Refer to JENKINS-45228 as the original description of this issue. The git plugin assumes that `git merge` does not require credentials. When LFS support was added to the git plugin, LFS credentials support was not added to the merge portion of the git plugin.

          Mark Waite added a comment - Refer to JENKINS-45228 as the original description of this issue. The git plugin assumes that `git merge` does not require credentials. When LFS support was added to the git plugin, LFS credentials support was not added to the merge portion of the git plugin.

          All right, I'll watch that. Thanks for a very fast response! 

          David Pärsson added a comment - All right, I'll watch that. Thanks for a very fast response! 

            Unassigned Unassigned
            davidparsson David Pärsson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: