• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • Jenkins ver. 2.144
      GitHub Authentication plugin 0.29
      GitHub Branch Source Plugin 2.4.1
      GitHub API Plugin 1.92
      GitHub plugin 1.29.3

      Hi!

      I noticed that a job which based on some GitHub tag become broken after re-tag (deleting of the tag on GitHub, creation of a GitHub tag with the same name).
      After this related builds falls with messages like this:

      Started by user Some User
      06:27:03 Connecting to https://api.github.com using some-user/****** (Jenkins Global credentials)
      java.io.FileNotFoundException: https://api.github.com/repos/Organization/repository/git/refs/tags/some-tag
      	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:617)
      	at org.kohsuke.github.Requester.parse(Requester.java:599)
      	at org.kohsuke.github.Requester._to(Requester.java:277)
      Caused: org.kohsuke.github.GHFileNotFoundException: {"message":"Not Found","documentation_url":"https://developer.github.com/v3/git/refs/#get-a-reference"}
      	at org.kohsuke.github.Requester.handleApiError(Requester.java:691)
      	at org.kohsuke.github.Requester._to(Requester.java:298)
      	at org.kohsuke.github.Requester.to(Requester.java:239)
      	at org.kohsuke.github.GHRepository.getRef(GHRepository.java:870)
      	at org.jenkinsci.plugins.github_branch_source.GitHubSCMSource.retrieve(GitHubSCMSource.java:1457)
      	at jenkins.scm.api.SCMSource.fetch(SCMSource.java:583)
      	at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:95)
      	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:303)
      	at hudson.model.ResourceController.execute(ResourceController.java:97)
      	at hudson.model.Executor.run(Executor.java:429)
      Finished: FAILURE
      

      At the same time I'm able to retrieve tag's SHA from mentioned GitHub API URI using the same credentials. So it looks like github_branch_source_plugin specific issue.

      "Scan Repository Now" doesn't help here. The job for recreated tag still will be failed even if previously I confirmed that the tag had been deleted in Jenkins UI after deleting in GitHub and then successfully created in Jenkins after creation in GitHub.

      Any jobs that related to tags which were created only one time works fine.

      Steps to reproduce:

      • "New Item" -> "GitHub Organization";
      • For a repo in GitHub organization create a tag which will bring a job in Jenkins;
      • Delete the tag in GitHub;
      • Create a tag with the same name as deleted;
      • Trigger related Jenkins job.

          [JENKINS-54403] Job fail when GitHub tag was recreated

          Cam Allen added a comment -

          I'm seeing the same issue described above. Deleting and adding a new tag causes a failure to fetch the ref (cached) from github.

          Cam Allen added a comment - I'm seeing the same issue described above. Deleting and adding a new tag causes a failure to fetch the ref (cached) from github.

          Cam Allen added a comment -

          Removing the cache file for the corresponding tag ref from the  'org.jenkinsci.plugins.github_branch_source.GitHubSCMProbe.cache' directory allows the job to run again.

          In my case the 404 response from github was cached in the offending cache file before removing, after re-running the job it contains a 200 response encrypted body by the look. I'm not sure how it pulls the ref out of this response, maybe it doesn't. 

          Manually cleaning up the cache file is not an ideal solution, hopefully this can help with a fix.

          Cam Allen added a comment - Removing the cache file for the corresponding tag ref from the  'org.jenkinsci.plugins.github_branch_source.GitHubSCMProbe.cache' directory allows the job to run again. In my case the 404 response from github was cached in the offending cache file before removing, after re-running the job it contains a 200 response encrypted body by the look. I'm not sure how it pulls the ref out of this response, maybe it doesn't.  Manually cleaning up the cache file is not an ideal solution, hopefully this can help with a fix.

          Yo-An Lin added a comment -

          Yo-An Lin added a comment - Pull request for fixing this issue https://github.com/jenkinsci/github-branch-source-plugin/pull/197

          Liam Newman added a comment -

          camallen, c9s

          Could you try the patched version of the github-branch-source-plugin linked in the description of https://issues.jenkins-ci.org/browse/JENKINS-57411 ? 

          I'm wondering if perhaps the using a more recent version of okhttp3 will address these issues with the cache. 

           

           

          Liam Newman added a comment - camallen , c9s Could you try the patched version of the github-branch-source-plugin linked in the description of  https://issues.jenkins-ci.org/browse/JENKINS-57411  ?  I'm wondering if perhaps the using a more recent version of okhttp3 will address these issues with the cache.     

          Thanks camallen for the suggested fix! Clearing the cache directory indeed allowed jenkins to start building for that re-created tag.
          I am on github-branch-source-plugin rel. 2.5.8

          Sokratis Galiatsis added a comment - Thanks camallen for the suggested fix! Clearing the cache directory indeed allowed jenkins to start building for that re-created tag. I am on github-branch-source-plugin rel. 2.5.8

          Liam Newman added a comment -

          This should be fixed by github-api-plugin release v1.102.

          Liam Newman added a comment - This should be fixed by github-api-plugin release v1.102.

            Unassigned Unassigned
            nshchipachevaf Nikita Shchipachev
            Votes:
            6 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:
              Resolved: