Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Cannot access bitbucket from local Jenkins

Options
  • 26-06-2016 6:30pm
    #1
    Registered Users Posts: 81,223 ✭✭✭✭


    I am setting up a new Jenkins and for some reason I can't access bitbucket from new Jenkins when I build

    Jenkins git credentials are correct, double-checked

    From Jenkins console:
    > git.exe -c core.askpass=true fetch --tags --progress https://bitbucket.org/<>/header_checks.git
    +refs/heads/*:refs/remotes/origin/*

    spinner.gif

    Then eventually I get timeout

    ERROR: Timeout after 10 minutes
    > git.exe config --local --remove-section credential # timeout=10
    ERROR: Error fetching remote repo 'origin'
    hudson.plugins.git.GitException: Failed to fetch from https://bitbucket.org/<>/header_checks.git
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:766)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1022)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1053)
    at hudson.scm.SCM.checkout(SCM.java:485)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1269)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:607)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
    at hudson.model.Run.execute(Run.java:1738)
    at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:531)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:410)
    Caused by: hudson.plugins.git.GitException: Command "git.exe -c core.askpass=true fetch --tags --progress
    https://bitbucket.org/<>/header_checks.git +refs/heads/*:refs/remotes/origin/*" returned status code -1:
    stdout:
    stderr:


Comments

  • Registered Users Posts: 772 ✭✭✭maki


    I had awful trouble recently getting git and Jenkins to play nicely together and I think that was one of the errors I was getting. What fixed it for me in the end was to use JGit (Configure System, Add git -> JGit) instead of a local git install.


  • Registered Users Posts: 2,018 ✭✭✭Colonel Panic


    The Git command line in the log has got core.askpass=true.

    Would that make Git wait for user input that never comes or is Jenkins supposed to pass the password?

    I've only ever used keys w/Jenkins myself Maybe do that? Does it work with a local directory-based repository?


  • Registered Users Posts: 768 ✭✭✭14ned


    biko wrote: »
    I am setting up a new Jenkins and for some reason I can't access bitbucket from new Jenkins when I build

    I've set up a LOT of git on Jenkins installs over the years.

    You will save yourself an enormous amount of time and hassle if very first thing you do is you log in as the jenkins user and manually do a git pull from your selected git provider from the command line. Click through all of the various verifications and permissions grants etc. Make sure it runs a second time without prompting.

    Your problems should now go away.

    If you have problems running the stuff by hand, it's worth checking these:

    1. Are you using a git which isn't msysgit? Dragons abound if so.

    2. Have you turned on long paths support in git? Jenkins regularly exceeds the 260 char path limit, so you need to hack long path support into the global git config file.

    3. Try a git provider other than bitbucket for testing e.g. github.

    4. Check that the PATH Jenkins sets hasn't messed up the PATH used by msysgit to find its components. Use a simple script of 'set' to display all your environment variables.

    5. Worst comes to worst, there is nothing stopping you placing the git pull at the front of the build script and writing some batch to bail out if nothing has changed. I had to deal with a shonky git server with terrible connectivity some years ago, and the old git versions used to corrupt themselves on Windows so I wrapped up the pull process into a self healing Jenkins job, then used the folder monitor trigger plugin to launch jobs only if the git repo changed. NTFS hard links and junction points are the key to doing atomic swaps of the "correct" edition of a git repo. Recents gits no longer corrupt the repo on connection death thankfully, there have been some really great reliability fixes on Windows in recent years, it should now all just work.

    Niall


  • Registered Users Posts: 81,223 ✭✭✭✭biko


    Sound guys, I'll try the suggestions when I get time over the week and report back.


  • Registered Users Posts: 81,223 ✭✭✭✭biko


    It's the company firewall settings.
    Everything runs fine outside the FW but I'm blocked from inside.
    At least it's not my code so silver lining kinda...


  • Advertisement
Advertisement