woodpecker/yaml/transform/environ.go

21 lines
425 B
Go
Raw Normal View History

2016-05-09 18:28:49 +00:00
package transform
import "github.com/drone/drone/yaml"
// Environ transforms the steps in the Yaml pipeline to include runtime
// environment variables.
func Environ(c *yaml.Config, envs map[string]string) error {
for _, p := range c.Pipeline {
if p.Environment == nil {
p.Environment = map[string]string{}
}
for k, v := range envs {
if v == "" {
continue
}
p.Environment[k] = v
}
}
return nil
}