1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2024-12-24 10:07:21 +02:00

Respect cli argument when checking docker backend availability (#3770)

Co-authored-by: Anbraten <6918444+anbraten@users.noreply.github.com>
This commit is contained in:
qwerty287 2024-06-10 12:51:38 +02:00 committed by GitHub
parent 1953a0ec5a
commit 044c3a6dd5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -62,9 +62,11 @@ func (e *docker) Name() string {
return "docker" return "docker"
} }
func (e *docker) IsAvailable(context.Context) bool { func (e *docker) IsAvailable(ctx context.Context) bool {
if os.Getenv("DOCKER_HOST") != "" { if c, ok := ctx.Value(backend.CliContext).(*cli.Context); ok {
return true if c.IsSet("backend-docker-host") {
return true
}
} }
_, err := os.Stat("/var/run/docker.sock") _, err := os.Stat("/var/run/docker.sock")
return err == nil return err == nil