I have a Jenkins pipeline that uses a multi-branch checkout, which fails with a timeout. But it behaves strangely, I run it 1, 2, 3 times, it fails due to timeout, and when I run it a 4th time, it builds as expected! I changed nothing! And it works.
That behavior repeats from time to time, and I don't know why!
I have done my research, and a lot of sites suspects it's because the git repo is to big, and should be divided, or a reference git should be implemented, or something similar, but what I would like to do is to increase that timeout time for the multi-branch pipeline, or something that does not involve changing the git repo.
The error looks like this:
Branch event
> git rev-parse --resolve-git-dir /jenkins/caches/git-11fbb0fa1c741d374583d815b5e7d2b5/.git # timeout=10
Setting origin to ssh://git@bitbucket.************************.git
> git config remote.origin.url ssh://git@bitbucket.************************.git # timeout=10
Fetching & pruning origin...
Listing remote references...
> git config --get remote.origin.url # timeout=10
> git --version # timeout=10
> git --version # 'git version 2.38.1'
using GIT_SSH to set credentials
[INFO] Currently running in a labeled security context
[INFO] Currently SELinux is 'enforcing' on the host
> git /usr/bin/chcon --type=ssh_home_t /jenkins/caches/git-11fbb0fa1c741d374583d815b5e7d2b5@tmp/jenkins-gitclient-ssh26913564976769998938.key
[WARNING] Failed (1) performing chcon helper command for SELinux: git /usr/bin/chcon --type=ssh_home_t /jenkins/caches/git-11fbb0fa1c741d374583d815b5e7d2b5@tmp/jenkins-gitclient-ssh26913564976769998938.key:
=== STDERR:
/usr/bin/chcon: failed to change context of ‘/jenkins/caches/git-11fbb0fa1c741d374583d815b5e7d2b5@tmp/jenkins-gitclient-ssh26913564976769998938.key’ to ‘system_u:object_r:ssh_home_t:s0’: Operation not supported
====
IMPACT: if SELinux is enabled, access to temporary key file may be denied for git+ssh below
> git ls-remote -h -- ssh://git@bitbucket.*******************.git # timeout=10
Fetching upstream changes from origin
> git config --get remote.origin.url # timeout=10
using GIT_SSH to set credentials
[INFO] Currently running in a labeled security context
[INFO] Currently SELinux is 'enforcing' on the host
> git /usr/bin/chcon --type=ssh_home_t /jenkins/caches/git-11fbb0fa1c741d374583d815b5e7d2b5@tmp/jenkins-gitclient-ssh6058345916396068771.key
[WARNING] Failed (1) performing chcon helper command for SELinux: git /usr/bin/chcon --type=ssh_home_t /jenkins/caches/git-11fbb0fa1c741d374583d815b5e7d2b5@tmp/jenkins-gitclient-ssh6058345916396068771.key:
=== STDERR:
/usr/bin/chcon: failed to change context of ‘/jenkins/caches/git-11fbb0fa1c741d374583d815b5e7d2b5@tmp/jenkins-gitclient-ssh6058345916396068771.key’ to ‘system_u:object_r:ssh_home_t:s0’: Operation not supported
====
IMPACT: if SELinux is enabled, access to temporary key file may be denied for git+ssh below
> git fetch --tags --force --progress --prune -- origin +refs/heads/*:refs/remotes/origin/* # timeout=10
Checking branches...
Checking branch SBrn_update_PROD.XML
Met criteria
Processed 3 branches (query complete)
java.net.SocketTimeoutException: timeout
at okhttp3.internal.http2.Http2Stream$StreamTimeout.newTimeoutException(Http2Stream.java:662)
at okhttp3.internal.http2.Http2Stream$StreamTimeout.exitAndThrowIfTimedOut(Http2Stream.java:670)
at okhttp3.internal.http2.Http2Stream.takeHeaders(Http2Stream.java:154)
at okhttp3.internal.http2.Http2ExchangeCodec.readResponseHeaders(Http2ExchangeCodec.java:136)
at okhttp3.internal.connection.Exchange.readResponseHeaders(Exchange.java:115)
at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:94)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:43)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:94)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:88)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at com.atlassian.bitbucket.jenkins.internal.http.HttpRequestExecutorImpl$UserAgentInterceptor.intercept(HttpRequestExecutorImpl.java:160)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:221)
at okhttp3.RealCall.execute(RealCall.java:81)
at com.atlassian.bitbucket.jenkins.internal.http.HttpRequestExecutorImpl.executeRequest(HttpRequestExecutorImpl.java:73)
Caused: com.atlassian.bitbucket.jenkins.internal.client.exception.ConnectionFailureException: - response: -1
at com.atlassian.bitbucket.jenkins.internal.http.HttpRequestExecutorImpl.executeRequest(HttpRequestExecutorImpl.java:85)
at com.atlassian.bitbucket.jenkins.internal.http.HttpRequestExecutorImpl.executeGet(HttpRequestExecutorImpl.java:50)
at com.atlassian.bitbucket.jenkins.internal.client.BitbucketRequestExecutor.makeGetRequest(BitbucketRequestExecutor.java:161)
at com.atlassian.bitbucket.jenkins.internal.client.BitbucketRequestExecutor.makeGetRequest(BitbucketRequestExecutor.java:105)
at com.atlassian.bitbucket.jenkins.internal.client.BitbucketFilePathClientImpl.getFileContent(BitbucketFilePathClientImpl.java:55)
at com.atlassian.bitbucket.jenkins.internal.scm.filesystem.BitbucketSCMFile.content(BitbucketSCMFile.java:83)
at jenkins.scm.api.SCMFile.contentAsString(SCMFile.java:335)
at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:109)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:309)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Finished: FAILURE