pipeline icon indicating copy to clipboard operation
pipeline copied to clipboard

git-init task could not fetch ssh link with ssh-directory setup properly

Open lookis opened this issue 3 years ago • 7 comments

Expected Behavior

git-init task with .ssh setup properly will fetch repository

Actual Behavior

report a warning and error

{"level":"warn","ts":1659233796.5188842,"caller":"git/git.go:277","msg":"URL("ssh://[email protected]:xxxxx.git") appears to need SSH authentication but no SSH credentials have been provided"} {"level":"error","ts":1659233801.5396273,"caller":"git/git.go:54","msg":"Error running git [fetch --recurse-submodules=yes --depth=1 origin --update-head-ok --force HEAD]: exit status 128\nssh: Could not resolve hostname github.com:xxxx: Try again\r\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n","stacktrace":"github.com/tektoncd/pipeline/pkg/git.run\n\tgithub.com/tektoncd/pipeline/pkg/git/git.go:54\ngithub.com/tektoncd/pipeline/pkg/git.Fetch\n\tgithub.com/tektoncd/pipeline/pkg/git/git.go:149\nmain.main\n\tgithub.com/tektoncd/pipeline/cmd/git-init/main.go:53\nruntime.main\n\truntime/proc.go:204"}

Steps to Reproduce the Problem

  1. setup with this task https://hub.tekton.dev/tekton/task/git-clone
  2. provided ssh-directory workspace
  3. run it

Additional Info

  • Kubernetes version:

    Output of kubectl version:

WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short.  Use --output=yaml|json to get the full version.
Client Version: version.Info{Major:"1", Minor:"24", GitVersion:"v1.24.2", GitCommit:"f66044f4361b9f1f96f0053dd46cb7dce5e990a8", GitTreeState:"clean", BuildDate:"2022-06-15T14:14:10Z", GoVersion:"go1.18.3", Compiler:"gc", Platform:"darwin/amd64"}
Kustomize Version: v4.5.4
Server Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.6+k3s1", GitCommit:"418c3fa858b69b12b9cefbcff0526f666a6236b9", GitTreeState:"clean", BuildDate:"2022-04-28T22:16:18Z", GoVersion:"go1.17.5", Compiler:"gc", Platform:"linux/amd64"}
  • Tekton Pipeline version:

    Output of tkn version or kubectl get pods -n tekton-pipelines -l app=tekton-pipelines-controller -o=jsonpath='{.items[0].metadata.labels.version}'

v0.37.0

.ssh folder was created in home folder, but validate in CredsDir https://github.com/tektoncd/pipeline/blob/v0.38.1/pkg/git/git.go#L77-L88

lookis avatar Jul 31 '22 02:07 lookis

I also have the same ploblem. /tekton/home/.ssh/* exists and valid in kubernetes container. and I tested tekton git-init container run in my desktop and wrote private/known_hosts for ssh auth, then git clone is successfully.

sparkstar avatar Aug 21 '22 15:08 sparkstar

@lookis Did you ever find a solution to this problem ? I'm facing the same thing now.

NewmanJ1987 avatar Oct 04 '22 20:10 NewmanJ1987

@lookis Did you ever find a solution to this problem ? I'm facing the same thing now.

I have to replace ssh with https link and use basic authentication to fetch the code to work around @NewmanJ1987

lookis avatar Oct 04 '22 22:10 lookis

@lookis Think you've mixed URL formats with ssh://[email protected]:xxxxx.git

Should either be [email protected]:xxxxx.git or ssh://[email protected]/xxxxx.git

The warning appears to need SSH authentication but no SSH credentials have been provided is incorrect and I see it even on successful clone of SSH git repos.

jimmyjones2 avatar Oct 20 '22 20:10 jimmyjones2

@lookis I tried getting my own shh repo using the example docs and it cloned the repo successfully git-clone-use-cred maybe you cloud reference this docs and fetch successfully

chengjoey avatar Nov 08 '22 15:11 chengjoey

@chengjoey never mind, I've give up tekton for now, thanks

lookis avatar Nov 08 '22 23:11 lookis

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale with a justification. Stale issues rot after an additional 30d of inactivity and eventually close. If this issue is safe to close now please do so with /close with a justification. If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/lifecycle stale

Send feedback to tektoncd/plumbing.

tekton-robot avatar Feb 07 '23 00:02 tekton-robot

Stale issues rot after 30d of inactivity. Mark the issue as fresh with /remove-lifecycle rotten with a justification. Rotten issues close after an additional 30d of inactivity. If this issue is safe to close now please do so with /close with a justification. If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/lifecycle rotten

Send feedback to tektoncd/plumbing.

tekton-robot avatar Mar 09 '23 00:03 tekton-robot

Rotten issues close after 30d of inactivity. Reopen the issue with /reopen with a justification. Mark the issue as fresh with /remove-lifecycle rotten with a justification. If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/close

Send feedback to tektoncd/plumbing.

tekton-robot avatar Apr 08 '23 00:04 tekton-robot

@tekton-robot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity. Reopen the issue with /reopen with a justification. Mark the issue as fresh with /remove-lifecycle rotten with a justification. If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/close

Send feedback to tektoncd/plumbing.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

tekton-robot avatar Apr 08 '23 00:04 tekton-robot

Duplicate of https://github.com/tektoncd/pipeline/issues/5611

lbernick avatar Apr 10 '23 20:04 lbernick