-
Type:
Bug
-
Resolution: Not A Defect
-
Priority:
Major
-
Component/s: github-branch-source-plugin
GitHub branch sources are seems to be unable to test pull requests from private repositories. I've tried it on public repo and it went fine, but for private repo I have similar errors every time:
Branch indexing Connecting to https://api.github.com using okutane/****** Checking out git https://github.com/okutane/jenkinsfile2.git into /var/lib/jenkins/jobs/jenkinsfile-test/branches/PR-1/workspace@script to read Jenkinsfile > git rev-parse --is-inside-work-tree # timeout=10 Fetching changes from the remote Git repository > git config remote.origin.url https://github.com/okutane/jenkinsfile2.git # timeout=10 Fetching without tags Fetching upstream changes from https://github.com/okutane/jenkinsfile2.git > git --version # timeout=10 using GIT_ASKPASS to set credentials > git fetch --no-tags --progress https://github.com/okutane/jenkinsfile2.git +refs/pull/1/head:refs/remotes/origin/PR-1 +refs/heads/master:refs/remotes/origin/master ERROR: Error fetching remote repo 'origin' hudson.plugins.git.GitException: Failed to fetch from https://github.com/okutane/jenkinsfile2.git at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:862) at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1129) at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1160) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:113) at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:143) at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:120) at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:271) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:429) Caused by: hudson.plugins.git.GitException: Command "git fetch --no-tags --progress https://github.com/okutane/jenkinsfile2.git +refs/pull/1/head:refs/remotes/origin/PR-1 +refs/heads/master:refs/remotes/origin/master" returned status code 128: stdout: stderr: error: The requested URL returned error: 403 Forbidden while accessing https://github.com/okutane/jenkinsfile2.git/info/refs fatal: HTTP request failed at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1996) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1715) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:72) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:405) at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:860) ... 8 more ERROR: Error fetching remote repo 'origin' GitHub has been notified of this commit's build result ERROR: Maximum checkout retry attempts reached, aborting Finished: FAILURE
Jenkinsfile is very simple
node {
checkout scm
}
Multibranch job setup is very simple as well: github branch source with default settings and repository creator credentials (user/password)
Your plugin was able to checkout and build PRs for public repositories and GitHub pull request builder plugin is able to checkout and build for both public and private repositories. Also your plugin is able to set branch and PR statuses even it wasn't able to checkout the Jenkinsfile
Â
I've tried to perform git commands on jenkins node manually and yes, result was same as in jenkins (403), but I guess the commands (->plugin) are incorrect, not the environment.
Â