diff --git a/pkg/pod/pod.go b/pkg/pod/pod.go index aeca4903147..8b0663f2084 100644 --- a/pkg/pod/pod.go +++ b/pkg/pod/pod.go @@ -277,7 +277,7 @@ func (b *Builder) Build(ctx context.Context, taskRun *v1beta1.TaskRun, taskSpec *metav1.NewControllerRef(taskRun, groupVersionKind), }, Annotations: podAnnotations, - Labels: MakeLabels(taskRun), + Labels: makeLabels(taskRun), }, Spec: corev1.PodSpec{ RestartPolicy: corev1.RestartPolicyNever, @@ -302,8 +302,8 @@ func (b *Builder) Build(ctx context.Context, taskRun *v1beta1.TaskRun, taskSpec }, nil } -// MakeLabels constructs the labels we will propagate from TaskRuns to Pods. -func MakeLabels(s *v1beta1.TaskRun) map[string]string { +// makeLabels constructs the labels we will propagate from TaskRuns to Pods. +func makeLabels(s *v1beta1.TaskRun) map[string]string { labels := make(map[string]string, len(s.ObjectMeta.Labels)+1) // NB: Set this *before* passing through TaskRun labels. If the TaskRun // has a managed-by label, it should override this default. diff --git a/pkg/pod/pod_test.go b/pkg/pod/pod_test.go index d7308ae829e..0345c9112c8 100644 --- a/pkg/pod/pod_test.go +++ b/pkg/pod/pod_test.go @@ -1264,7 +1264,7 @@ func TestMakeLabels(t *testing.T) { "foo": "bar", "hello": "world", } - got := MakeLabels(&v1beta1.TaskRun{ + got := makeLabels(&v1beta1.TaskRun{ ObjectMeta: metav1.ObjectMeta{ Name: taskRunName, Labels: map[string]string{ diff --git a/pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go b/pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go index d8e0393c2c3..bb915008214 100644 --- a/pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go +++ b/pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go @@ -363,7 +363,7 @@ func ResolvePipelineRunTask( rprt.PipelineTask.TaskRef.APIVersion != "" && rprt.PipelineTask.TaskRef.Kind != "" if rprt.IsCustomTask() { - rprt.RunName = GetRunName(pipelineRun.Status.Runs, task.Name, pipelineRun.Name) + rprt.RunName = getRunName(pipelineRun.Status.Runs, task.Name, pipelineRun.Name) run, err := getRun(rprt.RunName) if err != nil && !errors.IsNotFound(err) { return nil, fmt.Errorf("error retrieving Run %s: %w", rprt.RunName, err) @@ -450,9 +450,9 @@ func GetTaskRunName(taskRunsStatus map[string]*v1beta1.PipelineRunTaskRunStatus, return names.SimpleNameGenerator.RestrictLengthWithRandomSuffix(fmt.Sprintf("%s-%s", prName, ptName)) } -// GetRunName should return a unique name for a `Run` if one has not already +// getRunName should return a unique name for a `Run` if one has not already // been defined, and the existing one otherwise. -func GetRunName(runsStatus map[string]*v1beta1.PipelineRunRunStatus, ptName, prName string) string { +func getRunName(runsStatus map[string]*v1beta1.PipelineRunRunStatus, ptName, prName string) string { for k, v := range runsStatus { if v.PipelineTaskName == ptName { return k diff --git a/pkg/reconciler/testing/logger.go b/pkg/reconciler/testing/logger.go index 08ca1829e88..386e10837a7 100644 --- a/pkg/reconciler/testing/logger.go +++ b/pkg/reconciler/testing/logger.go @@ -23,7 +23,7 @@ import ( // SetupFakeContext sets up the the Context and the fake filtered informers for the tests. func SetupFakeContext(t *testing.T) (context.Context, []controller.Informer) { - ctx, _, informer := SetupFakeContextWithLabelKey(t) + ctx, _, informer := setupFakeContextWithLabelKey(t) cloudEventClientBehaviour := cloudevent.FakeClientBehaviour{ SendSuccessfully: true, } @@ -42,9 +42,9 @@ func TestLogger(t *testing.T) *zap.SugaredLogger { return logger.Sugar().Named(t.Name()) } -// SetupFakeContextWithLabelKey sets up the the Context and the fake informers for the tests +// setupFakeContextWithLabelKey sets up the the Context and the fake informers for the tests // The provided context includes the FilteredInformerFactory LabelKey. -func SetupFakeContextWithLabelKey(t zaptest.TestingT) (context.Context, context.CancelFunc, []controller.Informer) { +func setupFakeContextWithLabelKey(t zaptest.TestingT) (context.Context, context.CancelFunc, []controller.Informer) { ctx, c := context.WithCancel(logtesting.TestContextWithLogger(t)) ctx = controller.WithEventRecorder(ctx, record.NewFakeRecorder(1000)) ctx = filteredinformerfactory.WithSelectors(ctx, v1beta1.ManagedByLabelKey)