1

I'm relatively new to Jenkins, and have been working on a pipeline that triggers a build on each push to our bitbucket server. We had a master and a slave. Recently it became clear that some of the dependencies for our build would not be easy to fulfill on the slave (windows 2012 server). I know the proper solution would be doing something with docker, but I'm not familiar enough with it yet, and I thought the fast workaround would just be to run a jenkins slave node from my workstation, where I know i have all the dependencies fulfilled and then do a proper job with docker later.

I have the new problem that when the job is distributed to my workstation, i get the following error log:

using GIT_ASKPASS to set credentials credential_name (credential_label)
Setting http proxy: proxy.proxy.blah
 > C:\Program Files\Git\cmd\git.exe fetch --tags --force --progress -- <http address> +refs/heads/*:refs/remotes/repo_name/* # timeout=10
ERROR: Error fetching remote repo 'repo_name'
hudson.plugins.git.GitException: Failed to fetch from <http_address>
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:909)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1131)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1167)
    at com.atlassian.bitbucket.jenkins.internal.scm.BitbucketSCM.checkout(BitbucketSCM.java:203)
    at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:124)
    at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:93)
    at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:80)
    at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: hudson.plugins.git.GitException: Command "C:\Program Files\Git\cmd\git.exe fetch --tags --force --progress -- <http_address> +refs/heads/*:refs/remotes/<repo_name>/*" returned status code 128:
stdout: 
stderr: fatal: Authentication failed for <http_address>

This problem had never occured with the other slave, and I do not recall having to do any credential configuration for the slave. My suspicion is the following: I've already done some credential configuration stuff on my workstation (ssh access to the bbucket server, user name, etc. etc.). Is it possible that my local git credential configurations are in conflict with what is requested by the Jenkins slave node? Maybe someone who understands better how credentials are being managed by jenkins and by git can help me to understand the situation better so I can work towards a solution? Currently, I don't even know how to go about debugging my problem.

Thank you ahead of time for your help, and I'll try and be prompt with responses to any questions for clarification.

ItsAnApe
  • 182
  • 1
  • 10
  • You may try configuring git credentials in Jenkins. My guess is that Jenkins may override environment on your slave to the one provided by Jenkins config. – Tupteq Apr 09 '20 at 15:29
  • @Tupteq I followed the git credential setup instructions here: https://jenkins.io/blog/2020/01/08/atlassians-new-bitbucket-server-integration-for-jenkins/ and it worked well for the initial master and slave set up. Afaik, what i did there was simply to configure git credentials within jenkins. A week later, I added the new slave node (my workstation) and all the sudden I'm having issues. – ItsAnApe Apr 09 '20 at 16:49
  • 1
    On my servers I never cared of Bitbucket integration plugin, I just uploaded key to Bitbucket and used it in Jenkins with standard Git plugin. It always worked. – Tupteq Apr 09 '20 at 19:18

1 Answers1

0

Is it possible that my local git credential configurations are in conflict with what is requested by the Jenkins slave node

Check first your git config credential.helper output.

If it returns "manager", it is possible that the Windows Credentials Store seen here has the wrong username/password to access that repository.

That is assuming your Jenkins agent is running on your workstation with your account (and not the Windows System account)

You can reject those credentials and and do a manual git fetch once, to prompt the credentials dialog and enter the correct username/password.

VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283
  • Thank you for the suggestion, but I've also tried this already. One reason I don't think it should be that relevant is that the Jenkins Credentials plugin should be providing the credentials anyway. As @tupteq points out, Jenkins should be overriding local variables anyways. – ItsAnApe Apr 17 '20 at 08:05
  • @ItsAnApe Why are you mentioning SSH in your question if your URL (used by Jenkins) is an HTTPS one? – VonC Apr 17 '20 at 09:46