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

Pipeline Github Notify Step plugin fails to set commit status on private organization repo

      I have the following in a declarative pipeline job:

      pipeline {
        agent { label "centos7" }
      
        stages {
          stage("github => pending") {
            steps {
              githubNotify status: "PENDING", description: "Build is starting...", credentialsId: "my-credentials", account: "me", repo: "the-repo"
            }
          }
      
          // ...

      When the job runs, I get the following in the console output:

      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:221)
      	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)

      However, I know that these credentials are definitely valid. In the "Manage Jenkins" page, I can test the credentials via the GitHubPullRequestBuilder plugin, and they work, correspond to a user with read/write permissions on this repo, and can even set commit status (manually, via that other plugin).

      The repo in question is a private repo, and the value for "Account" corresponds to an organization, not an individual user account. I suspect the latter is probably what's going on here, but I don't see any better way to specify the org that owns the repo than with the account: parameter.

       

          [JENKINS-43370] Pipeline Github Notify Step plugin fails to set commit status on private organization repo

          Code changed in jenkins
          User: Markus Heberling
          Path:
          src/main/java/org/jenkinsci/plugins/pipeline/githubstatusnotification/GitHubStatusNotificationStep.java
          src/test/java/org/jenkinsci/plugins/pipeline/githubstatusnotification/GitHubNotificationPipelineStepTest.java
          http://jenkins-ci.org/commit/pipeline-githubnotify-step-plugin/8dc82893abb36a0e99d23d810af06be346d0d41d
          Log:
          JENKINS-43370 Use proxy configuration from Jenkins

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Markus Heberling Path: src/main/java/org/jenkinsci/plugins/pipeline/githubstatusnotification/GitHubStatusNotificationStep.java src/test/java/org/jenkinsci/plugins/pipeline/githubstatusnotification/GitHubNotificationPipelineStepTest.java http://jenkins-ci.org/commit/pipeline-githubnotify-step-plugin/8dc82893abb36a0e99d23d810af06be346d0d41d Log: JENKINS-43370 Use proxy configuration from Jenkins

          Raul Arabaolaza added a comment - - edited

          Thanks a lot tisoft_media for your contribution! Given that you have done the hard work I have assigned the issue to you so when is resolved you will be the one recorded as solver

          PR is already merged and I will cut a new release this afternoon, if anyone can confirm the fix it would be great

          Raul Arabaolaza added a comment - - edited Thanks a lot tisoft_media for your contribution! Given that you have done the hard work I have assigned the issue to you so when is resolved you will be the one recorded as solver PR is already merged and I will cut a new release this afternoon, if anyone can confirm the fix it would be great

          Released as 1.0.3. will give this a pair of days and close the issue if no issues appear

          Raul Arabaolaza added a comment - Released as 1.0.3. will give this a pair of days and close the issue if no issues appear

          No further activity here fro some time, closing

          Raul Arabaolaza added a comment - No further activity here fro some time, closing

          liyatikal added a comment -

          Jenkins 2.73.2/Jenkins 2.89.2

          Pipeline GitHub Notify Step Plugin 1.0.3

          My pipeline command:
          script.githubNotify repo: "https://github.com/xxx/yyy.git", account: "xxx", credentialsId: "jenkins_user_github", sha: "zzzzz}", status: script.currentBuild.currentResult

          Still get this error:
          java.lang.IllegalArgumentException: The suplied credentials are invalid to login
          Please advice

          liyatikal added a comment - Jenkins 2.73.2/Jenkins 2.89.2 Pipeline GitHub Notify Step Plugin 1.0.3 My pipeline command: script.githubNotify repo: "https://github.com/xxx/yyy.git", account: "xxx", credentialsId: "jenkins_user_github", sha: "zzzzz}", status: script.currentBuild.currentResult Still get this error: java.lang.IllegalArgumentException: The suplied credentials are invalid to login Please advice

          Yaniv Ron added a comment -

          Hi,

          The bug still exist and there is no possible way to configure the githubnotifier in an easy way and it's really needed by my team...

          is this going to be fixed? 

           

          Yaniv Ron added a comment - Hi, The bug still exist and there is no possible way to configure the githubnotifier in an easy way and it's really needed by my team... is this going to be fixed?   

          Raul Arabaolaza added a comment - - edited

          Its confirmed that this plugin works with private organizations as I am currently using it in most of my production builds against private repos in an organization.

          You can try a local build of this PR. (Is supposed to fix the proxy support) if that solves your problem  I will merge and release a new version, if not more information will be needed. Like trying to debug the exact git command and try to reproduce in a shell step. 

          Raul Arabaolaza added a comment - - edited Its confirmed that this plugin works with private organizations as I am currently using it in most of my production builds against private repos in an organization. You can try a local build of this PR . (Is supposed to fix the proxy support) if that solves your problem  I will merge and release a new version, if not more information will be needed. Like trying to debug the exact git command and try to reproduce in a shell step. 

          Adam Bennett added a comment -

          I had this problem in multi-branch pipeline when my Jenkins credentials were using my GitHub username and password. The SCM checkout worked, but status check notifications did not. Setting the Jenkins credentials password to a GitHub access token seems to have fixed it.

          Adam Bennett added a comment - I had this problem in multi-branch pipeline when my Jenkins credentials were using my GitHub username and password. The SCM checkout worked, but status check notifications did not. Setting the Jenkins credentials password to a GitHub access token seems to have fixed it.

          Phil Chiu added a comment -

          Hi Adam - thanks! Curious how you got this working.

          Using "Secret Text" credentials I get the following message: "The credentialsId does not seem to exist, please check it

          Using username/password credentials with a user token, I get the following message: "The specified repository does not exist for the specified account"

          Any tips would be appreciated. Thanks!

          Phil Chiu added a comment - Hi Adam - thanks! Curious how you got this working. Using "Secret Text" credentials I get the following message: "The credentialsId does not seem to exist, please check it Using username/password credentials with a user token, I get the following message: "The specified repository does not exist for the specified account" Any tips would be appreciated. Thanks!

          Adam Bennett added a comment -

          Hi whophil!

           

          If I recall correctly, I used username/password credentials, but substituted the GitHub token for my account password. If that is not working for you, I would suggesting confirming the permissions set for the token, as well as permissions for your user account. I'm not sure what exact permissions are required, but this is how I have my access token set:

          I have since stopped using this plugin, and instead use the "GitHub Autostatus Plugin". It reports statuses for each pipeline stage, which is all I was really doing anyway.

          https://wiki.jenkins.io/display/JENKINS/Github+Autostatus+Plugin

           

          I hope this helps!

          Adam Bennett added a comment - Hi whophil !   If I recall correctly, I used username/password credentials, but substituted the GitHub token for my account password. If that is not working for you, I would suggesting confirming the permissions set for the token, as well as permissions for your user account. I'm not sure what exact permissions are required, but this is how I have my access token set: I have since stopped using this plugin, and instead use the "GitHub Autostatus Plugin". It reports statuses for each pipeline stage, which is all I was really doing anyway. https://wiki.jenkins.io/display/JENKINS/Github+Autostatus+Plugin   I hope this helps!

            tisoft_media tisoft_media
            dcrosta Dan Crosta
            Votes:
            6 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated: