Repository navigation
Expand file tree
/
Copy pathexample.yaml
More file actions
165 lines (145 loc) · 4.41 KB
/
Copy pathexample.yaml
File metadata and controls
165 lines (145 loc) · 4.41 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
tasks:
task1:
# context: default # optional; omit to use the "default" context
description: "Optional description for task1"
command:
- echo ${TASKCTL__ARGS} # TASKCTL__ARGS is populated by arguments passed to task. eg. taskctl run task task1 -- arg1 arg2
- echo {{ .Args | default 'some value' }} # .Args is populated by arguments passed to task. eg. taskctl run task task1 -- arg1 arg2
- echo {{ index .ArgsList 0 }} # .ArgsList is populated by list of arguments passed to task. eg. taskctl run task task1 -- arg1 arg2
- echo "My name is task1"
- echo ${VAR_NAME_1} - ${VAR_NAME_2}
- echo {{ .Task.Name }}
- pwd
env:
VAR_NAME: VAR_VALUE
variations:
- VAR_NAME_1: VARIATION_1
VAR_NAME_2: VARIATION_1
- VAR_NAME_1: VARIATION_2
VAR_NAME_2: VARIATION_2
dir: "{{ .Root }}/task/working/dir" # current directory by default
timeout: 10s
before: mkdir some-dir
after: rm -rf some-dir
exportAs: TASK1_STORED_OUTPUT
condition: git diff --exit-code
task2:
context: docker-context-name
command:
- echo "Hello from container"
- sleep {{ .sleep }}
env:
VAR_NAME: VAR_VALUE
variables:
sleep: 10
task3:
context: docker-compose-context
command:
- echo "Hello from container created by docker-compose"
- echo ${TASK1_STORED_OUTPUT}
env:
VAR_NAME: VAR_VALUE
task4:
context: kubectl
command:
- echo "I'm task4"
- env
- uname -a
task-to-be-triggered-by-watcher:
command:
- echo ${EVENT_NAME} ${EVENT_PATH}
task-with-variations:
command:
- GOOS=${GOOS} GOARCH=amd64 go build -o bin/binary_${GOOS} ./...
variations:
- GOOS: linux
- GOOS: darwin
- GOOS: windows
test-watch-task:
command:
- echo TASK1 $EVENT_NAME $EVENT_PATH
test-watch-task-2:
command:
- echo TASK1 $EVENT_NAME $EVENT_PATH
pipelines:
pipeline1:
- task: task1
dir: /tmp
condition: git diff --exit-code
- name: some-stage-name
task: task2
depends_on: task1
allow_failure: true
- task: task3
depends_on: task1 # task2 and task3 will run in parallel when task1 finished
variables:
sleep: 30
- task: task4
depends_on: [task1, some-stage-name]
env:
VAR_NAME: VAR_VALUE # overrides task env
watchers:
watcher1:
watch: ["README.*", "pkg/**/*.go"]
events: [create, write, remove, rename, chmod]
task: task1
test-watcher:
events: ["write", "rename"]
watch: ["docker-compose.yaml"]
task: test-watch-task
test-watcher-2:
events: ["write", "rename", "create"]
watch: ["*.yaml"]
task: test-watch-task-2
test-watcher-3:
events: ["write", "rename", "create"]
watch: ["*.md", "internal/**/*.go"]
exclude: "LICENSE.md"
task: test-watch-task-2
contexts:
default: # used by any task that sets no context; an empty one is used if not defined
executable:
bin: /bin/zsh
args:
- -c
env:
VAR_NAME: VAR_VALUE
quote: "'"
before: echo "SOME COMMAND TO RUN BEFORE EVERY TASK"
after: echo "SOME COMMAND TO RUN WHEN TASK FINISHED SUCCESSFULLY"
docker-context:
executable:
bin: /usr/local/bin/docker
args:
- run
- --rm
- alpine:latest
env:
DOCKER_HOST: "tcp://0.0.0.0:2375"
before: echo "SOME COMMAND TO RUN BEFORE TASK"
after: echo "SOME COMMAND TO RUN WHEN TASK FINISHED SUCCESSFULLY"
docker-compose-context:
dir: /app
executable:
bin: /usr/local/bin/docker-compose
args:
- run
- --rm
- api
env:
COMPOSE_FILE: /app/docker-compose-alternate.yaml
up: docker-compose up -d --build --force-recreate api # Executes once before first context usage
down: docker-compose down api # Executes once when all tasks done
kubectl:
executable:
bin: /usr/local/bin/kubectl
args:
- exec
- -n stage
- pod-name
env:
KUBECONFIG: "$HOME/.kube/alternate-config"
debug: true # debug enabled by default. To temporary disable run with "--debug=false" flag
dryrun: false # when true, validate task commands (render + parse) without executing them; valid tasks complete as "done". Also settable per-run with "--dry-run"
output: prefixed # default, prefixed, raw or json (default is the format on a TTY)
summary: true # show summary by default