From 1c605e6dbd68559f761163bb7e0f33a2b6095cc4 Mon Sep 17 00:00:00 2001 From: Nader Ziada Date: Fri, 26 Oct 2018 11:55:39 -0400 Subject: [PATCH] Check of passed constraint should use pipeline task it was using the task name to check the passed constraint dependency in the pipeline, but should be using pipeline task name instead to have better ux while writing the pipeline yaml --- docs/using.md | 1 + examples/pipelines/guestbook.yaml | 2 +- examples/pipelines/kritis.yaml | 7 +++---- .../pipelinerun/resources/passedconstraint_test.go | 2 +- .../v1alpha1/pipelinerun/resources/pipelinestate.go | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/using.md b/docs/using.md index 52909858c95..eaf7e1218cd 100644 --- a/docs/using.md +++ b/docs/using.md @@ -37,6 +37,7 @@ need. * The `passedConstraints` allows for `Tasks` to fan in and fan out, and ordering can be expressed explicitly using this key since a task needing a resource from a another task would have to run after. +* The name used in the `passedConstraints` is the name of `PipelineTask` ## Creating a Task diff --git a/examples/pipelines/guestbook.yaml b/examples/pipelines/guestbook.yaml index 67bb5f02663..a3c4c110455 100644 --- a/examples/pipelines/guestbook.yaml +++ b/examples/pipelines/guestbook.yaml @@ -53,7 +53,7 @@ spec: resourceRef: name: guestbook-resources-redis-docker passedConstraints: - - build-push + - build-redis params: - name: pathToFiles value: guestbook/all-in-one/guestbook-all-in-one.yaml diff --git a/examples/pipelines/kritis.yaml b/examples/pipelines/kritis.yaml index 0b688c3b3eb..7008fec3008 100644 --- a/examples/pipelines/kritis.yaml +++ b/examples/pipelines/kritis.yaml @@ -24,8 +24,7 @@ spec: key: workspace # bind to the name in the task resourceRef: name: kritis-resources-git - passedConstraints: - - unit-test-make + passedConstraints: [unit-test-kritis] outputSourceBindings: - name: kritisImage key: builtImage # bind to the name in the task @@ -42,7 +41,7 @@ spec: key: workspace resourceRef: name: kritis-resources-image - passedConstraints: [build-push] + passedConstraints: [push-kritis] params: - name: pathToHelmCharts value: kritis-charts @@ -57,7 +56,7 @@ spec: key: workspace resourceRef: name: kritis-resources-test-git - passedConstraints: [deploy-with-helm] + passedConstraints: [deploy-test-env] params: - name: testArgs value: "-e REMOTE_INTEGRATION=true" diff --git a/pkg/reconciler/v1alpha1/pipelinerun/resources/passedconstraint_test.go b/pkg/reconciler/v1alpha1/pipelinerun/resources/passedconstraint_test.go index cd6ba52fb36..4592835990f 100644 --- a/pkg/reconciler/v1alpha1/pipelinerun/resources/passedconstraint_test.go +++ b/pkg/reconciler/v1alpha1/pipelinerun/resources/passedconstraint_test.go @@ -78,7 +78,7 @@ var mypipelinetasks = []v1alpha1.PipelineTask{{ ResourceRef: v1alpha1.PipelineResourceRef{ Name: "myresource1", }, - PassedConstraints: []string{"mytask1"}, + PassedConstraints: []string{"mypipelinetask1"}, }}, }} diff --git a/pkg/reconciler/v1alpha1/pipelinerun/resources/pipelinestate.go b/pkg/reconciler/v1alpha1/pipelinerun/resources/pipelinestate.go index f40675507d2..7a89076ddb3 100644 --- a/pkg/reconciler/v1alpha1/pipelinerun/resources/pipelinestate.go +++ b/pkg/reconciler/v1alpha1/pipelinerun/resources/pipelinestate.go @@ -74,7 +74,7 @@ func canTaskRun(pt *v1alpha1.PipelineTask, state []*PipelineRunTaskRun) bool { for _, constrainingTaskName := range input.PassedConstraints { for _, prtr := range state { // the constraining task must have a successful task run to allow this task to run - if prtr.Task.Name == constrainingTaskName { + if prtr.PipelineTask.Name == constrainingTaskName { if prtr.TaskRun == nil { return false }