1
0
mirror of https://github.com/drone/drone-cli.git synced 2024-11-23 09:21:56 +01:00

add in env flag

This commit is contained in:
Antonio Beyah 2018-03-22 15:28:51 -05:00
parent 94a96d9041
commit 6c30d71ab8

@ -274,6 +274,10 @@ var Command = cli.Command{
Name: "job-number",
EnvVar: "DRONE_JOB_NUMBER",
},
cli.StringSliceFlag{
Name: "env, e",
EnvVar: "DRONE_ENV",
},
},
}
@ -297,6 +301,12 @@ func exec(c *cli.Context) error {
})
}
drone_env := make(map[string]string)
for _, env := range c.StringSlice("env") {
envs := strings.Split(env, "=")
drone_env[envs[0]] = envs[1]
}
tmpl, err := envsubst.ParseFile(file)
if err != nil {
return err
@ -367,6 +377,7 @@ func exec(c *cli.Context) error {
),
compiler.WithMetadata(metadata),
compiler.WithSecret(secrets...),
compiler.WithEnviron(drone_env),
).Compile(conf)
engine, err := docker.NewEnv()