Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error message when a PipelineRun param is missing #8072

Merged
merged 4 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/reconciler/pipelinerun/pipelinerun.go
Original file line number Diff line number Diff line change
Expand Up @@ -489,8 +489,8 @@ func (c *Reconciler) reconcile(ctx context.Context, pr *v1.PipelineRun, getPipel
if err := resources.ValidateRequiredParametersProvided(&pipelineSpec.Params, &pr.Spec.Params); err != nil {
// This Run has failed, so we need to mark it as failed and stop reconciling it
pr.Status.MarkFailed(v1.PipelineRunReasonParameterMissing.String(),
"PipelineRun %s parameters is missing some parameters required by Pipeline %s's parameters: %s",
pr.Namespace, pr.Name, err)
"PipelineRun %s/%s is missing some parameters required by Pipeline %s/%s: %s",
pr.Namespace, pr.Name, pr.Namespace, pipelineMeta.Name, err)
return controller.NewPermanentError(err)
}

Expand Down
22 changes: 19 additions & 3 deletions pkg/reconciler/pipelinerun/pipelinerun_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -956,10 +956,26 @@ spec:
"Warning Failed [User error] PipelineRun foo/embedded-pipeline-mismatching-param-type parameters have mismatching types with Pipeline foo/embedded-pipeline-mismatching-param-type's parameters: parameters have inconsistent types : [some-param]",
},
}, {
name: "invalid-pipeline-run-missing-params-shd-stop-reconciling",
name: "invalid-pipeline-run-missing-params-with-ref-shd-stop-reconciling",
pipelineRun: parse.MustParseV1PipelineRun(t, `
metadata:
name: pipelinerun-missing-params-1
namespace: foo
spec:
pipelineRef:
name: a-pipeline-with-array-params
`),
reason: v1.PipelineRunReasonParameterMissing.String(),
permanentError: true,
wantEvents: []string{
"Normal Started",
"Warning Failed [User error] PipelineRun foo/pipelinerun-missing-params-1 is missing some parameters required by Pipeline foo/a-pipeline-with-array-params: pipelineRun missing parameters: [some-param]",
},
}, {
name: "invalid-pipeline-run-missing-params-with-spec-shd-stop-reconciling",
pipelineRun: parse.MustParseV1PipelineRun(t, fmt.Sprintf(`
metadata:
name: pipelinerun-missing-params
name: pipelinerun-missing-params-2
namespace: foo
spec:
pipelineSpec:
Expand All @@ -975,7 +991,7 @@ spec:
permanentError: true,
wantEvents: []string{
"Normal Started",
"Warning Failed [User error] PipelineRun foo parameters is missing some parameters required by Pipeline pipelinerun-missing-params's parameters: pipelineRun missing parameters: [some-param]",
"Warning Failed [User error] PipelineRun foo/pipelinerun-missing-params-2 is missing some parameters required by Pipeline foo/pipelinerun-missing-params-2: pipelineRun missing parameters: [some-param]",
},
}, {
name: "invalid-pipeline-with-invalid-dag-graph",
Expand Down