diff --git a/pkg/build/controller/jenkins/jenkins.go b/pkg/build/controller/jenkins/jenkins.go index 1f7ecccf39c8..d2ecc93079be 100644 --- a/pkg/build/controller/jenkins/jenkins.go +++ b/pkg/build/controller/jenkins/jenkins.go @@ -75,7 +75,7 @@ func (t *PipelineTemplate) Process() (*kapi.List, []error) { func (t *PipelineTemplate) HasJenkinsService(items *kapi.List) bool { accessor := meta.NewAccessor() for _, item := range items.Items { - kind, _, err := legacyscheme.Scheme.ObjectKind(item) + kinds, _, err := legacyscheme.Scheme.ObjectKinds(item) if err != nil { glog.Infof("Error checking Jenkins service kind: %v", err) return false @@ -85,9 +85,12 @@ func (t *PipelineTemplate) HasJenkinsService(items *kapi.List) bool { glog.Infof("Error checking Jenkins service name: %v", err) return false } - glog.Infof("Jenkins Pipeline template object %q with name %q", name, kind.Kind) - if name == t.Config.ServiceName && kind.Kind == "Service" { - return true + glog.Infof("Jenkins Pipeline template object %q with name %q", name, kinds[0].Kind) + + for _, kind := range kinds { + if name == t.Config.ServiceName && kind.GroupKind() == kapi.Kind("Service") { + return true + } } } return false