rancher / rio

Application Deployment Engine for Kubernetes
https://rio.io
Apache License 2.0
2.27k stars 228 forks source link

Rio git ssh on custom port trying to connect to port 22 instead of custom port #1023

Open citananda opened 4 years ago

citananda commented 4 years ago

Describe the bug When I rio run from git on a custom port (eg 30022), rio is trying to git clone to port 22

To Reproduce

  1. rio run --build-clone-secret gitcredential-ssh git@my.domain:30022/my-repo/my-project.git

Expected behavior git access to port 30022

Kubernetes version & type (GKE, on-prem): kubectl version

Client Version: version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.4", GitCommit:"8d8aa39598534325ad77120c120a22b3a990b5ea", GitTreeState:"clean", BuildDate:"2020-03-12T21:03:42Z", GoVersion:"go1.13.8", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.4", GitCommit:"8d8aa39598534325ad77120c120a22b3a990b5ea", GitTreeState:"clean", BuildDate:"2020-03-12T20:55:23Z", GoVersion:"go1.13.8", Compiler:"gc", Platform:"linux/amd64"}

Type: Rio version: rio info

Rio Version: v0.7.0 (4afd4901)
Rio CLI Version: v0.7.0 (4afd4901)
Cluster Domain: XXX.on-rio.io
Cluster Domain IPs: xxxx
System Namespace: rio-system
Wildcard certificates: XXX.on-rio.io(true)

Additional context rio ps output:

Failed to watch git repo: Warning: Permanently added 'my.domain,my.ip' (ECDSA) to the list of known hosts.
git@my.domain: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
: exit status 128(Error)

ssh git@my.domain -p 30022 output:

PTY allocation request failed on channel 0
Welcome to GitLab, @root!
Connection to my.domain closed.
vincent99 commented 4 years ago

Does regular "git clone" work with a string like that? There's no way to differentiate it from a regular user@host:path string where the first path segment happens to be a number.

I don't know if we support it already or not but you'd have to use something like thessh://user@host:port/path form instead.

citananda commented 4 years ago

Yes git clone ssh://git@my-domain:30022/my-repo/my-project.git output:

git clone ssh://git@my-domain:30022/my-repo/my-project.git
Cloning into 'my-project'...
remote: Enumerating objects: 7106, done.
remote: Counting objects: 100% (7106/7106), done.
remote: Compressing objects: 100% (2343/2343), done.
remote: Total 7106 (delta 4472), reused 7033 (delta 4405), pack-reused 0
Receiving objects: 100% (7106/7106), 51.27 MiB | 51.67 MiB/s, done.
Resolving deltas: 100% (4472/4472), done.
citananda commented 4 years ago

I tried ssh://user@host:port/path and I get this problem.

Failed to watch git repo: Warning: Permanently added '[my.domain]:30022,[my.ip]:30022' (ECDSA) to the list of known hosts.
Load key "/tmp/ssh-key557418727": invalid format
git@my.domain: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
: exit status 128(Error)

If RIO don't support this format, do you plan to soon ?

citananda commented 4 years ago

After some test, here is the situation. Using repo: ssh://git@my.domain:30022/my-repo/my-project.git is not connecting on port 30022 but on port 22