diff --git a/agent/agent.go b/agent/agent.go index 2c48ff3a1..d3a83f8a8 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -210,9 +210,6 @@ func (a *Agent) exec(spec *yaml.Config, payload *queue.Work, cancel <-chan bool) } // updates the build status passed into each container. I realize this is // a bit out of place and will work to resolve. - if pipeline.Head().Environment == nil { - pipeline.Head().Environment = make(map[string]string) - } pipeline.Head().Environment["DRONE_BUILD_STATUS"] = status if !pipeline.Head().Constraints.Match( diff --git a/yaml/transform/environ.go b/yaml/transform/environ.go index b00c051ba..582518b2d 100644 --- a/yaml/transform/environ.go +++ b/yaml/transform/environ.go @@ -16,7 +16,11 @@ var ( // 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 { + var images []*yaml.Container + images = append(images, c.Pipeline...) + images = append(images, c.Services...) + + for _, p := range images { if p.Environment == nil { p.Environment = map[string]string{} }