Skip to content

Commit a67e601

Browse files
committed
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.
1 parent a0c7d31 commit a67e601

File tree

2 files changed

+88
-0
lines changed

2 files changed

+88
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
apiVersion: tekton.dev/v1beta1
2+
kind: Task
3+
metadata:
4+
name: mock-clone-task
5+
spec:
6+
params:
7+
- name: arg
8+
type: object
9+
properties:
10+
url:
11+
type: string
12+
commit:
13+
type: string
14+
steps:
15+
- name: mock-clone-git
16+
image: bash
17+
args: [
18+
"echo",
19+
"--url=$(params.arg.url)",
20+
"--commit=$(params.arg.commit)"
21+
]
22+
---
23+
apiVersion: tekton.dev/v1beta1
24+
kind: Pipeline
25+
metadata:
26+
name: mock-clone-pipeline
27+
spec:
28+
params:
29+
- name: gitrepo
30+
properties:
31+
url: {}
32+
commit: {}
33+
tasks:
34+
- name: mock-clone
35+
params:
36+
- name: arg
37+
value: $(params.gitrepo[*])
38+
taskRef:
39+
name: mock-clone-task
40+
---
41+
apiVersion: tekton.dev/v1beta1
42+
kind: PipelineRun
43+
metadata:
44+
generateName: pipelinerun-object-param-
45+
spec:
46+
params:
47+
- name: gitrepo
48+
value:
49+
url: abc.com
50+
commit: sha123
51+
pipelineRef:
52+
name: mock-clone-pipeline
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
apiVersion: tekton.dev/v1beta1
2+
kind: TaskRun
3+
metadata:
4+
generateName: object-param-result-
5+
spec:
6+
params:
7+
- name: gitrepo
8+
value:
9+
url: "xyz.com"
10+
commit: "sha123"
11+
taskSpec:
12+
params:
13+
- name: gitrepo
14+
type: object
15+
properties:
16+
url: {type: string}
17+
commit: {type: string}
18+
results:
19+
- name: object-results
20+
type: object
21+
properties:
22+
IMAGE_URL: {type: string}
23+
IMAGE_DIGEST: {type: string}
24+
steps:
25+
- name: echo-object-params
26+
image: bash
27+
args: [
28+
"echo",
29+
"--url=$(params.gitrepo.url)",
30+
"--commit=$(params.gitrepo.commit)"
31+
]
32+
- name: write-object-result
33+
image: bash:latest
34+
script: |
35+
#!/usr/bin/env bash
36+
echo -n "{\"IMAGE_URL\":\"ar.com\", \"IMAGE_DIGEST\":\"sha234\"}" > $(results.object-results.path)

0 commit comments

Comments
 (0)