-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yml
108 lines (91 loc) · 3.25 KB
/
Taskfile.yml
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
---
version: '3'
# This Taskfile represents the primary control surface for developers interacting with
# this component.
#
# Primary "configure/build/deploy/test" tasks must be provided directly in this top level
# taskfile
#
# Infrequently used or pure sub-tasks should be in subservient taskfiles and included
# here.
#
# All tasks that are expected to be run directly by developers must have a meaningful
# 'desc' with all optional variables defined, in this file or in included files.
#
# All tasks that are internal sub-tasks only should have a meaningful 'summary'.
#
includes:
apis:
taskfile: ./taskfiles/Taskfile_apis.yml
# dev-notes/build-warts.md#always-set-dir-relative-to-current-task-file
dir: ./taskfiles
vars:
ACR: rkvstdev.azurecr.io
# Default to the stage master-latest builder image
# Note: the CI tags builder images with the build number of the avid-builder pipeline run,
# i.e. 20220607.10
# For local builder development build run `task builder` in the avid-builder git repo to
# build a new local builder image, then run these tasks like
# task generate BUILDER_ACR=rkvstdev.azurecr.io BUILDER_IMAGE_TAG=dev-$USER
BUILDER_ACR: rkvststage.azurecr.io
BUILDER_IMAGE_TAG: master-latest
BUILD_CONTAINER: go-datatrails-common-api-builder
tasks:
### -------------------------
# Docker container tasks
### -------------------------
builder-start:
summary: |
Creates the build container for go-datatrails-common-api
Many tasks docker exec into this container so DO NOT ADD --rm.
Use defer to cleanup the docker container in top level workflow tasks
which create the builder container
vars:
BUILDER_IMAGE: '{{.BUILDER_ACR}}/avid-builder:{{.BUILDER_IMAGE_TAG}}'
cmds:
- |
docker run \
--env CONCURRENCY={{.SKAFFOLD_CONCURRENCY | default 2}} \
--name {{.BUILD_CONTAINER}} \
-dt -u $(id -u):$(id -g) \
--mount type=bind,src=$(pwd),dst=/avid -w /avid \
{{.BUILDER_IMAGE}}
builder-cleanup:
summary: cleans up the forestrie build container
cmds:
- docker rm -f {{.BUILD_CONTAINER}}
### -------------------------
# Primary workflow tasks
### -------------------------
all:
desc: "do everything necessary after clone (or rebase) in the builder"
cmds:
- task: builder-start
- defer: {task: builder-cleanup}
- docker exec -t {{.BUILD_CONTAINER}} task local-all
local-all:
desc: |
do everything necessary after clone (or rebase) (faster as it RUNS ON NATIVE HOST)
Note: This requires go and protoc installed on your host. If you are not
comfortable doing this then use dockerall.
** The CI (ci.yml) uses this task and provides a clear illustration of the
pre-requisites. It does not use docker **
cmds:
- task: clean
- task: bootstrap
- task: generate
- task: apis:test
- task: apis:export
# 0. clean out generated and imported files
clean:
- rm -rf proto-include
- rm -rf exported
- task: apis:clean:generated
# 1. bootstrap (only needed post clone or rebase)
bootstrap:
- task: apis:bootstrap
# 2. generate
generate:
desc: generates all the artifacts we need pre-build
cmds:
- task: apis:generate