woodpecker-ci / plugin-git

Woodpecker plugin for cloning Git repositories
https://woodpecker-ci.org/docs/usage/workflow-syntax#clone
Apache License 2.0
16 stars 27 forks source link

Print usefull error message if auth failed #25

Open 6543 opened 2 years ago

6543 commented 2 years ago
fatal: could not read Username for 'https://<url>': No such device or address
exit status 128 

does not tell you that it simply try to clone without password but it failed because it needs one

FredeEB commented 2 years ago

I'm hitting this, do you happen have a solution for this issue? If I understand it correctly, git is trying to clone with http, but failing due to authentication, I feel like it should be allowed to if you register with your forge through oauth2.

e.g I use gitea, and log in to woodpecker with oauth, which works, and woodpecker correctly lists all repos related to my account, however when it tries to actually clone the repo, it fails with the above when trying to access https://<hostname>/<owner>/<repo>//info/refs?service=git-upload-pack.

Also as as side note, is there a way to use ssh for cloning?

khmarbaise commented 1 year ago

I have observed the same issue (Using 2.X of the git plugin) and adding some logging output of the server side:

{"level":"error","error":"signature is invalid","time":"2022-12-25T16:20:43Z","caller":"/woodpecker/src/github.com/woodpecker-ci/woodpecker/server/api/hook.go:131","message":"failure to parse token from hook for test/test"}
{"level":"info","ip":"172.19.0.2","latency":4.25749,"method":"POST","path":"/hook","status":400,"time":"2022-12-25T16:20:43Z","user-agent":"Go-http-client/1.1","time":"2022-12-25T16:20:43Z","caller":"/woodpecker/src/github.com/woodpecker-ci/woodpecker/server/router/middleware/logger.go:45"}
{"level":"error","error":"signature is invalid","time":"2022-12-25T16:20:43Z","caller":"/woodpecker/src/github.com/woodpecker-ci/woodpecker/server/api/hook.go:131","message":"failure to parse token from hook for test/test"}
...

After downgrading to 1.6.1 of the plugin it works. via:

WOODPECKER_DEFAULT_CLONE_IMAGE: woodpeckerci/plugin-git:v1.6.1

in my environment configuration for the server configuration.

6543 commented 1 year ago

@khmarbaise that's an unrelated issue (#57), and yes that show that we need a nice error handling