From 0b8d50a36e419e676c3538825a1a1002c4f3ede9 Mon Sep 17 00:00:00 2001 From: Jerop Date: Wed, 22 Jun 2022 21:55:26 -0400 Subject: [PATCH] Use Constants in ChildReferences Prior to this commit, the APIVersion and Kind fields used different variables depending on where they were used. In this cleanup, they use the same constants everywhere. --- pkg/reconciler/pipelinerun/pipelinerun.go | 4 ++-- pkg/reconciler/pipelinerun/resources/pipelinerunstate.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/reconciler/pipelinerun/pipelinerun.go b/pkg/reconciler/pipelinerun/pipelinerun.go index 9e12bfcb85b..aaa97eefbea 100644 --- a/pkg/reconciler/pipelinerun/pipelinerun.go +++ b/pkg/reconciler/pipelinerun/pipelinerun.go @@ -1398,7 +1398,7 @@ func updatePipelineRunStatusFromChildRefs(logger *zap.SugaredLogger, pr *v1beta1 childRefByName[tr.Name] = &v1beta1.ChildStatusReference{ TypeMeta: runtime.TypeMeta{ APIVersion: v1beta1.SchemeGroupVersion.String(), - Kind: "TaskRun", + Kind: pipeline.TaskRunControllerName, }, Name: tr.Name, PipelineTaskName: pipelineTaskName, @@ -1420,7 +1420,7 @@ func updatePipelineRunStatusFromChildRefs(logger *zap.SugaredLogger, pr *v1beta1 childRefByName[r.Name] = &v1beta1.ChildStatusReference{ TypeMeta: runtime.TypeMeta{ APIVersion: v1alpha1.SchemeGroupVersion.String(), - Kind: "Run", + Kind: pipeline.RunControllerName, }, Name: r.Name, PipelineTaskName: pipelineTaskName, diff --git a/pkg/reconciler/pipelinerun/resources/pipelinerunstate.go b/pkg/reconciler/pipelinerun/resources/pipelinerunstate.go index 140c2521728..1f5fb9dc9a8 100644 --- a/pkg/reconciler/pipelinerun/resources/pipelinerunstate.go +++ b/pkg/reconciler/pipelinerun/resources/pipelinerunstate.go @@ -262,7 +262,7 @@ func (state PipelineRunState) GetChildReferences() []v1beta1.ChildStatusReferenc func (t *ResolvedPipelineTask) getChildRefForRun() v1beta1.ChildStatusReference { return v1beta1.ChildStatusReference{ TypeMeta: runtime.TypeMeta{ - APIVersion: t.Run.APIVersion, + APIVersion: v1alpha1.SchemeGroupVersion.String(), Kind: pipeline.RunControllerName, }, Name: t.RunName, @@ -274,7 +274,7 @@ func (t *ResolvedPipelineTask) getChildRefForRun() v1beta1.ChildStatusReference func (t *ResolvedPipelineTask) getChildRefForTaskRun(taskRun *v1beta1.TaskRun) v1beta1.ChildStatusReference { return v1beta1.ChildStatusReference{ TypeMeta: runtime.TypeMeta{ - APIVersion: taskRun.APIVersion, + APIVersion: v1beta1.SchemeGroupVersion.String(), Kind: pipeline.TaskRunControllerName, }, Name: taskRun.Name,