added support for environment extesion v2 protocol

This commit is contained in:
Brad Rydzewski
2020-03-26 13:03:15 -07:00
parent bdc7b6cacf
commit f215b64f3d
3 changed files with 27 additions and 5 deletions

View File

@@ -166,14 +166,16 @@ func (c *Compiler) Compile(ctx context.Context, args runtime.CompilerArgs) runti
}
// list the global environment variables
envs, _ := c.Environ.List(ctx, &provider.Request{
globals, _ := c.Environ.List(ctx, &provider.Request{
Build: args.Build,
Repo: args.Repo,
})
// create the default environment variables.
envs = environ.Combine(
envs,
envs := environ.Combine(
provider.ToMap(
provider.FilterUnmasked(globals),
),
args.Build.Params,
pipeline.Environment,
environ.Proxy(),
@@ -349,6 +351,21 @@ func (c *Compiler) Compile(ctx context.Context, args runtime.CompilerArgs) runti
}
}
// HACK: append masked global variables to secrets
// this ensures the environment variable values are
// masked when printed to the console.
masked := provider.FilterMasked(globals)
for _, step := range spec.Steps {
for _, g := range masked {
step.Secrets = append(step.Secrets, &engine.Secret{
Name: g.Name,
Data: []byte(g.Data),
Mask: g.Mask,
Env: g.Name,
})
}
}
// append global resource limits to steps
for _, step := range spec.Steps {
// the resource limits defined in the yaml currently