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:
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()
|
||||
|
Loading…
Reference in New Issue
Block a user