woodpecker-ci / woodpecker

Woodpecker is a simple, yet powerful CI/CD engine with great extensibility.
https://woodpecker-ci.org
Apache License 2.0
4.3k stars 371 forks source link

`docker run woodpeckerci/woodpecker-cli setup` tries to run xdg-open to spawn a web browser #3763

Closed wez closed 5 months ago

wez commented 5 months ago

Component

cli

Describe the bug

The docker version of the CLI wants to spawn a web browser via a launcher of some kind, which will always fail in the context of docker, because the image cannot include a browser.

Steps to reproduce

$ docker run --rm -it woodpeckerci/woodpecker-cli setup --server-url https://some.host
1:01AM FTL error running cli error="exec: \"xdg-open\": executable file not found in $PATH"

Expected behavior

Rather than raising an error for the not-found case, this logic:

https://github.com/woodpecker-ci/woodpecker/blob/964860434c7548b73778476bf64125e6713d6b0a/cli/setup/token_fetcher.go#L115-L124

could print the URL to stdout so that the user can click on it, or copy and paste it to open it that way. That would also help in the "unsupported platform" case.

System Info

$ docker run --rm woodpeckerci/woodpecker-cli --version
woodpecker-cli version 2.5.0

Additional context

No response

Validations

wez commented 5 months ago

If I bypass that by running setup with --token, the next thing I run into is:

wez commented 5 months ago

I realize that I probably also need to map a volume to capture whatever state setup is setting up, but it's a bit of a moot point at the moment! :-)

wez commented 5 months ago

I had to go back to v2.3.0 to be able to use the CLI:

$ docker run --rm -it woodpeckerci/woodpecker-cli:v2.3.0-alpine --server $WOODPECKER_SERVER --token $WOODPECKER_TOKEN user ls

all subsequent versions are unusable due to external dependencies.