-
Bug
-
Resolution: Unresolved
-
Major
-
None
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.
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.