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

No commit found for SHA after updating github branch source plugin

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • Jenkins 2.164.2 on fully updated CentOS 7 host

      Many plugins installed (all updated), I can provide a list if necessary.

      I have been experiencing problems with my pipeline after updating the "GitHub Branch Source" plugin from 2.4.5 to 2.5.0. I'm running the latest Jenkins with all plugins updated. After updating my pipeline is immediately failing with the following error. As soon as I roll the plugin back to 2.4.5 the tests begin passing again. Some have suggested to close and re-open the PR. I tried another test this morning, first I updated the plugin then I pushed up a completely new PR, it failed immediately. I then rolled the GitHub Branch Source plugin back to 2.4.5 and the pipeline completed successfully.  

       

      The commit SHA referenced in the error is not found even when I do a manual call to the API using the same info.  I'm not sure where this commit SHA in the error is coming from. 

       

      The full trace:
       
       
      Pull request #12 opened

      Connecting to https://api.github.com using xxxxxxxx/****** (xxxxxxxxx Github Personal Access Token)

      GitHub has been notified of this commit’s build result

      java.io.FileNotFoundException: https://api.github.com/repos/xxxxxxx/xxxxx/commits/xxxxxxxxxxxxx1db43d9ee079016f549a11a0
      at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:243)
      at com.squareup.okhttp.internal.huc.DelegatingHttpsURLConnection.getInputStream(DelegatingHttpsURLConnection.java:210)
      at com.squareup.okhttp.internal.huc.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:25)
      at org.kohsuke.github.Requester.parse(Requester.java:625)
      at org.kohsuke.github.Requester.parse(Requester.java:607)
      at org.kohsuke.github.Requester._to(Requester.java:285)
      Caused: org.kohsuke.github.GHFileNotFoundException: {"message":"No commit found for SHA: xxxxxxxxxxxxxxxxdb43d9ee079016f549a11a0","documentation_url":"https://developer.github.com/v3/repos/commits/#get-a-single-commit"}
      at org.kohsuke.github.Requester.handleApiError(Requester.java:699)
      at org.kohsuke.github.Requester._to(Requester.java:306)
      at org.kohsuke.github.Requester.to(Requester.java:247)
      at org.kohsuke.github.GHRepository.getCommit(GHRepository.java:973)
      at org.jenkinsci.plugins.github_branch_source.PullRequestSCMRevision.validateMergeHash(PullRequestSCMRevision.java:118)
      at org.jenkinsci.plugins.github_branch_source.GitHubSCMFileSystem.<init>(GitHubSCMFileSystem.java:91)
      at org.jenkinsci.plugins.github_branch_source.GitHubSCMFileSystem$BuilderImpl.build(GitHubSCMFileSystem.java:296)
      at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:294)
      at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:103)
      at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:293)
      at hudson.model.ResourceController.execute(ResourceController.java:97)
      at hudson.model.Executor.run(Executor.java:429)

      Finished: FAILURE

          [JENKINS-57257] No commit found for SHA after updating github branch source plugin

          James F. added a comment -

          Liam,

           

          I am indeed working on a private repo in the examples I've provided. 

          To me it looks like the query is going to the user the repo is forked by and the commit does not exist there.   

           

          https://api.github.com/repos/MY-GITHUB-USERNAME/repo/commits/xxxxxx5c2b7cd41940bbc762409886a5e84ef  <-- this is what is shown in the jenkins error. 

           

          A query for that commit results in a not found message from the github api but works if I do the same query against my github ORG's username

           

           

          James F. added a comment - Liam,   I am indeed working on a private repo in the examples I've provided.  To me it looks like the query is going to the user the repo is forked by and the commit does not exist there.      https://api.github.com/repos/MY-GITHUB-USERNAME/repo/commits/xxxxxx5c2b7cd41940bbc762409886a5e84ef   <-- this is what is shown in the jenkins error.    A query for that commit results in a not found message from the github api but works if I do the same query against my github ORG's username    

          James F. added a comment -

          $ git fetch upstream pull/12/head:pr-12-head
          $ git fetch upstream pull/12/merge:pr-12-merge
          $ git checkout pr-12-merge
          Switched to branch 'pr-12-merge'

           

          $ git show
          commit xxxxxxxd41940bbc762409886a5e84ef (HEAD -> pr-12-merge)
          Merge: 4721939 e6f1a82
          Author: xxxxxx <32715263+xxxxxxxx@users.noreply.github.com>
          Date: Tue Apr 30 17:09:11 2019 +0000

          Merge xxxxxxxx5096722968a844f45447 into xxxxxx14faf2f0db4199a06cfb17440c209b7

          James F. added a comment - $ git fetch upstream pull/12/head:pr-12-head $ git fetch upstream pull/12/merge:pr-12-merge $ git checkout pr-12-merge Switched to branch 'pr-12-merge'   $ git show commit xxxxxxxd41940bbc762409886a5e84ef (HEAD -> pr-12-merge) Merge: 4721939 e6f1a82 Author: xxxxxx <32715263+xxxxxxxx@users.noreply.github.com> Date: Tue Apr 30 17:09:11 2019 +0000 Merge xxxxxxxx5096722968a844f45447 into xxxxxx14faf2f0db4199a06cfb17440c209b7

          Liam Newman added a comment -

          silverorange
          Thank you that is really useful information. This is good progress.
          I think I see where the problem is.

          Liam Newman added a comment - silverorange Thank you that is really useful information. This is good progress. I think I see where the problem is.

          James F. added a comment -

          No problem at all, thanks for working on it!  Let me know if you want me to do any more tests/provide any further details about my environment.  Thanks!

          James F. added a comment - No problem at all, thanks for working on it!  Let me know if you want me to do any more tests/provide any further details about my environment.  Thanks!

          Caleb D added a comment -

          My observations match silverorange. bitwiseman, you're right, the merge commit exists. I can even see it in the GitHub web UI at https://github.com/MY-GITHUB-ORG/REPO/commit/xxxxxxxxxxxxxxxxxxxxabec08e96270c1de09bb

          GitHub Branch Source is trying to get commit details by hitting https://api.github.com/repos/MY-GITHUB-USERNAME/REPO/commits/xxxxxxxxxxxxxxxxxxxxabec08e96270c1de09bb when it seems it should be hitting MY-GITHUB-ORG.

          Caleb D added a comment - My observations match silverorange . bitwiseman , you're right, the merge commit exists. I can even see it in the GitHub web UI at https://github.com/MY-GITHUB-ORG/REPO/commit/xxxxxxxxxxxxxxxxxxxxabec08e96270c1de09bb GitHub Branch Source is trying to get commit details by hitting https://api.github.com/repos/MY-GITHUB-USERNAME/REPO/commits/xxxxxxxxxxxxxxxxxxxxabec08e96270c1de09bb when it seems it should be hitting MY-GITHUB-ORG.

          Liam Newman added a comment -

          Liam Newman added a comment - calebd silverorange If you're willing, please try this plugin on your Jenkins. https://drive.google.com/open?id=1v06oUnCiN0KSZF47JXjteByPxIS6FBZ1 It incorporates the code from https://github.com/jenkinsci/github-branch-source-plugin/pull/222

          James F. added a comment -

          Liam,

           

          For sure, I can give it a try tomorrow morning and will report my findings.

          James F. added a comment - Liam,   For sure, I can give it a try tomorrow morning and will report my findings.

          Caleb D added a comment -

          bitwiseman, I tested the provided 2.5.1 snapshot build and it worked as expected. The bug reported by this issue appears to be resolved by that build.

          Thank you for the swift action on this!

          Caleb D added a comment - bitwiseman , I tested the provided 2.5.1 snapshot build and it worked as expected. The bug reported by this issue appears to be resolved by that build. Thank you for the swift action on this!

          James F. added a comment -

          I can confirm that this build appears to have resolved the problem for me as well.  I'll echo what Caleb said, thanks for the quick help with this!

          James F. added a comment - I can confirm that this build appears to have resolved the problem for me as well.  I'll echo what Caleb said, thanks for the quick help with this!

          Liam Newman added a comment - - edited

          silverorangecalebd
          Thanks for the fast turn around on information and testing. Update released - 2.5.1.

          Liam Newman added a comment - - edited silverorange calebd Thanks for the fast turn around on information and testing. Update released - 2.5.1.

            bitwiseman Liam Newman
            silverorange James F.
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: