Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSH repositories fail to configure with coder #31

Closed
Tracked by #132
geiseri opened this issue Jul 14, 2023 · 12 comments
Closed
Tracked by #132

SSH repositories fail to configure with coder #31

geiseri opened this issue Jul 14, 2023 · 12 comments
Assignees

Comments

@geiseri
Copy link

geiseri commented Jul 14, 2023

If I try to use a private git repository over SSH I see the following error:

envbuilder - Build development environments from repositories in a container
#1: 📦 Cloning ssh://[email protected]/hive-io/hive-rest.git to /workspaces/hive-rest.git...
Failed to clone repository: clone "ssh://[email protected]/hive-io/hive-rest.git": error creating SSH agent: "SSH agent requested but SSH_AUTH_SOCK not-specified"
Falling back to the default image...
#2: 🏗️ Building image...
#2: Retrieving image manifest codercom/enterprise-base:ubuntu
#2: Retrieving image codercom/enterprise-base:ubuntu from registry index.docker.io
#2: Built cross stage deps: map[]

I didn't see a way to configure that to use the built in SSH key provided by coder. Is there a missing setting?

@kylecarbs
Copy link
Member

We don't support cloning over SSH in envbuilder currently, but it's not something I'm opposed to adding.

Does cloning over HTTP(s) not work for your scenario?

@janLo
Copy link
Contributor

janLo commented Aug 14, 2023

Would it be sufficient to drop an coder agent binary into the envbuilder image and set GIT_SSH_COMMAND=/.envbuilder/coder gitssh -- ?

@kylecarbs
Copy link
Member

I think that might work, but it'd need the agent env vars as well.

@chrisspalm
Copy link

This would be useful!

@geiseri
Copy link
Author

geiseri commented Dec 14, 2023

Those are in the user profile right?

@chewbh
Copy link

chewbh commented Feb 6, 2024

Is there plan to look at implementing this? Support for cloning over SSH in envbuilder will be very useful.

Some developers has preference using SSH over HTTP/S for interacting with git. To them, it is not expected that a devcontainer workspace fail to build due to this, given that they have already configure a SSH key within Coder and that they are force to fallback to use HTTP/S for cloning.

In addition, to support cloning private repos, we specifically need to add additional terraform logic or uses coder_external_auth to configure GIT environment variables in the workspace template.

@nwrkbiz
Copy link
Contributor

nwrkbiz commented Feb 10, 2024

Adding support for this, would also provide a simple and secure workaround for #60

@thattolleyguy
Copy link

thattolleyguy commented Feb 26, 2024

+1 for adding support for this. This is the top reason our company isn't using coder yet

@bpmct bpmct added this to the envbuilder v1.0 milestone Apr 10, 2024
@bpmct bpmct mentioned this issue Apr 18, 2024
36 tasks
@johnstcn
Copy link
Member

johnstcn commented Apr 30, 2024

There are two main cases to consider here:

  1. Local container runtime (for example, local Docker daemon): we can simply use SSH_AUTH_SOCK to get the required credentials, or pass a local SSH key in.
  2. Remote container runtime (Kubernetes etc.): we will need some external method of getting git credentials. We can't necessarily expect folks to go storing SSH keys or other credentials in secrets, and I don't see an easy way of magically passing an SSH auth socket to a container running in a Kubernetes cluster. Integrating with Coder using the coder gitssh workflow would seem to be the way to go here.

In the second case, there is a circular dependency where we need the agent to get the git credentials to clone the repo and build the container, but we need to build the container to start the agent. To work around this, we can possibly have envbuilder perform step of getting the git SSH key from Coder using the agent token directly.

@johnstcn
Copy link
Member

johnstcn commented May 1, 2024

Plan:

@mtojek
Copy link
Member

mtojek commented May 9, 2024

Agreed with @johnstcn to resolve it.

@mtojek mtojek closed this as completed May 9, 2024
@johnstcn
Copy link
Member

johnstcn commented May 9, 2024

Closing this issue out. A follow-up issue will provide the capability for the Coder terraform provider to inject the user's SSH private key into workspace resources. However, there should be no further changes required in envbuilder to support this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests