-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathTaskfile.deps.yml
More file actions
437 lines (394 loc) · 12.6 KB
/
Copy pathTaskfile.deps.yml
File metadata and controls
437 lines (394 loc) · 12.6 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
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
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
# Copyright AGNTCY Contributors (https://github.com/agntcy)
# SPDX-License-Identifier: Apache-2.0
version: "3"
tasks:
default:
cmd: echo "Run the main Taskfile instead of this one."
##
## Setup
##
deps:
desc: Install dependencies
cmds:
- task: deps:dirctl
- task: deps:helm
- task: deps:kubectl
- task: deps:kind
- task: deps:protoc
- task: deps:bufbuild
- task: deps:uv
- task: deps:cosign
- task: deps:trivy
- task: deps:golangci-lint
- task: deps:licensei
- task: deps:multimod-bin
- task: deps:renovate
- task: deps:yq
- task: deps:pre-commit
- task: deps:cleanup
deps:bin-dir:
desc: Create bin directory
run: once
cmd: mkdir -p {{.BIN_DIR}}
status:
- test -d {{.BIN_DIR}}
deps:controller-gen:
desc: Ensure controller-gen is installed
internal: true
preconditions:
- which go
cmds:
- cmd: go install {{.CONTROLLER_GEN_BIN}}
status:
- which controller-gen
deps:cleanup:
desc: Remove binaries in BIN_DIR except those currently used by the Taskfile
preconditions:
- test -d {{.BIN_DIR}}
cmd: |
kept="{{.BIN_DIR}}/Taskfile.yml
{{.DIRCTL_BIN}}
{{.HELM_BIN}}
{{.KUBECTL_BIN}}
{{.KIND_BIN}}
{{.PROTOC_BIN}}
{{.BUFBUILD_BIN}}
{{.MULTIMOD_BIN}}
{{.YQ_BIN}}
{{.GOLANGCI_LINT_BIN}}
{{.LICENSEI_BIN}}
{{.UV_BIN}}
{{.COSIGN_BIN}}
{{.PRE_COMMIT_PYZ}}
{{.TRIVY_BIN}}"
echo "Clean up unused/outdated binaries in {{.BIN_DIR}}"
for f in {{.BIN_DIR}}/*; do
[ -f "$f" ] || continue
echo "$kept" | grep -qFx "$f" && continue
rm -f "$f" && echo "Removed unused $f"
done
##
## Tool installers
##
deps:dirctl:
desc: Compile dirctl binary
internal: true
run: once
cmds:
- task: cli:compile
status:
- test -f {{.DIRCTL_BIN}}
deps:helm:
desc: Ensure supported Helm version is installed
internal: true
deps:
- deps:bin-dir
preconditions:
- which curl
- which tar
cmds:
- cmd: echo "Downloading Helm v{{.HELM_VERSION}}..."
- cmd: curl -sSfL 'https://get.helm.sh/helm-v{{.HELM_VERSION}}-{{OS}}-{{ARCH}}.tar.gz' --output - | tar xzvOf - '{{OS}}-{{ARCH}}/helm' > {{.HELM_BIN}}
- cmd: chmod +x {{.HELM_BIN}}
status:
- test -x {{.HELM_BIN}}
deps:kubectl:
desc: Ensure supported kubectl version is installed
internal: true
deps:
- deps:bin-dir
preconditions:
- which curl
cmds:
- cmd: echo "Downloading Kubectl v{{.KUBECTL_VERSION}}..."
- cmd: curl -L "https://dl.k8s.io/release/v{{.KUBECTL_VERSION}}/bin/{{OS}}/{{ARCH}}/kubectl" -o {{.KUBECTL_BIN}}
- cmd: chmod +x {{.KUBECTL_BIN}}
status:
- test -x {{.KUBECTL_BIN}}
deps:kind:
desc: Ensure supported kind version is installed
internal: true
deps:
- deps:bin-dir
preconditions:
- which go
cmds:
- cmd: echo "Downloading Kind v{{.KIND_VERSION}}..."
- cmd: GOBIN={{.BIN_DIR}} go install sigs.k8s.io/kind@v{{.KIND_VERSION}}
- cmd: mv {{.BIN_DIR}}/kind {{.KIND_BIN}}
status:
- test -x {{.KIND_BIN}}
deps:protoc:
desc: Ensure supported Protoc version and plugins are installed
internal: true
deps:
- deps:bin-dir
preconditions:
- which go
- which curl
- which unzip
vars:
ARCH_TYPE: '{{ if eq ARCH "arm64" }}aarch_64{{ else if eq ARCH "amd64" }}x86_64{{else if eq ARCH "s390x"}}x390_64{{ else }}{{ARCH}}{{ end }}'
OS_VARIANT: '{{ if eq OS "darwin" }}osx-universal_binary{{ else if eq OS "windows" }}win64{{else}}linux-{{.ARCH_TYPE}}{{ end }}'
cmds:
- cmd: echo "Downloading Protoc v{{.PROTOC_VERSION}}..."
- cmd: |
curl -sL https://github.com/protocolbuffers/protobuf/releases/download/v{{.PROTOC_VERSION}}/protoc-{{.PROTOC_VERSION}}-{{.OS_VARIANT}}.zip -o {{.BIN_DIR}}/tmp.zip
unzip -j {{.BIN_DIR}}/tmp.zip "bin/protoc" -d {{.BIN_DIR}}
mv {{.BIN_DIR}}/protoc {{.PROTOC_BIN}}
rm {{.BIN_DIR}}/tmp.zip
- cmd: chmod +x {{.PROTOC_BIN}}
- cmd: echo "Downloading go plugins for protoc..."
- cmd: go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
- cmd: go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
- cmd: go install github.com/NathanBaulch/protoc-gen-cobra@latest
status:
- test -x {{.PROTOC_BIN}}
deps:bufbuild:
desc: Ensure supported bufbuild version is installed
internal: true
deps:
- deps:bin-dir
preconditions:
- which curl
vars:
ARCH_TYPE: '{{ if eq ARCH "amd64" }}x86_64{{ else }}{{ARCH}}{{ end }}'
cmds:
- cmd: echo "Downloading BufBuild v{{.BUFBUILD_VERSION}}..."
- cmd: |
curl -L "https://github.com/bufbuild/buf/releases/download/v{{.BUFBUILD_VERSION}}/buf-{{OS}}-{{.ARCH_TYPE}}" -o {{.BUFBUILD_BIN}}
- cmd: chmod +x {{.BUFBUILD_BIN}}
status:
- test -x {{.BUFBUILD_BIN}}
deps:golangci-lint:
desc: Install golangci-lint
internal: true
deps:
- deps:bin-dir
cmds:
- curl -sSfL https://golangci-lint.run/install.sh | sh -s -- -b {{.BIN_DIR}} v{{.GOLANGCI_LINT_VERSION}}
- mv {{.BIN_DIR}}/golangci-lint {{.GOLANGCI_LINT_BIN}}
- chmod +x {{.GOLANGCI_LINT_BIN}}
status:
- test -x {{.GOLANGCI_LINT_BIN}}
deps:licensei:
desc: Install licensei
internal: true
deps:
- deps:bin-dir
cmds:
- curl -sfL https://raw.githubusercontent.com/goph/licensei/master/install.sh | sh -s -- -b {{.BIN_DIR}} v{{.LICENSEI_VERSION}}
- mv {{.BIN_DIR}}/licensei {{.LICENSEI_BIN}}
- chmod +x {{.LICENSEI_BIN}}
status:
- test -x {{.LICENSEI_BIN}}
deps:multimod-bin:
desc: Build the multimod binary
internal: true
deps:
- deps:bin-dir
vars:
MULTIMOD_REPO_DIR: "{{ .BIN_DIR }}/opentelemetry-go-build-tools"
cmds:
- git clone https://github.com/open-telemetry/opentelemetry-go-build-tools --branch multimod/v{{.MULTIMOD_VERSION}} {{.MULTIMOD_REPO_DIR}}
- go build -C {{.MULTIMOD_REPO_DIR}}/multimod -o {{.MULTIMOD_BIN}} main.go
- rm -rf {{.MULTIMOD_REPO_DIR}}
status:
- test -x {{.MULTIMOD_BIN}}
deps:yq:
desc: Install yq
internal: true
deps:
- deps:bin-dir
preconditions:
- which go
cmds:
- GOBIN={{.BIN_DIR}} go install github.com/mikefarah/yq/v4@v{{.YQ_VERSION}}
- mv {{.BIN_DIR}}/yq {{.YQ_BIN}}
- chmod +x {{.YQ_BIN}}
status:
- test -x {{.YQ_BIN}}
deps:uv:
desc: Install uv
internal: true
deps:
- deps:bin-dir
env:
UV_INSTALL_DIR: "{{ .BIN_DIR }}"
cmds:
- curl -sfL https://astral.sh/uv/{{.UV_VERSION}}/install.sh | sh
- mv {{.BIN_DIR}}/uv {{.UV_BIN}}
- chmod +x {{.UV_BIN}}
- rm {{.BIN_DIR}}/uvx
status:
- test -x {{.UV_BIN}}
deps:cosign:
desc: Install sigstore cosign
internal: true
cmds:
- curl -sfL https://github.com/sigstore/cosign/releases/download/v{{.COSIGN_VERSION}}/cosign-{{OS}}-{{ARCH}} -o {{.BIN_DIR}}/cosign-{{.COSIGN_VERSION}}
- chmod +x {{.BIN_DIR}}/cosign-{{.COSIGN_VERSION}}
status:
- test -x {{.COSIGN_BIN}}
deps:trivy:
desc: Install trivy
internal: true
deps:
- deps:bin-dir
vars:
TRIVY_OS:
sh: uname -s | sed 's/Darwin/macOS/' | sed 's/Linux/Linux/'
TRIVY_ARCH:
sh: uname -m | sed 's/x86_64/64bit/' | sed 's/aarch64/ARM64/' | sed 's/arm64/ARM64/'
cmds:
- cmd: echo "Installing trivy v{{.TRIVY_VERSION}}..."
- cmd: |
curl -sfL https://github.com/aquasecurity/trivy/releases/download/v{{.TRIVY_VERSION}}/trivy_{{.TRIVY_VERSION}}_{{.TRIVY_OS}}-{{.TRIVY_ARCH}}.tar.gz | \
tar -xzf - -C {{.BIN_DIR}} trivy && \
mv {{.BIN_DIR}}/trivy {{.TRIVY_BIN}}
status:
- test -x {{.TRIVY_BIN}}
deps:htpasswd:
desc: Install htpasswd
internal: true
cmds:
- npm install -g htpasswd
deps:renovate:
desc: Install Renovate
internal: true
cmd: npm install -g renovate@{{.RENOVATE_VERSION}}
status:
- npm list -g renovate
deps:pre-commit:
desc: Install pre-commit
run: once
vars:
GIT_HOOKS_PATH:
sh: git config core.hooksPath || echo ""
# pre-commit doesn't work if core.hooksPath is set
if: '{{ eq .GIT_HOOKS_PATH "" }}'
cmds:
- curl -sL "https://github.com/pre-commit/pre-commit/releases/download/v{{.PRE_COMMIT_VERSION}}/pre-commit-{{.PRE_COMMIT_VERSION}}.pyz" -o {{.PRE_COMMIT_PYZ}}
- python3 {{.PRE_COMMIT_PYZ}} install
status:
- test -f {{.PRE_COMMIT_PYZ}}
deps:ginkgo:
desc: Install ginkgo
run: once
cmds:
- GOBIN="{{ .BIN_DIR }}" go install github.com/onsi/ginkgo/v2/ginkgo@v{{ .GINKGO_VERSION }}
- mv "{{ .BIN_DIR }}/ginkgo" "{{ .GINKGO_BIN }}"
status:
- test -f "{{ .GINKGO_BIN }}"
##
## Dependency management
##
deps:tidy:
desc: Ensure dependencies are up-to-date
cmds:
- for: { var: GO_MODULES }
cmd: go -C {{.ITEM}} mod tidy -go={{.GO_VERSION}}
deps:update:
desc: Update dependencies
cmds:
- for: { var: GO_MODULES }
cmd: |
echo "Updating dependencies in {{.ITEM}}" && \
go -C {{.ITEM}} get -u ./... && \
go -C {{.ITEM}} mod tidy -go={{.GO_VERSION}}
deps:renovate:sync:
desc: Sync dependencies with Renovate
summary: |
For extra CLI flags pass RENOVATE_OPTS (e.g. task deps:renovate:sync RENOVATE_OPTS='--dry-run').
Default platform is local so local runs do not touch remote project data.
Github Action CI sets RENOVATE_PLATFORM to github.
This step is only analytical without GITHUB TOKEN and will not update PRs or project data.
deps:
- deps:renovate
dir: "{{.ROOT_DIR}}"
vars:
RENOVATE_OPTS_DEFAULT: >-
--persist-repo-data 'true'
--allowed-post-upgrade-commands '[".*"]'
--post-upgrade-tasks '{"commands": ["task helm:gen", "task deps:tidy"], "executionMode": "branch"}'
RENOVATE_OPTS: "{{ .RENOVATE_OPTS | default .RENOVATE_OPTS_DEFAULT }}"
RENOVATE_PLATFORM_EFFECTIVE:
sh: printf '%s' "${RENOVATE_PLATFORM:-local}"
cmds:
- renovate {{.RENOVATE_OPTS}} --platform "{{.RENOVATE_PLATFORM_EFFECTIVE}}"
##
## Security scanning
##
deps:vuln:
desc: Run vulnerability check on all Go modules
deps:
- deps:trivy
cmd: |
{{.TRIVY_BIN}} clean --scan-cache
{{.TRIVY_BIN}} fs --scanners vuln --severity CRITICAL,HIGH,MEDIUM --ignore-unfixed {{.ROOT_DIR}}
deps:vuln:images:
desc: Run vulnerability check on container images
deps:
- deps:trivy
cmds:
- cmd: |
{{.TRIVY_BIN}} clean --scan-cache
- for: { var: VULN_SCAN_IMAGES }
cmd: |
echo "Scanning {{.ITEM}}..."
{{.TRIVY_BIN}} image --scanners vuln --severity CRITICAL,HIGH,MEDIUM --ignore-unfixed {{.ITEM}}
deps:vuln:images:list:
desc: Output vulnerability-scan image refs (one per line) for CI matrix
cmds:
- for: { var: VULN_SCAN_IMAGES }
cmd: echo "{{.ITEM}}"
##
## License
##
license:
desc: Check licenses
deps:
- task: deps:licensei
cmds:
- for: { var: GO_MODULES }
cmd: echo "Running licensei in {{.ITEM}}" && cd {{.ITEM}} && {{ .LICENSEI_BIN }} check --config {{.ROOT_DIR}}/.licensei.toml
license:cache:
desc: Check licenses
deps:
- task: deps:licensei
cmds:
- for: { var: GO_MODULES }
cmd: echo "Running licensei in {{.ITEM}}" && cd {{.ITEM}} && {{ .LICENSEI_BIN }} cache --config {{.ROOT_DIR}}/.licensei.toml
##
## Importer tools
##
deps:mcp-scanner:
desc: Install mcp-scanner CLI via uv
deps:
- task: deps:uv
cmds:
- cmd: echo "Installing mcp-scanner"
- cmd: >-
{{.UV_BIN}} tool install --python 3.13 cisco-ai-mcp-scanner=={{.MCP_SCANNER_VERSION}}
deps:skill-scanner:
desc: Install skill-scanner CLI via uv
deps:
- task: deps:uv
cmds:
- cmd: echo "Installing skill-scanner"
- cmd: >-
{{.UV_BIN}} tool install --python 3.13 cisco-ai-skill-scanner=={{.SKILL_SCANNER_VERSION}}
deps:a2a-scanner:
desc: Install a2a-scanner CLI via uv
deps:
- task: deps:uv
cmds:
- cmd: echo "Installing a2a-scanner"
- cmd: >-
{{.UV_BIN}} tool install --python 3.13 cisco-ai-a2a-scanner=={{.A2A_SCANNER_VERSION}}
deps:scanners:
desc: Install all security scanner CLIs (mcp-scanner, skill-scanner, and a2a-scanner) via uv
cmds:
- task: deps:mcp-scanner
- task: deps:skill-scanner
- task: deps:a2a-scanner