Skip to content

Commit

Permalink
Check of passed constraint should use pipeline task
Browse files Browse the repository at this point in the history
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
  • Loading branch information
nader-ziada committed Oct 26, 2018
1 parent 5a3499f commit 1c605e6
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
1 change: 1 addition & 0 deletions docs/using.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion examples/pipelines/guestbook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions examples/pipelines/kritis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -42,7 +41,7 @@ spec:
key: workspace
resourceRef:
name: kritis-resources-image
passedConstraints: [build-push]
passedConstraints: [push-kritis]
params:
- name: pathToHelmCharts
value: kritis-charts
Expand All @@ -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"
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ var mypipelinetasks = []v1alpha1.PipelineTask{{
ResourceRef: v1alpha1.PipelineResourceRef{
Name: "myresource1",
},
PassedConstraints: []string{"mytask1"},
PassedConstraints: []string{"mypipelinetask1"},
}},
}}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 1c605e6

Please sign in to comment.