From c0b1d6aaa49d8a2a278cf4b6e52c380e06fda0d2 Mon Sep 17 00:00:00 2001 From: qwerty287 <80460567+qwerty287@users.noreply.github.com> Date: Wed, 7 Aug 2024 21:11:55 +0200 Subject: [PATCH] Allow using args in container (#4011) --- pipeline/backend/local/local.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pipeline/backend/local/local.go b/pipeline/backend/local/local.go index fc7c0420a..5e11f68f0 100644 --- a/pipeline/backend/local/local.go +++ b/pipeline/backend/local/local.go @@ -62,11 +62,14 @@ func (e *local) Name() string { return "local" } -func (e *local) IsAvailable(context.Context) bool { +func (e *local) IsAvailable(ctx context.Context) bool { + if c, ok := ctx.Value(types.CliCommand).(*cli.Command); ok { + if c.String("backend-engine") == e.Name() { + return true + } + } _, inContainer := os.LookupEnv("WOODPECKER_IN_CONTAINER") - // note: we don't need to check by args as this would indicate we are not in an container anyway ... - backend := os.Getenv("WOODPECKER_BACKEND") - return backend == "local" || !inContainer + return !inContainer } func (e *local) Flags() []cli.Flag {