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

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

    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
          rarabaolaza Raul Arabaolaza added a comment -

          Hello Dan,

          We are currently using the plugin to notify private repos for an organization using the `account` property without incidents. With your configuration the repo should be at `https://github.com/me/the-repo

          What type of credentials are you using? Username password?

          Have you tried your credentials at the snippet generator? The error that you are getting is usually generated by invalid credentials or lack of permission.

          Are the credentials you are using folder scoped instead of global? If that is the case you may have fall into https://issues.jenkins-ci.org/browse/JENKINS-42955

          Show
          rarabaolaza Raul Arabaolaza added a comment - Hello Dan, We are currently using the plugin to notify private repos for an organization using the `account` property without incidents. With your configuration the repo should be at ` https://github.com/me/the-repo What type of credentials are you using? Username password? Have you tried your credentials at the snippet generator? The error that you are getting is usually generated by invalid credentials or lack of permission. Are the credentials you are using folder scoped instead of global? If that is the case you may have fall into https://issues.jenkins-ci.org/browse/JENKINS-42955
          Hide
          dcrosta Dan Crosta added a comment -

          Here's a screenshot of the snippet generator:

          I've also asked on StackOverflow and one theory there is that there might be special characters that are causing problems here. However, I have verified that our password does not have any special characters. The username does if you count "-" (hyphen) as a special character.

          Show
          dcrosta Dan Crosta added a comment - Here's a screenshot of the snippet generator: I've also asked on StackOverflow  and one theory there is that there might be special characters that are causing problems here. However, I have verified that our password does not have any special characters. The username does if you count "-" (hyphen) as a special character.
          Hide
          dcrosta Dan Crosta added a comment -

          Hi – any update here?

          Show
          dcrosta Dan Crosta added a comment - Hi – any update here?
          Hide
          firedanny Danny added a comment -

          Hello, I encountered the same behavior. We use a private GitHub repo. The credentials are rock solid as I'm using the same in Multi-branch Pipeline plugin which is working.

            stages {
              stage("Stage #1") {
                steps {
                  githubNotify credentialsId: "github_user", repo: 'my-repo', account: "${GITHUB_PR_SOURCE_REPO_OWNER}", sha: "${GITHUB_PR_HEAD_SHA}", description: 'This is an example', status: 'PENDING', targetUrl: 'https://my-jenkins-instance.com'
                }
              }
          

          I've also tried "repo: https://github.com/my-account/my-repo" but that didn't work aswell.

          Show
          firedanny Danny added a comment - Hello, I encountered the same behavior. We use a private GitHub repo. The credentials are rock solid as I'm using the same in Multi-branch Pipeline plugin which is working. stages { stage( "Stage #1" ) { steps { githubNotify credentialsId: "github_user" , repo: 'my-repo' , account: "${GITHUB_PR_SOURCE_REPO_OWNER}" , sha: "${GITHUB_PR_HEAD_SHA}" , description: 'This is an example' , status: 'PENDING' , targetUrl: 'https: //my-jenkins-instance.com' } } I've also tried "repo:  https://github.com/my-account/my-repo " but that didn't work aswell.
          Hide
          rarabaolaza Raul Arabaolaza added a comment -

          So, this seems confirmed but we are still not getting any problem with our private repos when using the plugin.

          Could you please post here any special character the credentials may be using? For example you can get the real credentials and replace all standard characters to preserve anonymity
          Can you try if the plugin works in a multibranch pipeline when using the infer capabilities?

          Just to clarify, the account property refers to the owner of the repo which is receiving the PR, in this case it should be the organization. Danny It seems that as account you are using the owner of the fork, and the SHA is the commit (on the organization's repo) you want to notify, that could be easily found in PR GitHub's UI if you do not want/can`t use the Jenkins variable for it

          Show
          rarabaolaza Raul Arabaolaza added a comment - So, this seems confirmed but we are still not getting any problem with our private repos when using the plugin. Could you please post here any special character the credentials may be using? For example you can get the real credentials and replace all standard characters to preserve anonymity Can you try if the plugin works in a multibranch pipeline when using the infer capabilities? Just to clarify, the account property refers to the owner of the repo which is receiving the PR, in this case it should be the organization. Danny It seems that as account you are using the owner of the fork, and the SHA is the commit (on the organization's repo) you want to notify, that could be easily found in PR GitHub's UI if you do not want/can`t use the Jenkins variable for it
          Hide
          firedanny Danny added a comment -

          Raul Arabaolaza, same error when trying Multi-branch Pipeline.

          I can confirm credentials (user & password) are all flat with no special chars.

          The account is the owner of the repo, repo is set to one of the repos under that account and the SHA is the commit to one of the branches of the same repo. Not a fork.

          Is there a way to enable more verbose debugging?

          Show
          firedanny Danny added a comment - Raul Arabaolaza , same error when trying Multi-branch Pipeline. I can confirm credentials (user & password) are all flat with no special chars. The account is the owner of the repo, repo is set to one of the repos under that account and the SHA is the commit to one of the branches of the same repo. Not a fork. Is there a way to enable more verbose debugging?
          Hide
          dcrosta Dan Crosta added a comment -

          In my case, too, the password and username contain no special characters (there's a hypen in the user name, if that counts). The repo is private, owned by the org, the account property is set to the org name, etc.

          Show
          dcrosta Dan Crosta added a comment - In my case, too, the password and username contain no special characters (there's a hypen in the user name, if that counts). The repo is private, owned by the org, the account property is set to the org name, etc.
          Hide
          fenreer Bruce Bradley added a comment - - edited

          We are experiencing this as well. We have special characters in our password but, as we can see from previous comments left by other users, this is probably inconsequential. We have a private repo with an organization and the credentials are verified to have sufficient privileges to set commit statuses.

          Show
          fenreer Bruce Bradley added a comment - - edited We are experiencing this as well. We have special characters in our password but, as we can see from previous comments left by other users, this is probably inconsequential. We have a private repo with an organization and the credentials are verified to have sufficient privileges to set commit statuses.
          Hide
          rarabaolaza Raul Arabaolaza added a comment -

          Can any of you guys confirm me if this is happening only in the last version or also in the previous?

          Are you using global credentials?

          Sorry for the latency of my responses, I am full of work this week.

          Show
          rarabaolaza Raul Arabaolaza added a comment - Can any of you guys confirm me if this is happening only in the last version or also in the previous? Are you using global credentials? Sorry for the latency of my responses, I am full of work this week.
          Hide
          fenreer Bruce Bradley added a comment -

          Raul Arabaolaza: Our credentials are in the global domain. I was previously on v1.0.1 but have since upgraded to 1.0.2 and the failure still occurs.

          Show
          fenreer Bruce Bradley added a comment - Raul Arabaolaza : Our credentials are in the global domain. I was previously on v1.0.1 but have since upgraded to 1.0.2 and the failure still occurs.
          Hide
          rarabaolaza Raul Arabaolaza added a comment -

          Hu guys, just a quick update, I am having a lot of problems this days and can not find some spare time to dedicate to this (I am doing this development on my spare time). I am afraid I will not be able to do any serious work here until I finish my current Coursera compromises (hope to not take more than 7 or 10 days)

          In the meanwhile you can try to take a look at the code yourselves (is very simple, I promise) or put a step by step instructions on how to reproduce on your environments, I will do the same (when available) if I am unable to reproduce to try to find differences.

           

          I am sorry for the delay  

          Show
          rarabaolaza Raul Arabaolaza added a comment - Hu guys, just a quick update, I am having a lot of problems this days and can not find some spare time to dedicate to this (I am doing this development on my spare time). I am afraid I will not be able to do any serious work here until I finish my current Coursera compromises (hope to not take more than 7 or 10 days) In the meanwhile you can try to take a look at the code yourselves (is very simple, I promise) or put a step by step instructions on how to reproduce on your environments, I will do the same (when available) if I am unable to reproduce to try to find differences.   I am sorry for the delay  
          Hide
          firedanny Danny added a comment -

          Seems like there's an easy workaround,

          I just used 'gitApiUrl' which worked for me in Multi-branch Pipeline job in Jenkinsfile

          githubNotify gitApiUrl: 'https://api.github.com', context: 'Notification key', description: 'This is a shorted example',  status: 'PENDING'
          

          Dan Crosta, Bruce Bradley - Can you confirm this?

           

          Show
          firedanny Danny added a comment - Seems like there's an easy workaround, I just used 'gitApiUrl' which worked for me in Multi-branch Pipeline job in Jenkinsfile githubNotify gitApiUrl: 'https: //api.github.com' , context: 'Notification key' , description: 'This is a shorted example' ,  status: 'PENDING' Dan Crosta , Bruce Bradley - Can you confirm this?  
          Hide
          morlajb2 mor lajb added a comment -

          HI  ,
          I got the same error ..
          is there a previous release that works ?
          Thanks , Mor

          Show
          morlajb2 mor lajb added a comment - HI  , I got the same error .. is there a previous release that works ? Thanks , Mor
          Hide
          xyuri Yuri Kanivetsky added a comment - - edited

          If you want to check if you can do it with curl:

          #!/usr/bin/env bash 
          set -eu 
          user=...
          repo=...
          commit=7c...d2   # 40 character SHA1
          token=83...53   # for oauth
          domain=https://api.github.com 
          
          oauth() { 
              curl -sSH "Authorization: token $token" "$@"
          } 
          basic() { 
              curl -sSu $user "$@" 
          }
          
          # create a status
          basic -d '{"state":"success"}' $domain/repos/$user/$repo/statuses/$commit
          
          # list statuses
          basic $domain/repos/$user/$repo/commits/$commit/statuses
          
          

          From my experiments, you must be owner of the repo. Or else you can't even list statuses. Admin rights won't cut it.

          https://developer.github.com/v3/repos/statuses/#create-a-status

          This way it works for my own repository:

          node {
              githubNotify account: '...', credentialsId: 'f0...18', description: 'test desc', repo: '...', sha: '8b...05', status: 'PENDING', gitApiUrl: 'https://api.github.com'
          }
          Show
          xyuri Yuri Kanivetsky added a comment - - edited If you want to check if you can do it with curl: #!/usr/bin/env bash set -eu user=... repo=... commit=7c...d2 # 40 character SHA1 token=83...53 # for oauth domain=https: //api.github.com oauth() { curl -sSH "Authorization: token $token" "$@" } basic() { curl -sSu $user "$@" } # create a status basic -d '{ "state" : "success" }' $domain/repos/$user/$repo/statuses/$commit # list statuses basic $domain/repos/$user/$repo/commits/$commit/statuses From my experiments, you must be owner of the repo. Or else you can't even list statuses. Admin rights won't cut it. https://developer.github.com/v3/repos/statuses/#create-a-status This way it works for my own repository: node { githubNotify account: '...' , credentialsId: 'f0...18' , description: 'test desc' , repo: '...' , sha: '8b...05' , status: 'PENDING' , gitApiUrl: 'https: //api.github.com' }
          Hide
          rarabaolaza Raul Arabaolaza added a comment -

          The documentation mentions push access, I have it working with a non owner user...

          Show
          rarabaolaza Raul Arabaolaza added a comment - The documentation mentions push access, I have it working with a non owner user...
          Hide
          xyuri Yuri Kanivetsky added a comment - - edited

          Raul Arabaolaza, and the owner of the repository is user or organization account? In my case it's organization.

          Show
          xyuri Yuri Kanivetsky added a comment - - edited Raul Arabaolaza , and the owner of the repository is user or organization account? In my case it's organization.
          Hide
          rarabaolaza Raul Arabaolaza added a comment -

          Yuri Kanivetsky An organization in my case also... A test case or a step by step guide would be great, I still believe there is something wrong with the confs. I know people using this without problems.

          Show
          rarabaolaza Raul Arabaolaza added a comment - Yuri Kanivetsky An organization in my case also... A test case or a step by step guide would be great, I still believe there is something wrong with the confs. I know people using this without problems.
          Hide
          xyuri Yuri Kanivetsky added a comment -

          Raul Arabaolaza Check if the script from comment-304806 works for you. Make sure to specify your user, repo and commit before running it. It fails when I try to run it against any of three organizations I have access to. I have at least push access to corresponding private repositories. And am using my personal account. But for my own repository it succeeds.

          Maybe it has to do with some organization settings. Nothing better comes to mind.

          Show
          xyuri Yuri Kanivetsky added a comment - Raul Arabaolaza Check if the script from comment-304806 works for you. Make sure to specify your user, repo and commit before running it. It fails when I try to run it against any of three organizations I have access to. I have at least push access to corresponding private repositories. And am using my personal account. But for my own repository it succeeds. Maybe it has to do with some organization settings. Nothing better comes to mind.
          Hide
          xyuri Yuri Kanivetsky added a comment -

          My bad, it didn't occur to me that account (owner of the repo) might be different from user in credentials. Here's the revised version of my script:

          #!/usr/bin/env bash
          set -eu
          user=...
          owner=...
          repo=...
          commit=31...4e   # 40 character SHA1
          token=20...78   # for oauth
          domain=https://api.github.com
          
          oauth() {
              curl -sSH "Authorization: token $token" "$@"
          }
          basic() {
              curl -sSu $user "$@"
          }
          basic -d '{"state":"success","description":"test desc","context":"test context"}' $domain/repos/$owner/$repo/statuses/$commit
          basic $domain/repos/$owner/$repo/commits/$commit/statuses
          

          This way it works for me.

          Show
          xyuri Yuri Kanivetsky added a comment - My bad, it didn't occur to me that account (owner of the repo) might be different from user in credentials. Here's the revised version of my script: #!/usr/bin/env bash set -eu user=... owner=... repo=... commit=31...4e # 40 character SHA1 token=20...78 # for oauth domain=https: //api.github.com oauth() { curl -sSH "Authorization: token $token" "$@" } basic() { curl -sSu $user "$@" } basic -d '{ "state" : "success" , "description" : "test desc" , "context" : "test context" }' $domain/repos/$owner/$repo/statuses/$commit basic $domain/repos/$owner/$repo/commits/$commit/statuses This way it works for me.
          Hide
          tisoft_media tisoft_media added a comment -

          I have the same error displayed in the build log, but in the jenkins.log I see the real error:

           

          Aug 04, 2017 10:58:34 AM org.kohsuke.github.Requester parse
          INFO: timed out accessing https://github.XXX.YYY.net/api/v3/user; will try 2 more time(s)
          java.net.SocketTimeoutException: connect timed out
          at java.net.PlainSocketImpl.socketConnect(Native Method)
          at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
          at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
          at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
          at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
          at java.net.Socket.connect(Socket.java:589)
          at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:673)
          at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
          at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
          at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
          at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
          at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
          at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
          at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1138)
          at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032)
          at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
          at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1546)
          at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
          at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
          at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338)
          at org.kohsuke.github.Requester.parse(Requester.java:592)
          at org.kohsuke.github.Requester.parse(Requester.java:584)
          at org.kohsuke.github.Requester._to(Requester.java:264)
          at org.kohsuke.github.Requester.to(Requester.java:226)
          at org.kohsuke.github.GitHub.isCredentialValid(GitHub.java:635)
          at org.jenkinsci.plugins.pipeline.githubstatusnotification.GitHubStatusNotificationStep.getGitHubIfValid(GitHubStatusNotificationStep.java:233)
          at org.jenkinsci.plugins.pipeline.githubstatusnotification.GitHubStatusNotificationStep.getRepoIfValid(GitHubStatusNotificationStep.java:241)
          at org.jenkinsci.plugins.pipeline.githubstatusnotification.GitHubStatusNotificationStep.access$100(GitHubStatusNotificationStep.java:77)
          at org.jenkinsci.plugins.pipeline.githubstatusnotification.GitHubStatusNotificationStep$Execution.run(GitHubStatusNotificationStep.java:346)
          at org.jenkinsci.plugins.pipeline.githubstatusnotification.GitHubStatusNotificationStep$Execution.run(GitHubStatusNotificationStep.java:328)
          at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
          at hudson.security.ACL.impersonate(ACL.java:260)
          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:1149)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
          at java.lang.Thread.run(Thread.java:748)
          
          Aug 04, 2017 10:58:34 AM org.kohsuke.github.Requester parse
          INFO: timed out accessing https://github.XXX.YYY.net/api/v3/user; will try 1 more time(s)
          java.net.SocketTimeoutException: connect timed out
          at sun.reflect.GeneratedConstructorAccessor151.newInstance(Unknown Source)
          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
          at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
          at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1926)
          at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1921)
          at java.security.AccessController.doPrivileged(Native Method)
          at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1920)
          at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1490)
          at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
          at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
          at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338)
          at org.kohsuke.github.Requester.parse(Requester.java:592)
          at org.kohsuke.github.Requester.parse(Requester.java:620)
          at org.kohsuke.github.Requester.parse(Requester.java:584)
          at org.kohsuke.github.Requester._to(Requester.java:264)
          at org.kohsuke.github.Requester.to(Requester.java:226)
          at org.kohsuke.github.GitHub.isCredentialValid(GitHub.java:635)
          at org.jenkinsci.plugins.pipeline.githubstatusnotification.GitHubStatusNotificationStep.getGitHubIfValid(GitHubStatusNotificationStep.java:233)
          at org.jenkinsci.plugins.pipeline.githubstatusnotification.GitHubStatusNotificationStep.getRepoIfValid(GitHubStatusNotificationStep.java:241)
          at org.jenkinsci.plugins.pipeline.githubstatusnotification.GitHubStatusNotificationStep.access$100(GitHubStatusNotificationStep.java:77)
          at org.jenkinsci.plugins.pipeline.githubstatusnotification.GitHubStatusNotificationStep$Execution.run(GitHubStatusNotificationStep.java:346)
          at org.jenkinsci.plugins.pipeline.githubstatusnotification.GitHubStatusNotificationStep$Execution.run(GitHubStatusNotificationStep.java:328)
          at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
          at hudson.security.ACL.impersonate(ACL.java:260)
          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:1149)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
          at java.lang.Thread.run(Thread.java:748)
          Caused by: java.net.SocketTimeoutException: connect timed out
          at java.net.PlainSocketImpl.socketConnect(Native Method)
          at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
          at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
          at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
          at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
          at java.net.Socket.connect(Socket.java:589)
          at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:673)
          at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
          at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
          at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
          at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
          at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
          at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
          at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1138)
          at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032)
          at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
          at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1546)
          at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
          at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
          at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338)
          at org.kohsuke.github.Requester.parse(Requester.java:592)
          ... 17 more
          
          

          So the root cause for me, is that it can't reach the server. The problem is, that we need to use a proxy to reach the server, but the pugin seems to not use the proxy, that is configured in jenkins.

          Show
          tisoft_media tisoft_media added a comment - I have the same error displayed in the build log, but in the jenkins.log I see the real error:   Aug 04, 2017 10:58:34 AM org.kohsuke.github.Requester parse INFO: timed out accessing https://github.XXX.YYY.net/api/v3/user; will try 2 more time(s) java.net.SocketTimeoutException: connect timed out at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:673) at sun.net.NetworkClient.doConnect(NetworkClient.java:175) at sun.net.www.http.HttpClient.openServer(HttpClient.java:463) at sun.net.www.http.HttpClient.openServer(HttpClient.java:558) at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264) at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191) at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1138) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177) at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1546) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474) at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338) at org.kohsuke.github.Requester.parse(Requester.java:592) at org.kohsuke.github.Requester.parse(Requester.java:584) at org.kohsuke.github.Requester._to(Requester.java:264) at org.kohsuke.github.Requester.to(Requester.java:226) at org.kohsuke.github.GitHub.isCredentialValid(GitHub.java:635) at org.jenkinsci.plugins.pipeline.githubstatusnotification.GitHubStatusNotificationStep.getGitHubIfValid(GitHubStatusNotificationStep.java:233) at org.jenkinsci.plugins.pipeline.githubstatusnotification.GitHubStatusNotificationStep.getRepoIfValid(GitHubStatusNotificationStep.java:241) at org.jenkinsci.plugins.pipeline.githubstatusnotification.GitHubStatusNotificationStep.access$100(GitHubStatusNotificationStep.java:77) at org.jenkinsci.plugins.pipeline.githubstatusnotification.GitHubStatusNotificationStep$Execution.run(GitHubStatusNotificationStep.java:346) at org.jenkinsci.plugins.pipeline.githubstatusnotification.GitHubStatusNotificationStep$Execution.run(GitHubStatusNotificationStep.java:328) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47) at hudson.security.ACL.impersonate(ACL.java:260) 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:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Aug 04, 2017 10:58:34 AM org.kohsuke.github.Requester parse INFO: timed out accessing https://github.XXX.YYY.net/api/v3/user; will try 1 more time(s) java.net.SocketTimeoutException: connect timed out at sun.reflect.GeneratedConstructorAccessor151.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1926) at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1921) at java.security.AccessController.doPrivileged(Native Method) at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1920) at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1490) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474) at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338) at org.kohsuke.github.Requester.parse(Requester.java:592) at org.kohsuke.github.Requester.parse(Requester.java:620) at org.kohsuke.github.Requester.parse(Requester.java:584) at org.kohsuke.github.Requester._to(Requester.java:264) at org.kohsuke.github.Requester.to(Requester.java:226) at org.kohsuke.github.GitHub.isCredentialValid(GitHub.java:635) at org.jenkinsci.plugins.pipeline.githubstatusnotification.GitHubStatusNotificationStep.getGitHubIfValid(GitHubStatusNotificationStep.java:233) at org.jenkinsci.plugins.pipeline.githubstatusnotification.GitHubStatusNotificationStep.getRepoIfValid(GitHubStatusNotificationStep.java:241) at org.jenkinsci.plugins.pipeline.githubstatusnotification.GitHubStatusNotificationStep.access$100(GitHubStatusNotificationStep.java:77) at org.jenkinsci.plugins.pipeline.githubstatusnotification.GitHubStatusNotificationStep$Execution.run(GitHubStatusNotificationStep.java:346) at org.jenkinsci.plugins.pipeline.githubstatusnotification.GitHubStatusNotificationStep$Execution.run(GitHubStatusNotificationStep.java:328) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47) at hudson.security.ACL.impersonate(ACL.java:260) 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:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.net.SocketTimeoutException: connect timed out at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:673) at sun.net.NetworkClient.doConnect(NetworkClient.java:175) at sun.net.www.http.HttpClient.openServer(HttpClient.java:463) at sun.net.www.http.HttpClient.openServer(HttpClient.java:558) at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264) at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191) at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1138) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177) at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1546) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474) at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338) at org.kohsuke.github.Requester.parse(Requester.java:592) ... 17 more So the root cause for me, is that it can't reach the server. The problem is, that we need to use a proxy to reach the server, but the pugin seems to not use the proxy, that is configured in jenkins.
          Hide
          rarabaolaza Raul Arabaolaza added a comment -

          That makes perfect sense, I can confirm there is no proxy code on the plugin... Anyone more is under a proxy?

          Show
          rarabaolaza Raul Arabaolaza added a comment - That makes perfect sense, I can confirm there is no proxy code on the plugin... Anyone more is under a proxy?
          Hide
          tisoft_media tisoft_media added a comment -

          I have added proxy support. If you want to try it out, I have attached a verion of the plugin, that uses the defined jenkins proxy.

          pipeline-githubnotify-step.hpi

           

          Show
          tisoft_media tisoft_media added a comment - I have added proxy support . If you want to try it out, I have attached a verion of the plugin, that uses the defined jenkins proxy. pipeline-githubnotify-step.hpi  
          Hide
          scm_issue_link 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

          Show
          scm_issue_link 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
          Hide
          rarabaolaza 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

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

          Show
          rarabaolaza 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
          Hide
          rarabaolaza Raul Arabaolaza added a comment -

          No further activity here fro some time, closing

          Show
          rarabaolaza Raul Arabaolaza added a comment - No further activity here fro some time, closing
          Hide
          liyatikal 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

          Show
          liyatikal 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
          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:
              14 Start watching this issue

              Dates

              • Created:
                Updated: