Skip to content

SSH repositories fail to configure with coder #31

Closed

Description

@geiseri

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://git@github.com/hive-io/hive-rest.git to /workspaces/hive-rest.git...
Failed to clone repository: clone "ssh://git@github.com/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?

Activity

  1. kylecarbs commented on Jul 26, 2023

    @kylecarbs
    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?

  2. janLo commented on Aug 14, 2023

    @janLo
    Contributor

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

  3. kylecarbs commented on Aug 14, 2023

    @kylecarbs
    Member

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

  4. chrisspalm commented on Dec 11, 2023

    @chrisspalm

    This would be useful!

  5. geiseri commented on Dec 14, 2023

    @geiseri
    Author

    Those are in the user profile right?

  6. chewbh commented on Feb 6, 2024

    @chewbh

    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.

  7. nwrkbiz commented on Feb 10, 2024

    @nwrkbiz
    Contributor

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

  8. thattolleyguy commented on Feb 26, 2024

    @thattolleyguy

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

  9. added this to the envbuilder v1.0 milestone on Apr 10, 2024
  10. johnstcn commented on Apr 30, 2024

    @johnstcn
    Member

    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.

  11. johnstcn commented on May 1, 2024

    @johnstcn
    Member

    Plan:

  12. mtojek commented on May 9, 2024

    @mtojek
    Member

    Agreed with @johnstcn to resolve it.

  13. johnstcn commented on May 9, 2024

    @johnstcn
    Member

    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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions