Skip to content

Commit b8ca19d

Browse files
yuzichen12123tekton-robot
authored andcommitted
fix: fix %w formatting leak in user-facing error
1 parent 83039bd commit b8ca19d

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

pkg/reconciler/pipelinerun/pipelinerun.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ func (c *Reconciler) reconcile(ctx context.Context, pr *v1.PipelineRun, getPipel
454454
pr.Status.MarkRunning(v1.PipelineRunReasonResolvingPipelineRef.String(), message)
455455
return nil
456456
case errors.Is(err, apiserver.ErrReferencedObjectValidationFailed), errors.Is(err, apiserver.ErrCouldntValidateObjectPermanent):
457-
logger.Errorf("Failed dryRunValidation for PipelineRun %s: %w", pr.Name, err)
457+
logger.Errorf("Failed dryRunValidation for PipelineRun %s: %v", pr.Name, err)
458458
pr.Status.MarkFailed(v1.PipelineRunReasonFailedValidation.String(),
459459
"Failed dryRunValidation for PipelineRun %s: %s",
460460
pr.Name, pipelineErrors.WrapUserError(err))
@@ -690,7 +690,7 @@ func (c *Reconciler) reconcile(ctx context.Context, pr *v1.PipelineRun, getPipel
690690
if !rpt.IsCustomTask() {
691691
err := taskrun.ValidateResolvedTask(ctx, rpt.PipelineTask.Params, rpt.PipelineTask.Matrix, rpt.ResolvedTask)
692692
if err != nil {
693-
logger.Errorf("Failed to validate pipelinerun %s with error %w", pr.Name, err)
693+
logger.Errorf("Failed to validate pipelinerun %s with error %v", pr.Name, err)
694694
pr.Status.MarkFailed(v1.PipelineRunReasonFailedValidation.String(),
695695
"Validation failed for pipelinerun %s with error %s",
696696
pr.Name, pipelineErrors.WrapUserError(err))
@@ -699,7 +699,7 @@ func (c *Reconciler) reconcile(ctx context.Context, pr *v1.PipelineRun, getPipel
699699

700700
if config.FromContextOrDefaults(ctx).FeatureFlags.EnableParamEnum {
701701
if err := resources.ValidateParamEnumSubset(originalTasks[i].Params, pipelineSpec.Params, rpt.ResolvedTask); err != nil {
702-
logger.Errorf("Failed to validate pipelinerun %q with error %w", pr.Name, err)
702+
logger.Errorf("Failed to validate pipelinerun %q with error %v", pr.Name, err)
703703
pr.Status.MarkFailed(v1.PipelineRunReasonFailedValidation.String(),
704704
"Validation failed for pipelinerun with error %s",
705705
pipelineErrors.WrapUserError(err))
@@ -715,7 +715,7 @@ func (c *Reconciler) reconcile(ctx context.Context, pr *v1.PipelineRun, getPipel
715715
if err != nil {
716716
logger.Errorf("Error evaluating CEL %s: %v", pr.Name, err)
717717
pr.Status.MarkFailed(string(v1.PipelineRunReasonCELEvaluationFailed),
718-
"Error evaluating CEL %s: %w", pr.Name, pipelineErrors.WrapUserError(err))
718+
"Error evaluating CEL %s: %v", pr.Name, pipelineErrors.WrapUserError(err))
719719
return controller.NewPermanentError(err)
720720
}
721721
}
@@ -738,17 +738,17 @@ func (c *Reconciler) reconcile(ctx context.Context, pr *v1.PipelineRun, getPipel
738738
}
739739

740740
if err := resources.ValidatePipelineResults(pipelineSpec, pipelineRunFacts.State); err != nil {
741-
logger.Errorf("Failed to resolve pipeline result reference for %q with error %w", pr.Name, err)
741+
logger.Errorf("Failed to resolve pipeline result reference for %q with error %v", pr.Name, err)
742742
pr.Status.MarkFailed(v1.PipelineRunReasonInvalidPipelineResultReference.String(),
743-
"Failed to resolve pipeline result reference for %q with error %w",
743+
"Failed to resolve pipeline result reference for %q with error %v",
744744
pr.Name, err)
745745
return controller.NewPermanentError(err)
746746
}
747747

748748
if err := resources.ValidateOptionalWorkspaces(pipelineSpec.Workspaces, pipelineRunFacts.State); err != nil {
749-
logger.Errorf("Optional workspace not supported by task: %w", err)
749+
logger.Errorf("Optional workspace not supported by task: %v", err)
750750
pr.Status.MarkFailed(v1.PipelineRunReasonRequiredWorkspaceMarkedOptional.String(),
751-
"Optional workspace not supported by task: %w", pipelineErrors.WrapUserError(err))
751+
"Optional workspace not supported by task: %v", pipelineErrors.WrapUserError(err))
752752
return controller.NewPermanentError(err)
753753
}
754754

@@ -921,7 +921,7 @@ func (c *Reconciler) runNextSchedulableTask(ctx context.Context, pr *v1.Pipeline
921921
if err := rpt.EvaluateCEL(); err != nil {
922922
logger.Errorf("Final task %q is not executed, due to error evaluating CEL %s: %v", rpt.PipelineTask.Name, pr.Name, err)
923923
pr.Status.MarkFailed(string(v1.PipelineRunReasonCELEvaluationFailed),
924-
"Error evaluating CEL %s: %w", pr.Name, pipelineErrors.WrapUserError(err))
924+
"Error evaluating CEL %s: %v", pr.Name, pipelineErrors.WrapUserError(err))
925925
return controller.NewPermanentError(err)
926926
}
927927

@@ -959,9 +959,9 @@ func (c *Reconciler) runNextSchedulableTask(ctx context.Context, pr *v1.Pipeline
959959
// Validate parameter types in matrix after apply substitutions from Task Results
960960
if rpt.PipelineTask.IsMatrixed() {
961961
if err := resources.ValidateParameterTypesInMatrix(pipelineRunFacts.State); err != nil {
962-
logger.Errorf("Failed to validate matrix %q with error %w", pr.Name, err)
962+
logger.Errorf("Failed to validate matrix %q with error %v", pr.Name, err)
963963
pr.Status.MarkFailed(v1.PipelineRunReasonInvalidMatrixParameterTypes.String(),
964-
"Failed to validate matrix %q with error %w", pipelineErrors.WrapUserError(err))
964+
"Failed to validate matrix %q with error %v", pipelineErrors.WrapUserError(err))
965965
return controller.NewPermanentError(err)
966966
}
967967
}
@@ -1015,7 +1015,7 @@ func (c *Reconciler) createTaskRuns(ctx context.Context, rpt *resources.Resolved
10151015
params = append(params, rpt.PipelineTask.Params...)
10161016
if err := taskrun.ValidateEnumParam(ctx, params, rpt.ResolvedTask.TaskSpec.Params); err != nil {
10171017
pr.Status.MarkFailed(v1.PipelineRunReasonInvalidParamValue.String(),
1018-
"Invalid param value from PipelineTask \"%s\": %w",
1018+
"Invalid param value from PipelineTask \"%s\": %v",
10191019
rpt.PipelineTask.Name, pipelineErrors.WrapUserError(err))
10201020
return nil, controller.NewPermanentError(err)
10211021
}

0 commit comments

Comments
 (0)