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

credentials invalid only in githubNotify

XMLWordPrintable

      I have a GitHub organisation set up with the GitHub Branch Source Plugin and had configured a given GitHub user in the credentials configuration for the organisation.

      I then created a declarative pipeline for one of the projects in the GitHub organisation that has been working for a long time now which included calls to githubNotify and that was all working fine also.

      I then had to change the GitHub credentials in the organisation to a different user.  That change, in and of itself has been successful as the organisation scan continues to work and PRs are built and even the final pipeline status is posted to the PR using the newly configured GitHub account/credential (as can be seen using the https://api.github.com/repos/:owner/:repo/commits/:ref/statuses URL).

      What doesn't seem to be working any more is the githubNotify call in my pipeline(s).  They are producing:

      Sep 27, 2018 4:08:32 PM org.jenkinsci.plugins.github.internal.GitHubLoginFunction applyNullSafe
      WARNING: Failed to login with creds 
      org.kohsuke.github.GHFileNotFoundException: {"message":"Bad credentials","documentation_url":"https://developer.github.com/v3"}
      	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.GitHub.getMyself(GitHub.java:383)
      	at org.kohsuke.github.GitHub.<init>(GitHub.java:157)
      	at org.kohsuke.github.GitHubBuilder.build(GitHubBuilder.java:207)
      	at org.jenkinsci.plugins.github.internal.GitHubLoginFunction.applyNullSafe(GitHubLoginFunction.java:73)
      	at org.jenkinsci.plugins.github.internal.GitHubLoginFunction.applyNullSafe(GitHubLoginFunction.java:46)
      	at org.jenkinsci.plugins.github.util.misc.NullSafeFunction.apply(NullSafeFunction.java:18)
      	at org.jenkinsci.plugins.github.config.GitHubServerConfig$ClientCacheFunction.applyNullSafe(GitHubServerConfig.java:420)
      	at org.jenkinsci.plugins.github.config.GitHubServerConfig$ClientCacheFunction.applyNullSafe(GitHubServerConfig.java:416)
      	at org.jenkinsci.plugins.github.util.misc.NullSafeFunction.apply(NullSafeFunction.java:18)
      	at com.google.common.collect.Iterators$8.next(Iterators.java:812)
      	at com.google.common.collect.Iterators$7.computeNext(Iterators.java:648)
      	at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143)
      	at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138)
      	at com.google.common.collect.Iterators$8.hasNext(Iterators.java:807)
      	at com.google.common.collect.Iterators$7.computeNext(Iterators.java:647)
      	at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143)
      	at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138)
      	at com.google.common.collect.Iterators$5.hasNext(Iterators.java:543)
      	at com.google.common.collect.Lists.newArrayList(Lists.java:138)
      	at com.google.common.collect.Lists.newArrayList(Lists.java:119)
      	at org.jenkinsci.plugins.github.util.FluentIterableWrapper.toList(FluentIterableWrapper.java:147)
      	at org.jenkinsci.plugins.github.status.sources.ManuallyEnteredRepositorySource.repos(ManuallyEnteredRepositorySource.java:51)
      	at org.jenkinsci.plugins.github.status.GitHubCommitStatusSetter.perform(GitHubCommitStatusSetter.java:136)
      	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:80)
      	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:67)
      	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1$1.call(SynchronousNonBlockingStepExecution.java:50)
      	at hudson.security.ACL.impersonate(ACL.java:290)
      	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1.run(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: java.io.FileNotFoundException: https://api.github.com/user
      	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)
      	... 34 more
      

      Is this a case of something didn't get changed completely when I changed the credentials of the organisation?

      In addition to the fact that the final pipeline commit status gets updated to GitHub correctly, I can post status successfully using curl and the new credentials, so the credentials are correct and GitHub is allowing the user to post status.

            rarabaolaza Raul Arabaolaza
            brianjmurrell Brian J Murrell
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: