mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-26 11:51:02 +00:00
drone exec should read secrets from env
This commit is contained in:
parent
8d37efef68
commit
cc530301fe
2 changed files with 6 additions and 1 deletions
1
Makefile
1
Makefile
|
@ -19,7 +19,6 @@ deps_backend:
|
|||
go get -u golang.org/x/tools/cmd/cover
|
||||
go get -u github.com/jteeuwen/go-bindata/...
|
||||
go get -u github.com/elazarl/go-bindata-assetfs/...
|
||||
go get -u github.com/tidwall/redlog
|
||||
|
||||
gen: gen_template gen_migrations
|
||||
|
||||
|
|
|
@ -277,6 +277,7 @@ func exec(c *cli.Context) error {
|
|||
|
||||
metadata := metadataFromContext(c)
|
||||
environ := metadata.Environ()
|
||||
secrets := []compiler.Secret{}
|
||||
for k, v := range metadata.EnvironDrone() {
|
||||
environ[k] = v
|
||||
}
|
||||
|
@ -284,6 +285,10 @@ func exec(c *cli.Context) error {
|
|||
k := strings.Split(env, "=")[0]
|
||||
v := strings.Split(env, "=")[1]
|
||||
environ[k] = v
|
||||
secrets = append(secrets, compiler.Secret{
|
||||
Name: k,
|
||||
Value: v,
|
||||
})
|
||||
}
|
||||
|
||||
tmpl, err := envsubst.ParseFile(file)
|
||||
|
@ -345,6 +350,7 @@ func exec(c *cli.Context) error {
|
|||
c.String("netrc-machine"),
|
||||
),
|
||||
compiler.WithMetadata(metadata),
|
||||
compiler.WithSecret(secrets...),
|
||||
).Compile(conf)
|
||||
|
||||
engine, err := docker.NewEnv()
|
||||
|
|
Loading…
Reference in a new issue