Allowing for services with no environment defined.

This commit is contained in:
Joachim Hill-Grannec 2016-06-10 20:46:13 -07:00
parent fd2b4b71ba
commit 7e5a6ec9fb
2 changed files with 5 additions and 4 deletions

View file

@ -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 // updates the build status passed into each container. I realize this is
// a bit out of place and will work to resolve. // 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 pipeline.Head().Environment["DRONE_BUILD_STATUS"] = status
if !pipeline.Head().Constraints.Match( if !pipeline.Head().Constraints.Match(

View file

@ -16,7 +16,11 @@ var (
// Environ transforms the steps in the Yaml pipeline to include runtime // Environ transforms the steps in the Yaml pipeline to include runtime
// environment variables. // environment variables.
func Environ(c *yaml.Config, envs map[string]string) error { 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 { if p.Environment == nil {
p.Environment = map[string]string{} p.Environment = map[string]string{}
} }