forked from tektoncd/pipeline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
object-param-result.yaml
49 lines (49 loc) · 1.33 KB
/
object-param-result.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
apiVersion: tekton.dev/v1
kind: TaskRun
metadata:
generateName: object-param-result-
spec:
params:
- name: gitrepo
value:
commit: "sha123"
taskSpec:
params:
- name: gitrepo
type: object
properties:
url: {type: string}
commit: {type: string}
default:
url: "github.example.com"
results:
- name: object-results
type: object
properties:
IMAGE_URL: {type: string}
IMAGE_DIGEST: {type: string}
steps:
- name: validate-object-params
image: mirror.gcr.io/bash
args: [
"$(params.gitrepo.url)",
"$(params.gitrepo.commit)"
]
script: |
if [[ $1 != "github.example.com" ]]; then
echo "Want: github.example.com, Got: $1"
exit 1
else
echo "validate the params.gitrepo.url successfully"
fi
if [[ $2 != "sha123" ]]; then
echo "Want: sha123, Got: $2"
exit 1
else
echo "validate the params.gitrepo.commit successfully"
fi
- name: write-object-result
image: mirror.gcr.io/bash
script: |
#!/usr/bin/env bash
echo -n "{\"IMAGE_URL\":\"ar.com\", \"IMAGE_DIGEST\":\"sha234\"}" > $(results.object-results.path)