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

Unreliable authentication when using the GitHub App credentials

    XMLWordPrintable

Details

    • github-branch-source-2.8.2, github-branch-source-2.9.0

    Description

      github-branch-source-plugin v2.7.1 allows to configure Jenkins as a GitHub App, which

      After upgrading to github-branch-source-plugin v2.7.1, I followed the GitHub app authentication guide to connect Jenkins to GitHub.

      I can successfully clone our repositories using these new credentials most of the time, but I can also observe intermittent authentication failures.

      I have some builds that manage to successfully execute `checkout scm` using the new credentials 10 times in a row, but the 11th time, it fails with:

      using GIT_ASKPASS to set credentials Jenkins as a GitHub App for the my-org organization
       > git fetch --tags --progress -- https://github.com/my-org/my-repo +refs/heads/*:refs/remotes/origin/* # timeout=10
      ERROR: Error fetching remote repo 'origin'
      hudson.plugins.git.GitException: Failed to fetch from https://github.com/my-org/my-repo
      	at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:909)
      	at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1131)
      	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1167)
      	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:125)
      	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:93)
      	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:80)
      	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at java.lang.Thread.run(Thread.java:748)
      Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress -- https://github.com/my-org/my-repo +refs/heads/*:refs/remotes/origin/*" returned status code 128:
      stdout: 
      stderr: 
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2430)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2044)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:81)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:569)
      	at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$GitCommandMasterToSlaveCallable.call(RemoteGitImpl.java:161)
      	at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$GitCommandMasterToSlaveCallable.call(RemoteGitImpl.java:154)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:211)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:54)
      	at hudson.remoting.Request$2.run(Request.java:369)
      	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:117)
      	... 1 more
      

      (I don't have more details)

      Then, subsequent builds fail with a slighly better error:

      using GIT_ASKPASS to set credentials Jenkins as a GitHub App for the my-org organization
       > git fetch --tags --progress -- https://github.com/my-org/my-repo +refs/heads/*:refs/remotes/origin/* # timeout=10
      ERROR: Error fetching remote repo 'origin'
      hudson.plugins.git.GitException: Failed to fetch from https://github.com/my-org/my-repo
      	at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:909)
      	at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1131)
      	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1167)
      	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:125)
      	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:93)
      	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:80)
      	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at java.lang.Thread.run(Thread.java:748)
      Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress -- https://github.com/my-org/my-repo +refs/heads/*:refs/remotes/origin/*" returned status code 128:
      stdout: 
      stderr: remote: Repository not found.
      fatal: Authentication failed for 'https://github.com/my-org/my-repo/'
      
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2430)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2044)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:81)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:569)
      	at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$GitCommandMasterToSlaveCallable.call(RemoteGitImpl.java:161)
      	at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$GitCommandMasterToSlaveCallable.call(RemoteGitImpl.java:154)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:211)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:54)
      	at hudson.remoting.Request$2.run(Request.java:369)
      	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:117)
      	... 1 more
      

      Usually, this lasts until we destroy the Jenkins worker used for this build and create a brand new one.

      There are no changes, either on Jenkins or on GitHub between that 10th build (which was successful) and the subsequent builds (which are failing). It was easily reproducible last week (it was failing after ~5 or 10 builds). I don't have any suspicious logs about these failures anymore.

      Attachments

        Issue Links

          Activity

            multani Jonathan Ballet created issue -
            adrienzieba Adrien Zieba made changes -
            Field Original Value New Value
            Priority Minor [ 4 ] Critical [ 2 ]
            bitwiseman Liam Newman made changes -
            Released As github-branch-source-2.8.2
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Closed [ 6 ]
            brialius Denis Bel made changes -
            Resolution Fixed [ 1 ]
            Status Closed [ 6 ] Reopened [ 4 ]
            bitwiseman Liam Newman made changes -
            Status Reopened [ 4 ] Open [ 1 ]
            bitwiseman Liam Newman made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            bitwiseman Liam Newman made changes -
            Remote Link This issue links to "PR 326 (Web Link)" [ 25707 ]
            bitwiseman Liam Newman made changes -
            Assignee Liam Newman [ bitwiseman ]
            bitwiseman Liam Newman made changes -
            Released As github-branch-source-2.8.2 github-branch-source-2.8.2, github-branch-source-2.9.0
            bitwiseman Liam Newman made changes -
            Resolution Fixed [ 1 ]
            Status In Progress [ 3 ] Closed [ 6 ]
            brialius Denis Bel made changes -
            Attachment github-notfound-1.jpg [ 52569 ]
            brialius Denis Bel made changes -
            Attachment github-notfound-2.png [ 52570 ]
            brialius Denis Bel made changes -
            Attachment github-notfound-3.jpg [ 52571 ]
            brialius Denis Bel made changes -
            Resolution Fixed [ 1 ]
            Status Closed [ 6 ] Reopened [ 4 ]
            bitwiseman Liam Newman made changes -
            Link This issue is duplicated by JENKINS-64911 [ JENKINS-64911 ]
            csanchez Carlos Sanchez made changes -
            Resolution Fixed [ 1 ]
            Status Reopened [ 4 ] Fixed but Unreleased [ 10203 ]
            csanchez Carlos Sanchez made changes -
            Status Fixed but Unreleased [ 10203 ] Closed [ 6 ]

            People

              bitwiseman Liam Newman
              multani Jonathan Ballet
              Votes:
              13 Vote for this issue
              Watchers:
              27 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: