-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTaskfile.yaml
218 lines (189 loc) · 6.11 KB
/
Taskfile.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
# https://taskfile.dev
version: "3"
silent: true
includes:
vm-route-forge:
taskfile: ./images/vm-route-forge
dir: ./images/vm-route-forge
virtualization-controller:
aliases: [controller]
taskfile: ./images/virtualization-artifact
dir: ./images/virtualization-artifact
hooks:
taskfile: ./hooks
dir: ./hooks
e2e:
taskfile: ./tests/e2e
dir: ./tests/e2e
perf:
taskfile: ./tests/performance
dir: ./tests/performance
vars:
deckhouse_lib_helm_ver: 1.7.0
TRIVY_VERSION: 0.55.0
target: ""
VALIDATION_FILES: "tools/validation/{main,messages,diff,no_cyrillic,doc_changes,copyright}.go"
DLV_IMAGE:
sh: if [ -z $DLV_IMAGE ]; then echo "ttl.sh/$(uuidgen | awk '{print tolower($0)}'):10m" ; else echo $DLV_IMAGE ; fi
tasks:
check-werf:
cmds:
- which werf >/dev/null || (echo "werf not found."; exit 1)
silent: true
check-yq:
cmds:
- which yq >/dev/null || (echo "yq not found."; exit 1)
silent: true
check-jq:
cmds:
- which jq >/dev/null || (echo "jq not found."; exit 1)
silent: true
check-helm:
cmds:
- which helm >/dev/null || (echo "helm not found."; exit 1)
silent: true
helm-update-subcharts:
deps:
- check-helm
cmds:
- helm repo add deckhouse https://deckhouse.github.io/lib-helm
- helm repo update deckhouse
- helm dep update
helm-bump-helm-lib:
deps:
- check-yq
cmds:
- yq -i '.dependencies[] |= select(.name == "deckhouse_lib_helm").version = "{{ .deckhouse_lib_helm_ver }}"' Chart.yaml
- task: helm-update-subcharts
build:
deps:
- check-werf
cmds:
- werf build {{ .target }}
dev:format:yaml:
desc: "Format non-templated YAML files, e.g. CRDs"
cmds:
- |
docker run --rm \
-v ./:/tmp/virt ghcr.io/deckhouse/virtualization/prettier:3.2.5 \
sh -c "cd /tmp/virt ; prettier -w \"**/*.yaml\" \"**/*.yml\""
dev:addlicense:
desc: |-
Add Flant CE license to files sh,go,py. Default directory is root of project, custom directory path can be passed like: "task dev:addlicense -- <somedir>"
cmds:
- |
{{if .CLI_ARGS}}
go run tools/addlicense/{main,variables,msg,utils}.go -directory {{ .CLI_ARGS }}
{{else}}
go run tools/addlicense/{main,variables,msg,utils}.go -directory ./
{{end}}
lint:
cmds:
- task: lint:doc-ru
- task: lint:prettier:yaml
- task: virtualization-controller:dvcr:lint
- task: virtualization-controller:lint
lint:doc-ru:
desc: "Check the correspondence between description fields in the original crd and the Russian language version"
cmds:
- |
docker run \
--rm -it -v "$PWD:/src" docker.io/fl64/d8-doc-ru-linter:v0.0.1-dev0 \
sh -c \
'for crd in /src/crds/*.yaml; do [[ "$(basename "$crd")" =~ ^doc-ru ]] || (echo ${crd}; /d8-doc-ru-linter -s "$crd" -d "/src/crds/doc-ru-$(basename "$crd")" -n /dev/null); done'
lint:prettier:yaml:
desc: "Check if yaml files are prettier-formatted."
cmds:
- |
docker run --rm \
-v ./:/tmp/virt ghcr.io/deckhouse/virtualization/prettier:3.2.5 \
sh -c "cd /tmp/virt ; prettier -c \"**/*.yaml\" \"**/*.yml\""
validation:no-cyrillic:
desc: "No cyrillic"
cmds:
- go run {{ .VALIDATION_FILES }} --type no-cyrillic
validation:doc-changes:
desc: "Doc-changes"
cmds:
- go run {{ .VALIDATION_FILES }} --type doc-changes
validation:copyright:
desc: "Check copyright"
cmds:
- go run {{ .VALIDATION_FILES }} --type copyright
validation:helm-templates:
desc: "Check Helm templates"
cmds:
- |
cd tools/kubeconform
./kubeconform.sh
cve:bin:
cmds:
- |
curl -LO https://github.com/aquasecurity/trivy/releases/download/v{{.TRIVY_VERSION}}/trivy_{{.TRIVY_VERSION}}_Linux-64bit.tar.gz
tar -zxvf trivy_{{.TRIVY_VERSION}}_Linux-64bit.tar.gz -C /opt/
mv /opt/trivy /usr/local/bin/trivy
chmod +x /usr/local/bin/trivy
cve:scan:
cmds:
- task: cve:bin
- tools/cve/scan-main.sh {{.REPORT_FILE_NAME}}
dlv:virt-controller:build:
desc: "Build image virt-controller with dlv"
cmd: docker build -f ./images/virt-controller/debug/dlv.Dockerfile -t "{{ .DLV_IMAGE }}" .
dlv:virt-controller:build-push:
desc: "Build and Push image virt-controller with dlv"
cmds:
- task: dlv:virt-controller:build
- docker push "{{ .DLV_IMAGE }}"
- task: dlv:virt-controller:print
dlv:virt-controller:print:
desc: "Print commands for debug"
env:
IMAGE: "{{ .DLV_IMAGE }}"
cmd: |
cat <<EOF
kubectl -n d8-virtualization patch deploy virt-controller --type='strategic' -p '{
"spec": {
"template": {
"spec": {
"containers": [ {
"name": "virt-controller",
"image": "${IMAGE}",
"ports": [ { "containerPort": 2345, "name": "dlv" } ]
}]
}
}
}
}'
kubectl -n d8-virtualization port-forward deploy/virt-controller 2345:2345
EOF
dlv:virt-handler:build:
desc: "Build image virt-handler with dlv"
cmd: docker build -f ./images/virt-handler/debug/dlv.Dockerfile -t "{{ .DLV_IMAGE }}" --platform linux/amd64 .
dlv:virt-handler:build-push:
desc: "Build and Push image virt-handler with dlv"
cmds:
- task: dlv:virt-handler:build
- docker push "{{ .DLV_IMAGE }}"
- task: dlv:virt-handler:print
dlv:virt-handler:print:
desc: "Print commands for debug"
env:
IMAGE: "{{ .DLV_IMAGE }}"
cmd: |
cat <<EOF
kubectl -n d8-virtualization patch ds virt-handler --type='strategic' -p '{
"spec": {
"template": {
"spec": {
"containers": [ {
"name": "virt-handler",
"image": "${IMAGE}",
"ports": [ { "containerPort": 2345, "name": "dlv" } ]
}]
}
}
}
}'
kubectl -n d8-virtualization port-forward pod/<virt-handler-pod> 2345:2345
EOF