Details

    • Similar Issues:

      Description

      Unfortunately the stacktrace and error message is not very verbose.

      java.lang.IllegalArgumentException: The suplied 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: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)
      Finished: FAILURE
      

      The line in question https://github.com/jenkinsci/pipeline-githubnotify-step-plugin/blob/master/src/main/java/org/jenkinsci/plugins/pipeline/githubstatusnotification/GitHubStatusNotificationStep.java#L263

        Attachments

          Activity

          Hide
          rarabaolaza Raul Arabaolaza added a comment -

          Hello Michael,

          Thank you for taking the time to report issues, I would like to check some things regarding this issue:

          • Have you tried to make a REST API call to github to check the credentials?
          • Are you accessing to GitHub.com or to a Githhub enterprise?
          • Do you have a proxy somewhere in your infra?
          Show
          rarabaolaza Raul Arabaolaza added a comment - Hello Michael, Thank you for taking the time to report issues, I would like to check some things regarding this issue: Have you tried to make a REST API call to github to check the credentials? Are you accessing to GitHub.com or to a Githhub enterprise? Do you have a proxy somewhere in your infra? If so you may be suffering JENKINS-43370
          Hide
          michael_mohemian Michael Rogger added a comment - - edited

          Thanks for your fast response Raul Arabaolaza!

          • We are not using a proxy
          • We do not use Github enterprise
          • Setting the status with REST works
          curl -X POST \
          https://api.github.com/repos/our_organisation/our_repository/statuses/879a441228a2f174f1e6d77271cf3f6b2b59be83 \
          -H 'authorization: Basic ****' \
          -H 'cache-control: no-cache' \
          -H 'content-type: application/json' \
          -d '{
          "state": "success",
          "description": "The build succeeded!",
          "context": "continuous-integration/jenkins"
          }'
          

          Is there an easy way to get more verbose output (HTTP)?

          Show
          michael_mohemian Michael Rogger added a comment - - edited Thanks for your fast response  Raul Arabaolaza ! We are not using a proxy We do not use Github enterprise Setting the status with REST works curl -X POST \ https: //api.github.com/repos/our_organisation/our_repository/statuses/879a441228a2f174f1e6d77271cf3f6b2b59be83 \ -H 'authorization: Basic ****' \ -H 'cache-control: no-cache' \ -H 'content-type: application/json' \ -d '{ "state" : "success" , "description" : "The build succeeded!" , "context" : "continuous-integration/jenkins" }' Is there an easy way to get more verbose output (HTTP)?
          Hide
          michael_mohemian Michael Rogger added a comment -

          In case anyone else has the same problem, I am using this simple groovy method as a poor man's alternative: 

          /**
           * Set the status for a github commit.
           * @param status pending, success, error, failure
           */
          def githubStatus(token, repository, sha, context, status) {
          
            organisation = 'your_organisation'
          
            // https://developer.github.com/v3/repos/statuses/
            sh "curl -X POST https://api.github.com/repos/" + organisation + "/" + repository + "/statuses/" + sha + " \\\n" +
                "  -H 'Authorization: token " + token + "' \\\n" +
                "  -H 'cache-control: no-cache' \\\n" +
                "  -H 'content-type: application/json' \\\n" +
                "  -d '{\n" +
                "  \"state\": \"" + status + "\",\n" +
                "  \"context\": \"" + context + "\"\n" +
                "}'"
          }
          
          
          

          Token: create a private access token https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/. You only need the permission repo:status

           

          I am using it with pipeline script like this:

          node {
            stage("build") {
          
              withCredentials([[$class: 'StringBinding', credentialsId: 'credentials_id_with_api_token', variable: 'GITHUB_API_TOKEN']]) {
          
                def scmVars = checkout scm
                githubStatus(GITHUB_API_TOKEN, 'repository_name', scmVars.GIT_COMMIT, 'jenkins', 'pending')
          
                try {
                  echo "building something..."
                } catch (Error e) {
                  githubStatus(GITHUB_API_TOKEN, 'repository_name', scmVars.GIT_COMMIT, 'jenkins', 'failure')
                  throw e
                }
          
                githubStatus(GITHUB_API_TOKEN, 'repository_name', scmVars.GIT_COMMIT, 'jenkins', 'success')
              }
            }
          }
          

           

          Show
          michael_mohemian Michael Rogger added a comment - In case anyone else has the same problem, I am using this simple groovy method as a poor man's alternative:  /** * Set the status for a github commit. * @param status pending, success, error, failure */ def githubStatus(token, repository, sha, context, status) { organisation = 'your_organisation' // https://developer.github.com/v3/repos/statuses/ sh "curl -X POST https: //api.github.com/repos/" + organisation + "/" + repository + "/statuses/" + sha + " \\\n" + " -H 'Authorization: token " + token + "' \\\n" + " -H 'cache-control: no-cache' \\\n" + " -H 'content-type: application/json' \\\n" + " -d '{\n" + " \" state\ ": \" " + status + " \ ",\n" + " \" context\ ": \" " + context + " \ "\n" + "}'" } Token:  create a private access token https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/ . You only need the permission repo:status   I am using it with pipeline script like this: node { stage( "build" ) { withCredentials([[$class: 'StringBinding' , credentialsId: 'credentials_id_with_api_token' , variable: 'GITHUB_API_TOKEN' ]]) { def scmVars = checkout scm githubStatus(GITHUB_API_TOKEN, 'repository_name' , scmVars.GIT_COMMIT, 'jenkins' , 'pending' ) try { echo "building something..." } catch (Error e) { githubStatus(GITHUB_API_TOKEN, 'repository_name' , scmVars.GIT_COMMIT, 'jenkins' , 'failure' ) throw e } githubStatus(GITHUB_API_TOKEN, 'repository_name' , scmVars.GIT_COMMIT, 'jenkins' , 'success' ) } } }  
          Hide
          rarabaolaza Raul Arabaolaza added a comment -

          Hello Michael Rogger

          Can you paste the pipeline code that you are using?

          Does your credentials contain the token or the password for the user?

          You are describing the base use case of the plugin and I have production system with it working, that is the reason of so many questions

          Show
          rarabaolaza Raul Arabaolaza added a comment - Hello Michael Rogger Can you paste the pipeline code that you are using? Does your credentials contain the token or the password for the user? You are describing the base use case of the plugin and I have production system with it working, that is the reason of so many questions

            People

            • Assignee:
              rarabaolaza Raul Arabaolaza
              Reporter:
              michael_mohemian Michael Rogger
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: