Description
Following up to a discord conversation where an user tries to clone a Git repository via SSH and is met with the following error:
envbuilder v1.0.0-rc.6+23d086e - Build development environments from repositories in a container
coder/coder#1: 🔑 Using SSH authentication!
coder/coder#1: 🔑 No SSH key found, falling back to agent!
coder/coder#1: ❌ Failed to connect to SSH agent: error creating SSH agent: "SSH agent requested but SSH_AUTH_SOCK not-specified"
coder/coder#1: 📦 Cloning git@github.com:XXX.git to /workspaces/XXX...
Failed to clone repository: clone "git@XXX.git": error creating SSH agent: "SSH agent requested but SSH_AUTH_SOCK not-specified"
Falling back to the default image...
This makes sense because the Coder user's SSH key was never added to the workspace.
While there is a workaround, it's really not great, how can we make this better?
With k8s the issue is not that bad since you can just define a secret from the key and pass that secret as a file to the container, but what about Docker and VMs?
Workaround
Downloading the key to some temporary path (via an entrypoint script, since envbox runs before the agent)
(or via the TF provider's coder_workspace_owner.ssh_*
instead of using a script)
Then passing the key's path to ENVBUILDER_GIT_SSH_PRIVATE_KEY_PATH
.
Metadata
Metadata
Assignees
Labels
No labels