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

plugin reporting error "java.lang.IllegalArgumentException: The supplied credentials are invalid to login" on latest version

      Using the following pipeline code:

      githubNotify context: "Ansible-${ansVersion}",
        credentialsId: 'generic-credentials-id',
        description: 'Testing',
        gitApiUrl: 'https://git.illumina.com/api/v3/',
        status: 'PENDING'

      works fine with version 1.0.1 of the plugin.  However, using the latest version, (1.0.4) fails to build the pipeline, with exactly the same code and then reports the following when attempting to notify back to github again

      java.lang.IllegalArgumentException: The supplied credentials are invalid to login
      	at org.jenkinsci.plugins.pipeline.githubstatusnotification.GitHubStatusNotificationStep.getGitHubIfValid(GitHubStatusNotificationStep.java:263)
      	at org.jenkinsci.plugins.pipeline.githubstatusnotification.GitHubStatusNotificationStep.getRepoIfValid(GitHubStatusNotificationStep.java:268)
      	at org.jenkinsci.plugins.pipeline.githubstatusnotification.GitHubStatusNotificationStep.access$100(GitHubStatusNotificationStep.java:79)
      	at org.jenkinsci.plugins.pipeline.githubstatusnotification.GitHubStatusNotificationStep$Execution.run(GitHubStatusNotificationStep.java:373)
      	at org.jenkinsci.plugins.pipeline.githubstatusnotification.GitHubStatusNotificationStep$Execution.run(GitHubStatusNotificationStep.java:355)
      	at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
      	at hudson.security.ACL.impersonate(ACL.java:290)
      	at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
      	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:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at java.lang.Thread.run(Thread.java:745)
      Finished: FAILURE
      
      

      From what I can see, there has been no update to the documentation on what is required syntax wise for this plugin to work with GitHub Enterprise.

          [JENKINS-51021] plugin reporting error "java.lang.IllegalArgumentException: The supplied credentials are invalid to login" on latest version

          David Loomer added a comment - - edited

          Looks like 1.04 is requiring a very specific type of credential where the Password field is an OAuth token. It calls the withOathToken method of GitHubBuilder.java:

          https://github.com/kohsuke/github-api/blob/master/src/main/java/org/kohsuke/github/GitHubBuilder.java#L175

          If it's an actual password, it won't work.

          Version 1.01 merely called GitHub.connectToEnterprise() which doesn't appear to be so prescriptive as to whether the password is an actual password or an OAuth token.

          Anyway, I was having this same issue, then switched to a different credential that was set up with a token rather than password in the Password field, and I'm back in business.

          David Loomer added a comment - - edited Looks like 1.04 is requiring a very specific type of credential where the Password field is an OAuth token. It calls the withOathToken method of GitHubBuilder.java: https://github.com/kohsuke/github-api/blob/master/src/main/java/org/kohsuke/github/GitHubBuilder.java#L175 If it's an actual password, it won't work. Version 1.01 merely called GitHub.connectToEnterprise() which doesn't appear to be so prescriptive as to whether the password is an actual password or an OAuth token. Anyway, I was having this same issue, then switched to a different credential that was set up with a token rather than password in the Password field, and I'm back in business.

          simon Wall added a comment -

          Thanks dloomer, changing the password to a personal access token has resolved the issue.  rarabaolaza, could the documentation for this plugin please be updated to state that the password in the Username andPassword credentialsId should be a personal access token rather than the user's actual password?

          simon Wall added a comment - Thanks dloomer , changing the password to a personal access token has resolved the issue.  rarabaolaza , could the documentation for this plugin please be updated to state that the password in the Username andPassword credentialsId should be a personal access token rather than the user's actual password?

          Actually that is standard GitHub behaviour, nothing related to the plugin itself. Depending on you access configuration you may need the password or the access token, the plugin does not diferentiate between them it just yses it as is...

          The inline help says password or access token but I can easily update the readme also.

          Raul Arabaolaza added a comment - Actually that is standard GitHub behaviour, nothing related to the plugin itself. Depending on you access configuration you may need the password or the access token, the plugin does not diferentiate between them it just yses it as is... The inline help says password or access token but I can easily update the readme also.

          README updated, sw97272 Is better now?

          Raul Arabaolaza added a comment - README updated, sw97272 Is better now?

          David Loomer added a comment -

          I'm not so sure about that explanation rarabaolaza but I may be mistaken. First, the plugin code has definitely changed from 1.01 to 1.04: It used to call "GitHub.connectToEnterprise()" which I believe followed whatever configuration is set up for access, but now it calls "githubBuilder.withOAuthToken()". Second, I believe that latter method means that only a token will work now:

           

          https://github.com/jenkinsci/pipeline-githubnotify-step-plugin/blob/pipeline-githubnotify-step-1.0.4/src/main/java/org/jenkinsci/plugins/pipeline/githubstatusnotification/GitHubStatusNotificationStep.java#L249

          David Loomer added a comment - I'm not so sure about that explanation rarabaolaza but I may be mistaken. First, the plugin code has definitely changed from 1.01 to 1.04: It used to call "GitHub.connectToEnterprise()" which I believe followed whatever configuration is set up for access, but now it calls "githubBuilder.withOAuthToken()". Second, I believe that latter method means that only a token will work now:   https://github.com/jenkinsci/pipeline-githubnotify-step-plugin/blob/pipeline-githubnotify-step-1.0.4/src/main/java/org/jenkinsci/plugins/pipeline/githubstatusnotification/GitHubStatusNotificationStep.java#L249

          simon Wall added a comment - - edited

          I'm not sure if this is due to standard GutHub behaviour.  As dloomer has highlighted, the behaviour in the plugin has changed between versions.  Using the older version, I can authenticate with the same gitHub Enterprise server using username and password, but with version 1.0.4 I only have success with an access token.

          It may be that there is also a relation to the version of GitHub enterprise that is running on the GH end, but there is definitely changes made in this plugin that causes the user's password to no longer be accepted.

          simon Wall added a comment - - edited I'm not sure if this is due to standard GutHub behaviour.  As dloomer has highlighted, the behaviour in the plugin has changed between versions.  Using the older version, I can authenticate with the same gitHub Enterprise server using username and password, but with version 1.0.4 I only have success with an access token. It may be that there is also a relation to the version of GitHub enterprise that is running on the GH end, but there is definitely changes made in this plugin that causes the user's password to no longer be accepted.

          Shelly Feng added a comment -

          After upgrading  pipeline-githubnotify-step-plugin  to 1.0.4, githubNotify failed with username and token.
          https://github.com/jenkinsci/pipeline-githubnotify-step-plugin/commit/8dc82893abb36a0e99d23d810af06be346d0d41d#diff-13a86041066b2e5ecb5a5e73b7173c26R234
          The latest enhancement of proxy most likely breaks our githutNotify since we have both proxy and no proxy configuration in jenkins. The latest feature forces  jenkins.proxy.createProxy though it is for an internal website which does not require proxy at all. 

          Shelly Feng added a comment - After upgrading  pipeline-githubnotify-step-plugin  to 1.0.4, githubNotify failed with username and token. https://github.com/jenkinsci/pipeline-githubnotify-step-plugin/commit/8dc82893abb36a0e99d23d810af06be346d0d41d#diff-13a86041066b2e5ecb5a5e73b7173c26R234 The latest enhancement of proxy most likely breaks our githutNotify since we have both proxy and no proxy configuration in jenkins. The latest feature forces  jenkins.proxy.createProxy though it is for an internal website which does not require proxy at all. 

          Sorry guys, I plan to dedicate some time this weekend, will try to fix this ASAP

          Raul Arabaolaza added a comment - Sorry guys, I plan to dedicate some time this weekend, will try to fix this ASAP

          I have the same issue, the plugin doesn't work with my enterprise instance in v1.0.4. However, v1.0.2 is working fine.

          Christopher Fenner added a comment - I have the same issue, the plugin doesn't work with my enterprise instance in v1.0.4. However, v1.0.2 is working fine.

            rarabaolaza Raul Arabaolaza
            sw97272 simon Wall
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: