loft-sh / devpod

Codespaces but open-source, client-only and unopinionated: Works with any IDE and lets you use any cloud, kubernetes or just localhost docker.
https://devpod.sh
Mozilla Public License 2.0
8.42k stars 305 forks source link

Cannot create ssh provider #1108

Open jzazo opened 3 weeks ago

jzazo commented 3 weeks ago

What happened?

When trying to create a new ssh provider I get an error message to verify I can execute ssh. The message is badly formatted, but after correcting it, it works.

image

The image output command is badly formatted.

I run the following command successfully:

ssh -o StrictHostKeyChecking=no -o BatchMode=yes -p 2222 my_username@127.0.0.1

What did you expect to happen instead?
I can add a new ssh provider

How can we reproduce the bug? (as minimally and precisely as possible)
Install devpod and click add ssh provider and add one as in the image:

image

Local Environment:

DevPod Provider:

pascalbreuninger commented 3 weeks ago

Hey @jzazo, thanks for reporting the issue. We've just release a new version of the SSH provider. Could you upgrade and check if it please?

fboukezzoula commented 3 weeks ago

Hello,

I've exactly the same error than @jzazo

image

Error log:

Run init provider command: ${SSH_PROVIDER} init
Please make sure you have configured the correct SSH host
and the following command can be executed on your system:
ssh -oStrictHostKeyChecking=no -oBatchMode=yes -i C:\Users\PC\.ssh\private root@192.168.1.30 echo Devpod Test
exit status 1
init
github.com/loft-sh/devpod/cmd/provider.initProvider
D:/a/devpod/devpod/cmd/provider/use.go:191
github.com/loft-sh/devpod/cmd/provider.setOptions
D:/a/devpod/devpod/cmd/provider/use.go:164
github.com/loft-sh/devpod/cmd/provider.(*SetOptionsCmd).Run
D:/a/devpod/devpod/cmd/provider/set_options.go:70
github.com/loft-sh/devpod/cmd/provider.NewSetOptionsCmd.func1
D:/a/devpod/devpod/cmd/provider/set_options.go:40
github.com/spf13/cobra.(*Command).execute
D:/a/devpod/devpod/vendor/github.com/spf13/cobra/command.go:983
github.com/spf13/cobra.(*Command).ExecuteC
D:/a/devpod/devpod/vendor/github.com/spf13/cobra/command.go:1115
github.com/spf13/cobra.(*Command).Execute
D:/a/devpod/devpod/vendor/github.com/spf13/cobra/command.go:1039
github.com/loft-sh/devpod/cmd.Execute
D:/a/devpod/devpod/cmd/root.go:90
main.main
D:/a/devpod/devpod/main.go:8
runtime.main
C:/Users/runneradmin/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.2.windows-amd64/src/runtime/proc.go:271
runtime.goexit
C:/Users/runneradmin/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.2.windows-amd64/src/runtime/asm_amd64.s:1695

When I execute the command is OK :

C:\Users\PC>ssh -oStrictHostKeyChecking=no -oBatchMode=yes -i C:\Users\PC\.ssh\private root@192.168.1.30 echo Devpod Test

Result : Devpod Test

I'am using the latest version: image

content of the provider.yaml file:

name: ssh
version: v0.0.14
description: |-
  DevPod on SSH
icon: https://devpod.sh/assets/ssh.svg
iconDark: https://devpod.sh/assets/ssh_dark.svg
optionGroups:
  - options:
      - PORT
      - EXTRA_FLAGS
    name: "SSH options"
    defaultVisible: false
  - options:
      - DOCKER_PATH
      - AGENT_PATH
      - INACTIVITY_TIMEOUT
      - INJECT_DOCKER_CREDENTIALS
      - INJECT_GIT_CREDENTIALS
    name: "Agent options"
    defaultVisible: false
