Support secrets in cli exec (#5374)

This commit is contained in:
qwerty287
2025-07-31 07:13:07 +03:00
committed by GitHub
parent eced1ee886
commit 12cd608150
3 changed files with 11 additions and 8 deletions

View File

@@ -18,6 +18,7 @@ import (
"context"
"fmt"
"io"
"maps"
"os"
"path"
"path/filepath"
@@ -146,9 +147,9 @@ func execWithAxis(ctx context.Context, c *cli.Command, file, repoPath string, ax
}
environ := metadata.Environ()
maps.Copy(environ, metadata.Workflow.Matrix)
var secrets []compiler.Secret
for key, val := range metadata.Workflow.Matrix {
environ[key] = val
for key, val := range c.StringMap("secrets") {
secrets = append(secrets, compiler.Secret{
Name: key,
Value: val,

View File

@@ -64,6 +64,11 @@ var flags = []cli.Flag{
Usage: "backend engine to run pipelines on",
Value: "auto-detect",
},
&cli.StringMapFlag{
Sources: cli.EnvVars("WOODPECKER_SECRETS"),
Name: "secrets",
Usage: "map of secrets, ex. 'secret=\"val\",secret2=\"value2\"'",
},
//
// backend options for pipeline compiler