devpod icon indicating copy to clipboard operation
devpod copied to clipboard

Secured Dotfile Repository Clone Failing

Open mudged opened this issue 3 years ago • 3 comments

What happened?
An error occurs when performing a devpod up command with the --dotfiles flag point to a secured git repository.

devpod up https://xxxxxxxxxxxx/git/scm/xxx/xxxxxx.git --dotfiles https://xxxxxxxxxxxx/git/scm/~daniel.mudge/devpod-dotfiles.git --debug (redacted)

The clone of the workspace is successful and is from the same Bitbucket server as the dotfile repository and both use the same credentials.

No real error is given but looking through the code and comparing it to the log output (below) it seems to be failing on the clone command. It doesn't reach the "Entering dotfiles directory" output on https://github.com/loft-sh/devpod/blob/main/cmd/agent/workspace/install_dotfiles.go#L63.

11:37:11 info execute inject script
11:37:11 info Received line after pong: done
11:37:11 info done inject
11:37:11 info done injecting
11:37:11 info Done InjectAgentAndExecute
11:37:11 info done exec
11:37:12 info Successfully connected to container
11:37:12 info Run outer container tunnel
11:37:12 info Execute SSH server command: bash -c su -c "'/usr/local/bin/devpod' helper ssh-server --track-activity --stdio --debug" 'vscode'
11:37:13 info Execute SSH server command: bash -c /usr/local/bin/devpod agent workspace install-dotfiles --repository https://xxxxxxxxxxxx/git/scm/~daniel.mudge/devpod-dotfiles.git --debug
11:37:13 info Cloning dotfiles https://xxxxxxxxxxxx/git/scm/~daniel.mudge/devpod-dotfiles.git
11:37:13 info Connection to container closed
11:37:13 info done inject
11:37:13 info done injecting
11:37:13 info Done InjectAgentAndExecute
11:37:13 info Error tunneling to container: wait: remote command exited without exit status or exit signal
11:37:13 info Container tunnel exited
11:37:13 info Tunnel to host closed
11:37:13 info done exec
11:37:13 info Process exited with status 128

Possibly related to the clone of the workspace and dotfile using different mechanisms?

No issue when trying without the --dotfiles flag

What did you expect to happen instead?
Contents of dotfile repository would be cloned into workspace using the same credential helper as used when checking out the workspace.

How can we reproduce the bug? (as minimally and precisely as possible)
run devpod up with a secured non-public repository specified for the --dotfiles value.

Local Environment:

  • DevPod Version:0.3.4
  • Operating System: windows
  • ARCH of the OS: AMD64

DevPod Provider:

  • Cloud Provider: aws
  • Kubernetes Provider: n/a
  • Local/remote provider: ssh
  • Custom provider: n/a

Anything else we need to know?

mudged avatar Aug 17 '23 11:08 mudged

Hey @mudged , I was just having this issue too. Try using an ssh link for your private repo, eg, [email protected]:my_org/my_repo

The reason this works is, it looks like devpod will ssh out from your local to the remote to clone the dotfiles repo, and it will forward your local ssh keys when doing it. So, as long as your local has ssh keys setup in your keychain for use with ssh agent forwarding, and those ssh keys have access to the repo, it should work (just worked for me).

marklarr-gfm avatar Aug 18 '23 04:08 marklarr-gfm

Hi @marklarr-gfm, thanks for your response. Unfortunately ssh git urls don't seem to work at all in devpod for me. I can run a git clone <ssh-git-url> from a terminal, do my ssh keys are installed. But I get connection timeout if I try to use the same in devpod, so I have been using https urls.

mudged avatar Aug 18 '23 14:08 mudged

Hi @mudged, thank you for opening the issue, we'll investigate it 👍

pascalbreuninger avatar Aug 21 '23 05:08 pascalbreuninger