diff --git a/pkg/reconciler/pipelinerun/resources/apply.go b/pkg/reconciler/pipelinerun/resources/apply.go index 02de076e65b..e271f9df40c 100644 --- a/pkg/reconciler/pipelinerun/resources/apply.go +++ b/pkg/reconciler/pipelinerun/resources/apply.go @@ -161,6 +161,9 @@ func ApplyPipelineTaskContexts(pt *v1beta1.PipelineTask) *v1beta1.PipelineTask { pt.Params = replaceParamValues(pt.Params, replacements, map[string][]string{}, map[string]map[string]string{}) if pt.IsMatrixed() { pt.Matrix.Params = replaceParamValues(pt.Matrix.Params, replacements, map[string][]string{}, map[string]map[string]string{}) + for i := range pt.Matrix.Include { + pt.Matrix.Include[i].Params = replaceParamValues(pt.Matrix.Include[i].Params, replacements, map[string][]string{}, map[string]map[string]string{}) + } } return pt } diff --git a/pkg/reconciler/pipelinerun/resources/apply_test.go b/pkg/reconciler/pipelinerun/resources/apply_test.go index e025da10436..26403b89efe 100644 --- a/pkg/reconciler/pipelinerun/resources/apply_test.go +++ b/pkg/reconciler/pipelinerun/resources/apply_test.go @@ -3260,7 +3260,15 @@ func TestApplyPipelineTaskContexts(t *testing.T) { Params: []v1beta1.Param{{ Name: "retries", Value: *v1beta1.NewStructuredValues("$(context.pipelineTask.retries)"), - }}}, + }}, + Include: []v1beta1.MatrixInclude{{ + Name: "build-1", + Params: []v1beta1.Param{{ + Name: "retries", + Value: *v1beta1.NewStructuredValues("$(context.pipelineTask.retries)"), + }}, + }}, + }, }, want: v1beta1.PipelineTask{ Retries: 5, @@ -3272,7 +3280,15 @@ func TestApplyPipelineTaskContexts(t *testing.T) { Params: []v1beta1.Param{{ Name: "retries", Value: *v1beta1.NewStructuredValues("5"), - }}}, + }}, + Include: []v1beta1.MatrixInclude{{ + Name: "build-1", + Params: []v1beta1.Param{{ + Name: "retries", + Value: *v1beta1.NewStructuredValues("5"), + }}, + }}, + }, }, }, { description: "context retries replacement with no defined retries", @@ -3285,7 +3301,15 @@ func TestApplyPipelineTaskContexts(t *testing.T) { Params: []v1beta1.Param{{ Name: "retries", Value: *v1beta1.NewStructuredValues("$(context.pipelineTask.retries)"), - }}}, + }}, + Include: []v1beta1.MatrixInclude{{ + Name: "build-1", + Params: []v1beta1.Param{{ + Name: "retries", + Value: *v1beta1.NewStructuredValues("$(context.pipelineTask.retries)"), + }}, + }}, + }, }, want: v1beta1.PipelineTask{ Params: []v1beta1.Param{{ @@ -3296,7 +3320,15 @@ func TestApplyPipelineTaskContexts(t *testing.T) { Params: []v1beta1.Param{{ Name: "retries", Value: *v1beta1.NewStructuredValues("0"), - }}}, + }}, + Include: []v1beta1.MatrixInclude{{ + Name: "build-1", + Params: []v1beta1.Param{{ + Name: "retries", + Value: *v1beta1.NewStructuredValues("0"), + }}, + }}, + }, }, }} { t.Run(tc.description, func(t *testing.T) {