-
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.
TEP-0075: Add examples with object params and results
- Added a taskrun level example that uses object param and object result. - Added a pipeline level example that uses individual variables of an object param and uses the whole object param.
- Loading branch information
1 parent
8a7b0cf
commit 0c0f40e
Showing
2 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
examples/v1beta1/pipelineruns/alpha/pipeline-object-param.yaml
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,52 @@ | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: Task | ||
metadata: | ||
name: mock-clone-task | ||
spec: | ||
params: | ||
- name: arg | ||
type: object | ||
properties: | ||
url: | ||
type: string | ||
commit: | ||
type: string | ||
steps: | ||
- name: mock-clone-git | ||
image: bash | ||
args: [ | ||
"echo", | ||
"--url=$(params.arg.url)", | ||
"--commit=$(params.arg.commit)" | ||
] | ||
--- | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: Pipeline | ||
metadata: | ||
name: mock-clone-pipeline | ||
spec: | ||
params: | ||
- name: gitrepo | ||
properties: | ||
url: {} | ||
commit: {} | ||
tasks: | ||
- name: mock-clone | ||
params: | ||
- name: arg | ||
value: $(params.gitrepo[*]) | ||
taskRef: | ||
name: mock-clone-task | ||
--- | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: PipelineRun | ||
metadata: | ||
generateName: pipelinerun-object-param- | ||
spec: | ||
params: | ||
- name: gitrepo | ||
value: | ||
url: abc.com | ||
commit: sha123 | ||
pipelineRef: | ||
name: mock-clone-pipeline |
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,36 @@ | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: TaskRun | ||
metadata: | ||
generateName: object-param-result- | ||
spec: | ||
params: | ||
- name: gitrepo | ||
value: | ||
url: "xyz.com" | ||
commit: "sha123" | ||
taskSpec: | ||
params: | ||
- name: gitrepo | ||
type: object | ||
properties: | ||
url: {type: string} | ||
commit: {type: string} | ||
results: | ||
- name: object-results | ||
type: object | ||
properties: | ||
IMAGE_URL: {type: string} | ||
IMAGE_DIGEST: {type: string} | ||
steps: | ||
- name: echo-object-params | ||
image: bash | ||
args: [ | ||
"echo", | ||
"--url=$(params.gitrepo.url)", | ||
"--commit=$(params.gitrepo.commit)" | ||
] | ||
- name: write-object-result | ||
image: bash:latest | ||
script: | | ||
#!/usr/bin/env bash | ||
echo -n "{\"IMAGE_URL\":\"ar.com\", \"IMAGE_DIGEST\":\"sha234\"}" > $(results.object-results.path) |