From 3e3ec27e622a654dee0b348cf9477139e5e1c717 Mon Sep 17 00:00:00 2001 From: Vincent Demeester Date: Tue, 6 Aug 2024 18:42:16 +0200 Subject: [PATCH] =?UTF-8?q?pkg/taskrunmetrics/fake=20shouldn't=20be=20impo?= =?UTF-8?q?rted=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit … in production code. It is used for unit-tests only. This might mess up the injection code and which code is executed when for metrics. Signed-off-by: Vincent Demeester --- pkg/reconciler/taskrun/taskrun.go | 2 -- pkg/reconciler/taskrun/taskrun_test.go | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/reconciler/taskrun/taskrun.go b/pkg/reconciler/taskrun/taskrun.go index 4259f1f9279..47a254af469 100644 --- a/pkg/reconciler/taskrun/taskrun.go +++ b/pkg/reconciler/taskrun/taskrun.go @@ -50,7 +50,6 @@ import ( resolution "github.com/tektoncd/pipeline/pkg/resolution/resource" "github.com/tektoncd/pipeline/pkg/spire" "github.com/tektoncd/pipeline/pkg/taskrunmetrics" - _ "github.com/tektoncd/pipeline/pkg/taskrunmetrics/fake" // Make sure the taskrunmetrics are setup "github.com/tektoncd/pipeline/pkg/trustedresources" "github.com/tektoncd/pipeline/pkg/workspace" "go.opentelemetry.io/otel/attribute" @@ -861,7 +860,6 @@ func (c *Reconciler) createPod(ctx context.Context, ts *v1.TaskSpec, tr *v1.Task var err error ts, err = workspace.Apply(ctx, *ts, tr.Spec.Workspaces, workspaceVolumes) - if err != nil { logger.Errorf("Failed to create a pod for taskrun: %s due to workspace error %v", tr.Name, err) return nil, err diff --git a/pkg/reconciler/taskrun/taskrun_test.go b/pkg/reconciler/taskrun/taskrun_test.go index ce23ebfa491..7e1b30f7ee5 100644 --- a/pkg/reconciler/taskrun/taskrun_test.go +++ b/pkg/reconciler/taskrun/taskrun_test.go @@ -55,6 +55,7 @@ import ( "github.com/tektoncd/pipeline/pkg/reconciler/volumeclaim" resolutioncommon "github.com/tektoncd/pipeline/pkg/resolution/common" remoteresource "github.com/tektoncd/pipeline/pkg/resolution/resource" + _ "github.com/tektoncd/pipeline/pkg/taskrunmetrics/fake" "github.com/tektoncd/pipeline/pkg/trustedresources" "github.com/tektoncd/pipeline/pkg/trustedresources/verifier" "github.com/tektoncd/pipeline/pkg/workspace"