Jenkins with Bitbucket always timeouts

1,201 views
Skip to first unread message

Bhavnik

unread,
Jan 21, 2017, 4:00:42 PM1/21/17
to Jenkins Users
Hello,

I am planning to use Jenkins for one of our requirements. The source code is located on Bitbucket. Here are the main steps that I did to setup build server. Note that we have Windows 2012 R2 edition, where this build server is being setup.
Installed Java 8 
Installed Git - Version 2.11.0.windows.3
Installed Jenkins - Version 2.32.1
After login into Jenkins, Git path is set as "E:\Programs\Git\cmd\Git.exe". (This setting is done at Manage Jenkins → Global Tool Configuration)
We are using 'Freestyle project' in Jenkins. The project is configured to use Git as SCM (in Source Code Management section). The repository url is set to correct bitbucket private repository. Note that we are using https here (not ssh). The credentials are provided from 'Jenkins Credential Provider'.
Now, if I run the build then somehow all the time I get timeout error. Note that I have tried using different Git version (one in Git\cmd folder and one in Git\bin folder, but no luck)

The console/error log is:

Started by user gituser
Building in workspace E:\Programs\Jenkins\workspace\myproject\production
Cloning the remote Git repository
Using shallow clone
Avoid fetching tags
 > E:\Programs\Git\cmd\git.exe init E:\Programs\Jenkins\workspace\myproject\Production # timeout=10
 > E:\Programs\Git\cmd\git.exe --version # timeout=10
using GIT_ASKPASS to set credentials Bitbucket
 > E:\Programs\Git\cmd\git.exe fetch --no-tags --progress https://git...@bitbucket.org/myproject/myprojectrepo.git +refs/heads/*:refs/remotes/origin/* --depth=1 # timeout=30
ERROR: Timeout after 30 minutes
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Command "E:\Programs\Git\cmd\git.exe fetch --no-tags --progress https://git...@bitbucket.org/myproject/myprojectrepo.git +refs/heads/*:refs/remotes/origin/* --depth=1" returned status code -1:
stdout: 
stderr: 
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1784)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1513)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:64)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:315)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:512)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1054)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1094)
at hudson.scm.SCM.checkout(SCM.java:495)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1278)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
at hudson.model.Run.execute(Run.java:1728)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:404)
ERROR: null
Finished: FAILURE

In above error, there is "returned status code -1" - I am not sure what it is.

I also tried increasing timeout to 1 hour but still didn't work. 

The command to fetch repo works from direct command line (and gets the objects in less than 5 minutes). 

Surprisingly if I provide wrong credentials in Jenkins credential manager for this operation then also same error keeps on appearing. 

I am not sure what to do next now.... please please help to fix this. I am really looking for solution here.

Thanks in advance,
Bhavnik

Stephen Connolly

unread,
Jan 21, 2017, 4:25:00 PM1/21/17
to jenkins...@googlegroups.com
Are your credentials a ssh key *with a passphrase*?

If yes, try an ssh key without a passphrase. There is an known issue in how the git plugin uses credentials that only shows up for ssh keys *with a passphrase*

--


You received this message because you are subscribed to the Google Groups "Jenkins Users" group.


To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.


To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/75835f48-767f-4939-bc39-9c4373065766%40googlegroups.com.


For more options, visit https://groups.google.com/d/optout.


--
Sent from my phone

Mark Waite

unread,
Jan 21, 2017, 5:20:02 PM1/21/17
to jenkins...@googlegroups.com
Please confirm that you're using a username / password based credential.  Username / password credentials are required when using https.

If you're using a username / password credential, confirm that you're using the most recent version of the git client plugin (2.2.1), since it includes a fix for cases where the password contains characters which require specific quoting when referenced from a Windows batch file.  Refer to JENKINS-40166, JENKINS-38194, JENKINS-38179, and JENKINS-38138 for examples of use models that can be affected by the bug that is fixed in git client plugin 2.2.1.

If neither of those work, you might consider switching from https with a username / password credential to ssh with private key credential.  Both should work, and both do work with bitbucket in the test automation that I run regularly, so that shouldn't be necessary, but it is an alternative if needed.

Mark Waite

Bhavnik Gajjar

unread,
Jan 22, 2017, 3:45:54 PM1/22/17
to jenkins...@googlegroups.com
Hi Mark and Stephen,

Thanks for your replies. 

Yes, I am using a username / password credential.

I checked the Git client version and it is running the latest one (2.2.1). I also tried with just normal alphabetic and numeric passwords for https authentication on bitbucket. This still didn't work. Timeout still occurs.

