woodpecker/yaml/transform/labels.go
Joachim Hill-Grannec aaa702dab6 Adding the ability to label containers that are launched using
labels:
    something: value
    something2: value2
2016-08-13 14:38:37 -07:00

19 lines
407 B
Go

package transform
import (
"github.com/drone/drone/yaml"
)
// Labels transforms the steps in the Yaml pipeline to include a Labels if it doens't exist
func Labels(c *yaml.Config) error {
var images []*yaml.Container
images = append(images, c.Pipeline...)
images = append(images, c.Services...)
for _, p := range images {
if p.Labels == nil {
p.Labels = map[string]string{}
}
}
return nil
}