-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds an initial implementation for conditionals
In this implementation, condition evaluations aka ConditionChecks are backed by TaskRuns. All conditionChecks associated with a `PipelineTask` have to succeed before the task is executed. If a ConditionCheck fails, the PipelineTask's associated TaskRun is marked failed i.e. its `Status.ConditionSucceeded` is False. However, the PipelineRun itself is not marked as failed. Signed-off-by: Dibyo Mukherjee <dibyo@google.com>
- Loading branch information
Showing
13 changed files
with
1,686 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
apiVersion: tekton.dev/v1alpha1 | ||
kind: Condition | ||
metadata: | ||
name: always-true | ||
spec: | ||
check: | ||
image: alpine | ||
command: ["/bin/sh"] | ||
args: ['-c', 'cat /workspace/prmetadata.json'] | ||
--- | ||
apiVersion: tekton.dev/v1alpha1 | ||
kind: PipelineResource | ||
metadata: | ||
name: pipeline-git | ||
spec: | ||
type: git | ||
params: | ||
- name: revision | ||
value: master | ||
- name: url | ||
value: https://github.com/tektoncd/pipeline | ||
--- | ||
apiVersion: tekton.dev/v1alpha1 | ||
kind: Task | ||
metadata: | ||
name: list-files | ||
spec: | ||
inputs: | ||
resources: | ||
- name: workspace | ||
type: git | ||
steps: | ||
- name: run-ls | ||
image: ubuntu | ||
command: ["/bin/bash"] | ||
args: ['-c', 'ls -al ${inputs.resources.workspace.path}'] | ||
--- | ||
apiVersion: tekton.dev/v1alpha1 | ||
kind: Pipeline | ||
metadata: | ||
name: list-files-pipeline | ||
spec: | ||
resources: | ||
- name: source-repo | ||
type: git | ||
tasks: | ||
- name: list-files-0 | ||
taskRef: | ||
name: list-files | ||
resources: | ||
inputs: | ||
- name: workspace | ||
resource: source-repo | ||
- name: list-files-1 | ||
taskRef: | ||
name: list-files | ||
runAfter: | ||
- list-files-0 | ||
conditions: | ||
- conditionRef: "always-true" | ||
resources: | ||
inputs: | ||
- name: workspace | ||
resource: source-repo | ||
--- | ||
apiVersion: tekton.dev/v1alpha1 | ||
kind: PipelineRun | ||
metadata: | ||
name: demo-condtional-pr | ||
spec: | ||
pipelineRef: | ||
name: list-files-pipeline | ||
serviceAccount: 'default' | ||
resources: | ||
- name: source-repo | ||
resourceRef: | ||
name: pipeline-git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.