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

credentialsId doesn't appear to work with github enterprise

    Details

    • Similar Issues:

      Description

      I have been trying out the Pipeline Githubnotify Step Plugin as part of notifying pull requests to a repo in a GitHub Enterprise environment.  If I do not specify the credentialsId then the plugin reports back to GitHub Enterprise fine. But the following is reported at the end of the pipeline job processing:

      java.lang.IllegalArgumentException: The suplied credentials are invalid to login

      at org.jenkinsci.plugins.pipeline.githubstatusnotification.GitHubStatusNotificationStep.getGitHubIfValid(GitHubStatusNotificationStep.java:234)

      at org.jenkinsci.plugins.pipeline.githubstatusnotification.GitHubStatusNotificationStep.getRepoIfValid(GitHubStatusNotificationStep.java:239)

      at org.jenkinsci.plugins.pipeline.githubstatusnotification.GitHubStatusNotificationStep.access$100(GitHubStatusNotificationStep.java:75)

      at org.jenkinsci.plugins.pipeline.githubstatusnotification.GitHubStatusNotificationStep$Execution.run(GitHubStatusNotificationStep.java:344)

      at org.jenkinsci.plugins.pipeline.githubstatusnotification.GitHubStatusNotificationStep$Execution.run(GitHubStatusNotificationStep.java:326)

      at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)

      at hudson.security.ACL.impersonate(ACL.java:213)

      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

       

      If I specify credentialsId in the Jenkinsfile for githubNotify then the same error is reported on the initial call to githubNotify.  I checked the connection using these credentials on the pipeline-syntax githubNotify sample step and it reports that the suplied credentials are invalid.  However, these credentials are not invalid as I have tested them on our GutHub Enterprise environment.  What I think may be happening is that the plugin is defaulting to checking the credentials against GitHub rather than GitHub Enterprise when the API Endpoint is supplied?

        Attachments

          Activity

          Hide
          raul_arabaolaza Raul Arabaolaza added a comment -

          Seems strange, unit tests seem to pass and I can not find anything in the code to justify that the plugin is not making the request to standard GitHub instead of the enterprise version.

          simon Wall Can you please copy here the exact pipeline code you used? What type of credentials are you using? (I assume username/password)

          What I am going to try is to use a http sniffer to really check the requests

          Show
          raul_arabaolaza Raul Arabaolaza added a comment - Seems strange, unit tests seem to pass and I can not find anything in the code to justify that the plugin is not making the request to standard GitHub instead of the enterprise version. simon Wall Can you please copy here the exact pipeline code you used? What type of credentials are you using? (I assume username/password) What I am going to try is to use a http sniffer to really check the requests
          Hide
          sw97272 simon Wall added a comment -

          Hi Raul Arabaolaza,

           

          The below works fine, (its coming from a webhook from GitHub Enterprise, so some of the values are inferred):

                githubNotify context: 'USE1 OAD Ansible-1.9.2',

                  description: 'Testing',

                  gitApiUrl: 'https://git.illumina.com/api/v3/',

                  status: 'PENDING'

           

          This fails:

                githubNotify context: 'USE1 OAD Ansible-1.9.2',

                  credentialsId: 'svc-jenkins-us-e-userpass',

                  description: 'Testing',

                  gitApiUrl: 'https://git.illumina.com/api/v3/',

                  status: 'PENDING'

          Yes, the credentials being used are username/password and I can confirm that they have access to the repository passed in the webhook.

           

           

          Show
          sw97272 simon Wall added a comment - Hi Raul Arabaolaza ,   The below works fine, (its coming from a webhook from GitHub Enterprise, so some of the values are inferred):       githubNotify context: 'USE1 OAD Ansible-1.9.2',         description: 'Testing',         gitApiUrl: 'https://git.illumina.com/api/v3/',         status: 'PENDING'   This fails:       githubNotify context: 'USE1 OAD Ansible-1.9.2',         credentialsId: 'svc-jenkins-us-e-userpass',         description: 'Testing',         gitApiUrl: 'https://git.illumina.com/api/v3/',         status: 'PENDING' Yes, the credentials being used are username/password and I can confirm that they have access to the repository passed in the webhook.    
          Hide
          raul_arabaolaza Raul Arabaolaza added a comment - - edited

          simon Wall Stupid question... but given that the infer of credentials work... Do the 'svc-jenkins-us-e-userpass' credentials have all needed rights to create statuses?

          And another question... Does the credentials contain a username/password or a username/access token?

          Show
          raul_arabaolaza Raul Arabaolaza added a comment - - edited simon Wall Stupid question... but given that the infer of credentials work... Do the 'svc-jenkins-us-e-userpass' credentials have all needed rights to create statuses? And another question... Does the credentials contain a username/password or a username/access token?
          Hide
          sw97272 simon Wall added a comment -

          Hi Raul,

          I have found the cause of the issue.  It was user error.  The username I was using had a typo in the Jenkins credentials.  Apologies for the wasted effort to try and troubleshoot what I thought was an issue with the plugin.  I have tested out using the credentialsId and it is reporting the status back to GitHub Enterprise fine.

           

          Many thanks for all your help on this and thanks once again for this really useful plugin.  

          Show
          sw97272 simon Wall added a comment - Hi Raul, I have found the cause of the issue.  It was user error.  The username I was using had a typo in the Jenkins credentials.  Apologies for the wasted effort to try and troubleshoot what I thought was an issue with the plugin.  I have tested out using the credentialsId and it is reporting the status back to GitHub Enterprise fine.   Many thanks for all your help on this and thanks once again for this really useful plugin.  
          Hide
          raul_arabaolaza Raul Arabaolaza added a comment -

          simon Wall Great! Thanks for using the plugin and reporting bugs, feel free to do it again anytime you feel necessary

          Show
          raul_arabaolaza Raul Arabaolaza added a comment - simon Wall Great! Thanks for using the plugin and reporting bugs, feel free to do it again anytime you feel necessary

            People

            • Assignee:
              rarabaolaza Raul Arabaolaza
              Reporter:
              sw97272 simon Wall
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: