Hi,
We are currently hosting a Jenkins master in our work environment and are in the process of configuring a GitHub multibranch pipeline in Jenkins.
The Git client plugin is used for checking out the repository, and it uses the proxy configured in Jenkins by default:
Setting http proxy: xx.xxx.xx.xxx:8080
The Jenkins file is written to run the job on a specific agent located on Azure (internet), and this agent does not require a proxy to connect to GitHub. However, since the Git client plugin is configured to use the proxy present in Jenkins, and the agent doesn't require a proxy to check out the repository, the job is failing with a connection timeout. Please see the console output below for reference.
Started by user Samy C V Manoj
Replayed #16
Connecting to https://github.********cloud.com/api/v3 using 572/***** (app)*
Obtained Jenkinsfile from 1d45eb75d0b833931000f78302010dfd507fd414
[Pipeline] Start of Pipeline
[Pipeline] node
Running on testing in /tmp/workspace/test-github_JMaaS_test_main
[Pipeline] {
[Pipeline] stage
*[Pipeline]
{ (Declarative: Checkout SCM)*
*[Pipeline] checkout*
*The recommended git tool is: NONE*
*using credential github-app-*****
*Fetching changes from the remote Git repository*
*Fetching without tags*
*> git rev-parse --resolve-git-dir /tmp/workspace/test-github_JMaaS_test_main/.git # timeout=10*
*> git config remote.origin.url https://github.********cloud.com/api/v3 # timeout=10*
*Fetching upstream changes from https://github.********cloud.com/api/v3*
*> git --version # timeout=10*
*> git --version # 'git version 2.34.1'*
*using GIT_ASKPASS to set credentials app*
*Setting http proxy: xx.xxx.xx.xxx:8080*
*> git fetch --no-tags --force --progress -- https://github.********cloud.com/****/*****_test.git +refs/heads/main:refs/remotes/origin/main # timeout=10*
*ERROR: Error fetching remote repo 'origin'*
*hudson.plugins.git.GitException: Failed to fetch from https://github.********cloud.com/****/*****_test.git*
*at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:999)*
*at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1241)*
*at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1305)*
*at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:136)*
*at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:101)*
*at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:88)*
*at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)*
*at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)*
*at java.base/java.util.concurrent.FutureTask.run(Unknown Source)*
*at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)*
*at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)*
*at java.base/java.lang.Thread.run(Unknown Source)*
*Caused by: hudson.plugins.git.GitException: Command "git fetch --no-tags --force --progress -- https://github.********cloud.com/****/*****_test.git +refs/heads/main:refs/remotes/origin/main" returned status code 128:*
*stdout:*
*stderr: fatal: unable to access 'https://github.********cloud.com/****/*****_test.git': Failed to connect to xx.xxx.xx.xxx port 8080 after 130251 ms: Connection timed out*
*at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2846)*
*at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2185)*
*at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:635)*
*at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$GitCommandMasterToSlaveCallable.call(RemoteGitImpl.java:170)*
*at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$GitCommandMasterToSlaveCallable.call(RemoteGitImpl.java:161)*
*at hudson.remoting.UserRequest.perform(UserRequest.java:211)*
*at hudson.remoting.UserRequest.perform(UserRequest.java:54)*
*at hudson.remoting.Request$2.run(Request.java:377)*
*at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)*
*at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)*
*at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)*
*at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)*
*at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:137)*
*at java.base/java.lang.Thread.run(Thread.java:829)*
*Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to testing*
*at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1787)*
*at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:356)*
*at hudson.remoting.Channel.call(Channel.java:1003)*
*at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:153)*
*at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)*
*at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)*
*at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)*
*at java.base/java.lang.reflect.Method.invoke(Unknown Source)*
*at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:138)*
*at com.sun.proxy.$Proxy189.execute(Unknown Source)*
*at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:997)*
*at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1241)*
*at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1305)*
*at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:136)*
*at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:101)*
*at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:88)*
*at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)*
*at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)*
*at java.base/java.util.concurrent.FutureTask.run(Unknown Source)*
*at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)*
*at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)*
*at java.base/java.lang.Thread.run(Unknown Source)*
*ERROR: Error fetching remote repo 'origin'*
*ERROR: Maximum checkout retry attempts reached, aborting*
*[Pipeline] }
*
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: Error fetching remote repo 'origin'
GitHub has been notified of this commit's build result
Finished: FAILURE
We cannot configure github.*.com in no_proxy because the initial checkout of the Jenkins file needs a proxy. The proxy is only not needed on agent machines. Kindly provide an option to bypass the proxy based on our requirement. For example, a bypass proxy option similar to the one present in Artifactory. Since the plugin is performing the checkout, we are not able to disable it with environment variables or in the pipeline itself