Skip to content

Commit

Permalink
minor followup to PR 7894
Browse files Browse the repository at this point in the history
- add comment on why we check param when generating error log
- add unit test that covers getting name from non-string param type

rh-pre-commit.version: 2.2.0
rh-pre-commit.check-secrets: ENABLED
  • Loading branch information
gabemontero authored and tekton-robot committed May 16, 2024
1 parent 1b74ff3 commit 3dab35e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,8 @@ func resolveTask(
case errors.Is(err, remote.ErrRequestInProgress):
return rt, err
case err != nil:
// some of the resolvers obtain the name from the parameters instead of from the TaskRef.Name field,
// so we account for both locations when constructing the error
name := pipelineTask.TaskRef.Name
if len(strings.TrimSpace(name)) == 0 {
name = resource.GenerateErrorLogString(string(pipelineTask.TaskRef.Resolver), pipelineTask.TaskRef.Params)
Expand Down
14 changes: 14 additions & 0 deletions pkg/resolution/resource/name_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,20 @@ func TestGenerateErrorLogString(t *testing.T) {
},
},
},
{
name: "goo-array",
resolverType: "bundle",
isPresent: true,
params: []v1.Param{
{
Name: resource.ParamName,
Value: v1.ParamValue{
Type: v1.ParamTypeArray,
ArrayVal: []string{resource.ParamName, "goo-array"},
},
},
},
},
{
name: "hoo",
resolverType: "cluster",
Expand Down

0 comments on commit 3dab35e

Please sign in to comment.