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

Github polls fails when the Branches to build is different from empty for private repositories

    • Icon: Bug Bug
    • Resolution: Incomplete
    • Icon: Major Major
    • github-plugin

      No sure if this is as github-plugin issue or if this plugin is relying on some other git API.

      But for private repositories, when I configure the Branches to build - Branch Specifier to anything that is no empty or ** (ie. refs/heads/) , GitHub Hook Log shows the following error and the jobs does not get triggered:

      Started on 16/10/2015 2:11:40 PM
      Using strategy: Default
      [poll] Last Built Revision: Revision 9d1d66939474b01048ec2cdc8c5cd60b7438606d (origin/develop)
      using .gitcredentials to set credentials
       > git --version # timeout=10
       > git init /var/tmp/hudson979795132853035389tmp # timeout=10
       > git config --local credential.username buildboy2 # timeout=10
       > git config --local credential.helper store --file=/var/tmp/git1493121951203369777.credentials # timeout=10
       > git -c core.askpass=true ls-remote -h http://github.mycompamy.com/myorg/myrepo # timeout=10
       > git config --local --remove-section credential # timeout=10
      FATAL: hudson.plugins.git.GitException: Command "git -c core.askpass=true ls-remote -h http://github.mycompamy.com/myorg/myrepo" returned status code 128:
      stdout: 
      stderr: remote: Repository not found.
      fatal: repository 'http://github.mycompamy.com/myorg/myrepo/' not found
      
      hudson.util.IOException2: hudson.plugins.git.GitException: Command "git -c core.askpass=true ls-remote -h http://github.mycompamy.com/myorg/myrepo" returned status code 128:
      stdout: 
      stderr: remote: Repository not found.
      fatal: repository 'http://github.mycompamy.com/myorg/myrepo/' not found
      
      	at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:529)
      	at hudson.scm.SCM.compareRemoteRevisionWith(SCM.java:381)
      	at hudson.scm.SCM.poll(SCM.java:398)
      	at hudson.model.AbstractProject._poll(AbstractProject.java:1454)
      	at hudson.model.AbstractProject.poll(AbstractProject.java:1357)
      	at com.cloudbees.jenkins.GitHubPushTrigger$1.runPolling(GitHubPushTrigger.java:73)
      	at com.cloudbees.jenkins.GitHubPushTrigger$1.run(GitHubPushTrigger.java:99)
      	at hudson.util.SequentialExecutionQueue$QueueEntry.run(SequentialExecutionQueue.java:119)
      	at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
      	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)
      Caused by: hudson.plugins.git.GitException: Command "git -c core.askpass=true ls-remote -h http://github.mycompamy.com/myorg/myrepo" returned status code 128:
      stdout: 
      stderr: remote: Repository not found.
      fatal: repository 'http://github.mycompamy.com/myorg/myrepo/' not found
      
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1640)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1388)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1282)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1273)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.getHeadRev(CliGitAPIImpl.java:2376)
      	at hudson.plugins.git.GitSCM.compareRemoteRevisionWithImpl(GitSCM.java:583)
      	at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:527)
      	... 13 more
      Done. Took 0.17 sec
      No changes
      

      Note1:
      I have tried all the combination described in the help of Branches to build - Branch Specifier

      refs/heads/*
      refs/heads/master
      origin/master
      origin/*
      master
      

      They all come with the same issues.
      If I leave that empty or I set it to ** this starts to work as expected.

      Note2:
      If I leave the branch speccifier set to refs/head/master and I convert my private repo into a public in github this works fine, no error found and the job is triggered correctly

      Please let me know if you need more information

          [JENKINS-30980] Github polls fails when the Branches to build is different from empty for private repositories

          Have you specified right login/password for git scm? Does polling works right without github push trigger, but with poll scm?

          Kanstantsin Shautsou added a comment - Have you specified right login/password for git scm? Does polling works right without github push trigger, but with poll scm?

          Federico Naum added a comment -

          Hi integer,

          Thanks for looking at this.

          Polling behaves the same way with plain poll scm. I does not work with any value in Branches to build - Branch Specifier (i.e master, refs/heads/master, refs/heads/*, origin/master, origin/*) but it works fine with ** or empty
          Does this mean that this is not a problem of the github-plugin but the gith-client-plugin? Should I move it there?

          Regarding the user/pass question, the fact that it works if I have Branches to build - Branch Specifier set to ** and the fact that it can successfully clone the repo inside the job tells me that the login/password is ok. But something to note is that the user/passw that I'm using for the credentials for this private repo is different from the user that I use to start the Jenkins service, so in the Source Code Management job configuration It prints the following error

          Failed to connect to repository : Command "git -c core.askpass=true ls-remote -h http://github.al.com.au/rnd/testSecurity HEAD" returned status code 128:
          stdout: 
          stderr: remote: Repository not found.
          fatal: repository 'http://github.mycompamy.com/myorg/myrepo//' not found
          

          I seems as the git plugin is using the user which started Jenkins for the validation of the repository in the Source Code Management configuration instead of using the credentianl provided in the piece of configuration that is right bellow
          Can you corroborate this of should I ask somewhere else?

          Cheers,
          Fede

          Federico Naum added a comment - Hi integer , Thanks for looking at this. Polling behaves the same way with plain poll scm. I does not work with any value in Branches to build - Branch Specifier (i.e master, refs/heads/master, refs/heads/*, origin/master, origin/*) but it works fine with ** or empty Does this mean that this is not a problem of the github-plugin but the gith-client-plugin ? Should I move it there? Regarding the user/pass question, the fact that it works if I have Branches to build - Branch Specifier set to ** and the fact that it can successfully clone the repo inside the job tells me that the login/password is ok. But something to note is that the user/passw that I'm using for the credentials for this private repo is different from the user that I use to start the Jenkins service, so in the Source Code Management job configuration It prints the following error Failed to connect to repository : Command "git -c core.askpass= true ls-remote -h http: //github.al.com.au/rnd/testSecurity HEAD" returned status code 128: stdout: stderr: remote: Repository not found. fatal: repository 'http: //github.mycompamy.com/myorg/myrepo//' not found I seems as the git plugin is using the user which started Jenkins for the validation of the repository in the Source Code Management configuration instead of using the credentianl provided in the piece of configuration that is right bellow Can you corroborate this of should I ask somewhere else? Cheers, Fede

          Kanstantsin Shautsou added a comment - - edited

          Please disable GitHub pushtrigger, enable "Poll SCM" and ensure that build triggering/checkout works.
          GitHub push trigger is just a simple kicker for git polling algorithm.

          Kanstantsin Shautsou added a comment - - edited Please disable GitHub pushtrigger, enable "Poll SCM" and ensure that build triggering/checkout works. GitHub push trigger is just a simple kicker for git polling algorithm.

          No replies, closing.

          Kanstantsin Shautsou added a comment - No replies, closing.

            integer Kanstantsin Shautsou
            fnaum Federico Naum
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: