forked from ansible/eda-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.dist.yaml
357 lines (303 loc) · 8.43 KB
/
Taskfile.dist.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
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
version: "3"
env:
DJANGO_SETTINGS_MODULE: "aap_eda.settings.development"
vars:
DOCKER_COMPOSE: '{{ default "docker-compose" .DOCKER_COMPOSE }}'
DOCKER_COMPOSE_ARGS: '{{ default "-p eda -f tools/docker/docker-compose-dev.yaml" .DOCKER_COMPOSE_ARGS }}'
PYTEST_CMD: "poetry run python -m pytest"
MINIKUBE_CMD: "scripts/eda_kube.sh"
SUSER_CMD: "scripts/create_superuser.sh"
PODMAN_CMD: "scripts/eda_podman.sh"
tasks:
default:
desc: "Show this message and exit"
cmds:
- command -v task > /dev/null && CMD=task || CMD=go-task; ${CMD} -l
silent: true
dev:init:
desc: "Initialize local development environment"
cmds:
- cmd: poetry install -E dev
- cmd: pre-commit install
run:api:
desc: "Run API server locally"
cmds:
- task: manage
vars:
CLI_ARGS: runserver
run:shell:
desc: "Run Django shell"
cmds:
- task: manage
vars:
CLI_ARGS: shell
run:scheduler:
desc: "Run tasking scheduler locally"
cmds:
- task: manage
vars:
CLI_ARGS: scheduler
run:worker:default:
desc: "Run default tasking worker locally"
cmds:
- task: manage
vars:
CLI_ARGS: rqworker --worker-class 'aap_eda.core.tasking.DefaultWorker'
run:worker:activation:
desc: "Run activaiton worker locally"
cmds:
- task: manage
vars:
CLI_ARGS: rqworker --worker-class 'aap_eda.core.tasking.ActivationWorker'
manage:
desc: "Run django management command"
cmds:
# This is a workaround for poetry incorrectly passing argv[0] to spawned subprocess
# See https://github.com/python-poetry/poetry/issues/965
- cmd: poetry run /usr/bin/env aap-eda-manage {{.CLI_ARGS}}
test:
desc: "Run project tests."
summary: |
Run poetry run python -m pytest with specified CLI arguments.
Example(s):
Run a single test module
$ task test -- tests/integration/api/test_activation.py
Run a single test from a module
$ task test -- tests/integration/api/test_activation.py::test_retrieve_activation
cmds:
- "{{.PYTEST_CMD}} {{.CLI_ARGS}}"
lint:
desc: "Run all linters."
cmds:
- task: lint:black
- task: lint:isort
- task: lint:ruff
- task: lint:flake8
- task: lint:migrations
lint:black:
desc: "Check code with `black`."
cmds:
- poetry run black -- {{.CLI_ARGS | default "."}}
lint:isort:
desc: "Check code with `isort`."
cmds:
- poetry run isort -- {{.CLI_ARGS | default "."}}
lint:ruff:
desc: "Check code with `flake8`."
cmds:
- poetry run ruff -- {{.CLI_ARGS | default "."}}
lint:flake8:
desc: "Check code with `flake8`."
cmds:
- poetry run flake8 -- {{.CLI_ARGS | default "."}}
lint:migrations:
desc: "Check that all migrations are up to date."
cmds:
- task: manage
vars:
CLI_ARGS: makemigrations --dry-run --check
format:
desc: "Run code formatters"
cmds:
- task: lint:isort
- task: lint:black
docker:
desc: "Run docker-compose with specified CLI arguments."
summary: |
Run docker-compose with specified CLI arguments.
Example:
$ task docker -- ls
cmds:
- "{{.DOCKER_COMPOSE}} {{.DOCKER_COMPOSE_ARGS}} {{.CLI_ARGS}}"
docker:build:
desc: "Build container images."
cmds:
- task: docker
vars:
CLI_ARGS: build
docker:up:
desc: "Start all services."
cmds:
- task: docker
vars:
CLI_ARGS: up --detach
docker:up:minimal:
desc: "Start minimal set of services (PostgreSQL, Redis)."
cmds:
- task: docker
vars:
CLI_ARGS: up --detach postgres redis
docker:up:postgres:
desc: "Start PostgreSQL service."
cmds:
- task: docker
vars:
CLI_ARGS: up --detach postgres
docker:migrate:
desc: "Apply database migrations."
cmds:
- task: docker
vars:
CLI_ARGS: run --rm eda-api aap-eda-manage migrate
docker:down:
desc: "Stop all services."
cmds:
- task: docker
vars:
CLI_ARGS: down
docker:purge:
desc: "Stop all containers and delete all volumes."
cmds:
- task: docker
vars:
CLI_ARGS: down --volumes --remove-orphans
docker:psql:
desc: "Open PostgreSQL console."
cmds:
- task: docker
vars:
CLI_ARGS: exec postgres psql -U postgres eda
docker:shell:api:
desc: "Run the management shell in api container"
cmds:
- task: docker
vars:
CLI_ARGS: exec -it eda-api aap-eda-manage shell
docker:shell:worker:
desc: "Run the management shell in worker container"
cmds:
- task: docker
vars:
CLI_ARGS: exec -it eda-worker aap-eda-manage shell
create:superuser:
desc: "create a superuser to use with EDA API."
summary: |
Run create_superuser.sh with specified CLI arguments. If no arguments are
given the following defaults are used.
Defaults:
user: admin
password: testpass
email: [email protected]
Examples:
$ task create:superuser
$ task create:superuser -- -u test_user -p none2tuff -e [email protected]
cmds:
- "{{.SUSER_CMD}} {{.CLI_ARGS}}"
minikube:
desc: "Run eda_kube.sh with specified CLI arguments."
summary: |
Run eda_kube.sh with specified CLI arguments.
Example:
$ task minikube -- build
cmds:
- "{{.MINIKUBE_CMD}} {{.CLI_ARGS}}"
minikube:build:
desc: "Build docker image and push to minikube"
cmds:
- task: minikube
vars:
CLI_ARGS: build {{.CLI_ARGS}}
minikube:build:api:
desc: "Build EDA api image and push to minikube"
cmds:
- task: minikube
vars:
CLI_ARGS: build-api {{.CLI_ARGS}}
minikube:build:ui:
desc: "Build EDA UI image and push to minikube"
cmds:
- task: minikube
vars:
CLI_ARGS: build-ui {{.CLI_ARGS}}
minikube:deploy:
desc: "Build deployment and deploy to minikube"
cmds:
- task: minikube
vars:
CLI_ARGS: deploy {{.CLI_ARGS}}
minikube:quay-deploy:
desc: "Build deployment from quay deploy to minikube"
cmds:
- task: minikube
vars:
CLI_ARGS: quay-deploy {{.CLI_ARGS}}
minikube:clean:
desc: "Clean deployment directory and clean minikube resources"
cmds:
- task: minikube
vars:
CLI_ARGS: clean {{.CLI_ARGS}}
minikube:clean:api:
desc: "Clean API related minikube resources"
cmds:
- task: minikube
vars:
CLI_ARGS: clean-api {{.CLI_ARGS}}
minikube:fp:ui:
desc: "Forward local port to ui instance port in minikube"
cmds:
- task: minikube
vars:
CLI_ARGS: port-forward-ui {{.CLI_ARGS}}
minikube:fp:api:
desc: "Forward local port to api instance port in minikube"
cmds:
- task: minikube
vars:
CLI_ARGS: port-forward-api {{.CLI_ARGS}}
minikube:fp:pg:
desc: "Forward local port to postgres instance port in minikube"
cmds:
- task: minikube
vars:
CLI_ARGS: port-forward-pg {{.CLI_ARGS}}
minikube:logs:eda:
desc: "Stream logs for EDA application"
cmds:
- task: minikube
vars:
CLI_ARGS: eda-logs {{.CLI_ARGS}}
minikube:all:
desc: "clean, build, deploy"
cmds:
- task: minikube:clean
- task: minikube:build
- task: minikube:deploy
minikube:api:
desc: "build, deploy api pods"
cmds:
- task: minikube:clean:api
- task: minikube:build:api
- task: minikube:deploy
macpodman:
desc: "Run eda_podman.sh with specified CLI arguments."
summary: |
Run eda_podman.sh with specified CLI arguments.
Example:
$ task podman -- help
cmds:
- "{{.PODMAN_CMD}} {{.CLI_ARGS}}"
macpodman:start:
desc: "start podman machine"
cmds:
- task: macpodman
vars:
CLI_ARGS: start
macpodman:stop:
desc: "stop podman machine"
cmds:
- task: macpodman
vars:
CLI_ARGS: stop
macpodman:restart:
desc: "restart podman machine"
cmds:
- task: macpodman
vars:
CLI_ARGS: restart
macpodman:tunnel:
desc: "tunnel for podman when running on host with docker"
cmds:
- task: macpodman
vars:
CLI_ARGS: tunnel