From cc530301fe84f19c3bb6a64d694fa439e0770cce Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Fri, 21 Apr 2017 18:18:11 +0200 Subject: [PATCH] drone exec should read secrets from env --- Makefile | 1 - drone/exec.go | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 12d0b889..7851584f 100644 --- a/Makefile +++ b/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 diff --git a/drone/exec.go b/drone/exec.go index 93150fd0..41401354 100644 --- a/drone/exec.go +++ b/drone/exec.go @@ -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()