forked from tektoncd/pipeline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
using_context_variables.yaml
48 lines (48 loc) · 1.63 KB
/
using_context_variables.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
kind: PipelineRun
apiVersion: tekton.dev/v1
metadata:
generateName: test-pipelinerun-
spec:
taskRunTemplate:
serviceAccountName: 'default'
pipelineSpec:
tasks:
- name: task1
retries: 7
params:
- name: pipeline-uid
value: "$(context.pipelineRun.uid)"
- name: pipeline-name
value: "$(context.pipeline.name)"
- name: pipelineRun-name
value: "$(context.pipelineRun.name)"
- name: pipelineRun-namespace
value: "$(context.pipelineRun.namespace)"
- name: pipelineTask-retries
value: "$(context.pipelineTask.retries)"
taskSpec:
params:
- name: pipeline-uid
- name: pipeline-name
- name: pipelineRun-name
- name: pipelineRun-namespace
- name: pipelineTask-retries
steps:
- image: ubuntu
name: print-uid
script: |
echo "TaskRun UID: $(context.taskRun.uid)"
echo "PipelineRun UID from params: $(params.pipeline-uid)"
- image: ubuntu
name: print-names
script: |
echo "Task name: $(context.task.name)"
echo "TaskRun name: $(context.taskRun.name)"
echo "Pipeline name from params: $(params.pipeline-name)"
echo "PipelineRun name from params: $(params.pipelineRun-name)"
echo "PipelineRun namespace from params: $(params.pipelineRun-namespace)"
- image: ubuntu
name: print-retries
script: |
echo "PipelineTask retries from params: $(params.pipelineTask-retries)"
echo "PipelineTask current retry count: $(context.task.retry-count)"