Pipeline failing on git clone

44 views
Skip to first unread message

Sifu Tian

unread,
Feb 23, 2022, 10:14:04 PM2/23/22
to go-cd
Ive been trying all day with no luck
I have 2 pipelines,  and no matter what scenario I choose, they both fail the initial cloning of my repository.  This is leveraging the kubernetes plugin for elastic agents.


pipeline 1:
Materials is set to:
branch master
username and password blank because I am leveraging .git-credentials file on go-server which has valid access token with basic oauth https://XXXXXXTokenXXXXXXX:x-oaut...@github.com

I can perform a git clone on the go-server uder the go user with no problem so I know the connections works.
Error running pipeline :  Cloning into '/go/pipelines/Common_Build'...
STDERR: fatal: could not read Username for 'https://github.com': No such device or address
Failed to run git clone command

pipeline 2:
Materials is set to:
branch master
Username and password are used and have full access to repo

I can perform a git clone on the go-server uder the go user with no problem so I know the connections works.

Error running pipeline:
Cloning into '/go/pipelines/Common_Build'...
STDERR: remote: Repository not found.
STDERR: fatal: Authentication failed for 'https://github.com/org/repo.git/'
Failed to run git clone command


Im really stuck no matter what I do.

Chad Wilson

unread,
Feb 24, 2022, 8:19:09 AM2/24/22
to go...@googlegroups.com
Hiya

For pipeline 1 in particular, did you set up/mount the `.git-credentials` in the kubernetes elastic agent profile (its podspec in particular) and test on an agent?

If the pipeline triggers and shows the "changes" in the dropdown, your GoCD Server can clone repos to detect changes and trigger builds, and is probably fine. If it starts but the issue is in the log for the build, then the problem is likely on the agent.

But if the GoCD Server code isn't configured with the username/password, it can't distribute them to the agents that need them. So you'd need to configure the elastic agents somehow to model whatever server configuration you've done, e.g by mounting part of a ConfigMap or running some pre-start script somehow.

This is why most folks that want to use username/pass will configure it via GoCD server, to avoid manual agent configuration and hacking.

I'm not sure what is wrong with "pipeline 2" (are you sure you configured username and password inside GoCD correctly with something GitHub supports, such as a personal access token linked to an account with read access to the relevant repo?). I've also never personally tried to use GoCD with a Git credential helper or OAuth2, so I don't know the details of how it works.

-Chad

--
You received this message because you are subscribed to the Google Groups "go-cd" group.
To unsubscribe from this group and stop receiving emails from it, send an email to go-cd+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/go-cd/64c0c7fc-04d0-4a4e-ad4f-f848730acbb5n%40googlegroups.com.

Sifu Tian

unread,
Feb 24, 2022, 5:44:04 PM2/24/22
to go-cd
Hi Chad,

I scrapped both approaches since I couldnt get it to work.  We ended up leveraging the pluggable SCM along with the the Kubernetes secrets plugging and it all started to work.  Frustrating but overall happy this worked
Thanks for the feedback.

Kris
-
Reply all
Reply to author
Forward
0 new messages