Somehow I got to know that there is also another option available for Git. And that is, JGit . I tried that and it worked! The source code checked out in less than 5 minutes. I will proceed with this now.

The original problem with https and Git timeouts (with JGit usage) is still an issue which is a mystery. If someone has solution to the problem then I would love know it and implement accordingly in my environment.

Thanks,
Bhavnik

On Sat, Jan 21, 2017 at 11:19 PM, Mark Waite <mark.ea...@gmail.com> wrote:
Please confirm that you're using a username / password based credential.  Username / password credentials are required when using https.

If you're using a username / password credential, confirm that you're using the most recent version of the git client plugin (2.2.1), since it includes a fix for cases where the password contains characters which require specific quoting when referenced from a Windows batch file.  Refer to JENKINS-40166, JENKINS-38194, JENKINS-38179, and JENKINS-38138 for examples of use models that can be affected by the bug that is fixed in git client plugin 2.2.1.

If neither of those work, you might consider switching from https with a username / password credential to ssh with private key credential.  Both should work, and both do work with bitbucket in the test automation that I run regularly, so that shouldn't be necessary, but it is an alternative if needed.

Mark Waite

To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
--
Sent from my phone

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-users/PZZA8nphNY0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtFnc_zNapbprJwZCPTEh6C1--_VWr5Jcn17SdExjoT6jg%40mail.gmail.com.

Bhavnik Gajjar

unread,
Jan 22, 2017, 3:53:25 PM1/22/17
to jenkins...@googlegroups.com
Ah, Typo....Please read  - The original problem with https and Git timeouts (without JGit usage) is still an issue which is a mystery....If someone has solution to the problem then I would love know it and implement accordingly in my environment.

张则昊

unread,
Jan 23, 2017, 4:49:21 AM1/23/17
to Jenkins Users
I believe this is a regression issue, I have two Jenkins server, one works well with git-client v2.0.0 but another has the same issue with v2.2.1.

在 2017年1月23日星期一 UTC+8上午4:53:25,Bhavnik写道:
Ah, Typo....Please read  - The original problem with https and Git timeouts (without JGit usage) is still an issue which is a mystery....If someone has solution to the problem then I would love know it and implement accordingly in my environment.
On Sun, Jan 22, 2017 at 9:45 PM, Bhavnik Gajjar <bhavn...@gmail.com> wrote:
Hi Mark and Stephen,

Thanks for your replies. 

Yes, I am using a username / password credential.

I checked the Git client version and it is running the latest one (2.2.1). I also tried with just normal alphabetic and numeric passwords for https authentication on bitbucket. This still didn't work. Timeout still occurs.

Somehow I got to know that there is also another option available for Git. And that is, JGit . I tried that and it worked! The source code checked out in less than 5 minutes. I will proceed with this now.

The original problem with https and Git timeouts (with JGit usage) is still an issue which is a mystery. If someone has solution to the problem then I would love know it and implement accordingly in my environment.

Thanks,
Bhavnik
On Sat, Jan 21, 2017 at 11:19 PM, Mark Waite <mark.ea...@gmail.com> wrote:
Please confirm that you're using a username / password based credential.  Username / password credentials are required when using https.

If you're using a username / password credential, confirm that you're using the most recent version of the git client plugin (2.2.1), since it includes a fix for cases where the password contains characters which require specific quoting when referenced from a Windows batch file.  Refer to JENKINS-40166, JENKINS-38194, JENKINS-38179, and JENKINS-38138 for examples of use models that can be affected by the bug that is fixed in git client plugin 2.2.1.

If neither of those work, you might consider switching from https with a username / password credential to ssh with private key credential.  Both should work, and both do work with bitbucket in the test automation that I run regularly, so that shouldn't be necessary, but it is an alternative if needed.

Mark Waite

To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
--
Sent from my phone

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-users/PZZA8nphNY0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-use...@googlegroups.com.

张则昊

unread,
Jan 23, 2017, 5:03:16 AM1/23/17
to Jenkins Users
BTW, the workaround is use username:password style url.

在 2017年1月23日星期一 UTC+8下午5:49:21,张则昊写道:

Mark Waite

unread,
Jan 23, 2017, 8:57:06 AM1/23/17
to Jenkins Users
Can you provide more details about the conditions that are different between the working and the failing cases?  I'm not aware of a regression in that particular area between git client plugin 2.0.0 and git client plugin 2.2.1.

Mark Waite

Reply all
Reply to author
Forward
0 new messages