Allow to get secrets from file (#5509)

This commit is contained in:
qwerty287
2025-09-14 12:26:56 +02:00
committed by GitHub
parent f82f0653d6
commit 47a00051e6
2 changed files with 25 additions and 0 deletions

View File

@@ -25,6 +25,7 @@ import (
"runtime"
"strings"
"codeberg.org/6543/xyaml"
"github.com/drone/envsubst"
"github.com/oklog/ulid/v2"
"github.com/rs/zerolog/log"
@@ -169,6 +170,25 @@ func execWithAxis(ctx context.Context, c *cli.Command, file, repoPath string, ax
Value: val,
})
}
if secretsFile := c.String("secrets-file"); secretsFile != "" {
fileContent, err := os.ReadFile(secretsFile)
if err != nil {
return err
}
var m map[string]string
err = xyaml.Unmarshal(fileContent, &m)
if err != nil {
return err
}
for key, val := range m {
secrets = append(secrets, compiler.Secret{
Name: key,
Value: val,
})
}
}
pipelineEnv := make(map[string]string)
for _, env := range c.StringSlice("env") {