options:
  INACTIVITY_TIMEOUT:
    description: "If defined, will automatically stop the container after the inactivity period. Example: 10m"
  DOCKER_PATH:
    description: The path where to find the docker binary.
    default: docker
  AGENT_PATH:
    description: The path where to inject the DevPod agent to.
    command: printf "%s" "/tmp/${USER}/devpod/agent"
  INJECT_GIT_CREDENTIALS:
    description: "If DevPod should inject git credentials into the remote host."
    default: "true"
  INJECT_DOCKER_CREDENTIALS:
    description: "If DevPod should inject docker credentials into the remote host."
    default: "true"
  HOST:
    required: true
    description: "The SSH Host to connect to. Example: my-user@my-domain.com"
  PORT:
    description: "The SSH Port to use. Defaults to 22"
    default: "22"
  EXTRA_FLAGS:
    description: "Extra flags to pass to the SSH command."
agent:
  inactivityTimeout: ${INACTIVITY_TIMEOUT}
  injectGitCredentials: ${INJECT_GIT_CREDENTIALS}
  injectDockerCredentials: ${INJECT_DOCKER_CREDENTIALS}
  path: ${AGENT_PATH}
  docker:
    path: ${DOCKER_PATH}
    install: false
binaries:
  SSH_PROVIDER:
    - os: linux
      arch: amd64
      path: https://github.com/loft-sh/devpod-provider-ssh/releases/download/v0.0.14/devpod-provider-ssh-linux-amd64
      checksum: cf23560a183568289309456fb573d8d0aedabed40b3e000403e53a8a89ef8895
    - os: windows
      arch: amd64
      path: https://github.com/loft-sh/devpod-provider-ssh/releases/download/v0.0.14/devpod-provider-ssh-windows-amd64.exe
      checksum: c4059978cfa44a46feb644dc9b3b41be1f8acd92b420425f9e2c73e6a3b60e31
exec:
  init: ${SSH_PROVIDER} init
  command: ${SSH_PROVIDER} command
jzazo commented 3 weeks ago

Hey @jzazo, thanks for reporting the issue. We've just release a new version of the SSH provider. Could you upgrade and check if it please?

Is there a way to upgrade efficiently? I uninstalled devpod, downloaded a new installer and reinstalled. The issue persists.

pascalbreuninger commented 3 weeks ago

You only need to update the provider, not DevPod itself. You can do this in DevPod Desktop in the provider view > Update or via cli devpod provider update ssh

jzazo commented 3 weeks ago

In devpod desktop, I cannot update, because there is no entry. Any new entry I try to create is rejected. In cli, I cannot add port:

PS C:\Users\javierzazo> devpod provider update ssh
20:49:41 done Successfully updated provider ssh
20:49:41 info The SSH Host to connect to. Example: my-user@my-domain.com

? Please enter a value for HOST EUROPE.javierzazo@127.0.0.1
20:50:03 error Please make sure you have configured the correct SSH host
20:50:03 error and the following command can be executed on your system:
20:50:03 error ssh -oStrictHostKeyChecking=no -oBatchMode=yes EUROPE.javierzazo@127.0.0.1 echo Devpod Test
20:50:03 error Error configuring provider, please retry with 'devpod provider use ssh --reconfigure'
20:50:03 error Try using the --debug flag to see a more verbose output
20:50:03 fatal configure provider: init: exit status 1
fboukezzoula commented 3 weeks ago

It's ok for me, i've uninstall & reinstall the DevOp and use the latest version : https://github.com/loft-sh/devpod-provider-ssh/releases/download/v0.0.14/provider.yaml

image

jzazo commented 3 weeks ago

I am using custom port 2222, could that make a difference?

I downloaded same provider as @fboukezzoula and added it as a custom provider. Tried again and it failed.

thomasxd24 commented 3 weeks ago

@jzazo Yes the port is what makes the bug, v0.014 should fix the issue.

jzazo commented 2 weeks ago

I am not sure what I am doing wrong, but I ran the following:

devpod provider delete ssh
devpod provider add https://github.com/loft-sh/devpod-provider-ssh/releases/download/v0.0.14/provider.yaml

It asks for the HOST and then fails, because I never gave it the port (it does not ask for it). If I give the url to the custom provider in the GUI, it does not help, I still get the same error.

The command that the error tells me to run, works.