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

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

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      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.

       

        Attachments

          Activity

          Hide
          yanivr78 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? 

           

          Show
          yanivr78 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?   
          Hide
          rarabaolaza 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. 

          Show
          rarabaolaza 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. 
          Hide
          adamrbennett 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.

          Show
          adamrbennett 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.
          Hide
          whophil 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!

          Show
          whophil 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!
          Hide
          adamrbennett Adam Bennett added a comment -

          Hi Phil Chiu!

           

          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!

          Show
          adamrbennett Adam Bennett added a comment - Hi Phil Chiu !   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!

            People

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

              Dates

              • Created:
                Updated: