diff --git a/examples/v1beta1/pipelineruns/pipelinerun-results-with-params.yml b/examples/v1beta1/pipelineruns/pipelinerun-results-with-params.yaml similarity index 100% rename from examples/v1beta1/pipelineruns/pipelinerun-results-with-params.yml rename to examples/v1beta1/pipelineruns/pipelinerun-results-with-params.yaml diff --git a/pkg/apis/pipeline/v1beta1/pipeline_types.go b/pkg/apis/pipeline/v1beta1/pipeline_types.go index fed2d11bc8a..e564855860d 100644 --- a/pkg/apis/pipeline/v1beta1/pipeline_types.go +++ b/pkg/apis/pipeline/v1beta1/pipeline_types.go @@ -152,6 +152,27 @@ func (pt PipelineTask) Deps() []string { for _, rd := range cond.Resources { deps = append(deps, rd.From...) } + for _, param := range cond.Params { + expressions, ok := GetVarSubstitutionExpressionsForParam(param) + if ok { + if resultRefs, err := NewResultRefs(expressions); err == nil { + for _, resultRef := range resultRefs { + deps = append(deps, resultRef.PipelineTask) + } + } + } + } + } + // Add any dependents from task results + for _, param := range pt.Params { + expressions, ok := GetVarSubstitutionExpressionsForParam(param) + if ok { + if resultRefs, err := NewResultRefs(expressions); err == nil { + for _, resultRef := range resultRefs { + deps = append(deps, resultRef.PipelineTask) + } + } + } } return deps } diff --git a/pkg/reconciler/pipeline/dag/dag_test.go b/pkg/reconciler/pipeline/dag/dag_test.go index 3f70a6d0425..e99fffea76e 100644 --- a/pkg/reconciler/pipeline/dag/dag_test.go +++ b/pkg/reconciler/pipeline/dag/dag_test.go @@ -42,8 +42,15 @@ func testGraph(t *testing.T) *dag.Graph { }, { Name: "b", }, { - Name: "w", - RunAfter: []string{"b", "y"}, + Name: "w", + Params: []v1alpha1.Param{{ + Name: "foo", + Value: v1alpha1.ArrayOrString{ + Type: v1alpha1.ParamTypeString, + StringVal: "$(tasks.y.results.bar)", + }, + }}, + RunAfter: []string{"b"}, }, { Name: "x", RunAfter: []string{"a"},