'Tekton pipeline conditional run
I have a pipeline with following tasks.
- name: A
taskRef:
name: buildah-secondary-tag-task
runAfter:
- maven-prepare-package
when:
- input: "$(params.type)"
operator: in
values: ["app"]
- name: B
taskRef:
name: buildah-secondary-tag-task
runAfter:
- maven-prepare-package
when:
- input: "$(params.courtType)"
operator: in
values: ["bapp"]
- name: C
taskRef:
name: buildah-secondary-tag-task
runAfter:
- A
Task A and B are different depending on the params.type A or B is executed but Task C has to run after A or B has been exectued. How can I specify in the that condition in runAfter for task C
Solution 1:[1]
Using a single pipeline, you can not ensure task C would runAfter A and B, unless both A and B were executed, see docs somewhat hinting that "when" condition evaluating to false would block execution for tasks that "runAfter" that conditional task.
What you could try is to add some "finally" block, that would either trigger another Pipeline, or include your task C.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | SYN |