in windows-builder/builder/builder/remote.go [198:225]
func (bs *BuilderServer) GetLabelsMap() map[string]string {
if *bs.Labels == "" {
return nil
}
var labelsMap map[string]string
for _, label := range strings.Split(*bs.Labels, ",") {
labelSpl := strings.Split(label, "=")
if len(labelSpl) != 2 {
log.Printf("Error: Label needs to be key=value template. %s label ignored", label)
continue
}
var key = strings.TrimSpace(labelSpl[0])
if len(key) == 0 {
log.Printf("Error: Label key can't be empty. %s label ignored", label)
continue
}
var value = strings.TrimSpace(labelSpl[1])
if labelsMap == nil {
labelsMap = make(map[string]string)
}
labelsMap[key] = value
}
return labelsMap
}