-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathTaskfile.yml
More file actions
73 lines (66 loc) · 2.39 KB
/
Taskfile.yml
File metadata and controls
73 lines (66 loc) · 2.39 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
version: "3"
vars:
APP_NAME: config-db
REGISTRY: '{{.REGISTRY | default "docker.lab"}}'
IMAGE: '{{.REGISTRY}}/{{.APP_NAME}}'
VERSION:
sh: git describe --tags --always --dirty 2>/dev/null || echo "dev"
tasks:
default:
desc: Show available tasks
cmds:
- task --list
image:lab:
desc: "Build and push the config-db image to the lab registry. Defaults REGISTRY=docker.lab; override with REGISTRY=docker.example.com."
cmds:
- docker buildx build --platform linux/amd64 --push . -f build/Dockerfile -t {{.IMAGE}}:{{.VERSION}} -t {{.IMAGE}}:latest
deploy:lab:
desc: "Build, push, and patch the running config-db deployment in the current kubectl context. Defaults REGISTRY=docker.lab."
deps: [image:lab]
vars:
CURRENT_NAMESPACE:
sh: kubectl config view --minify --output 'jsonpath={..namespace}' 2>/dev/null || echo "default"
DEPLOYMENT:
sh: |
ns={{.CURRENT_NAMESPACE | default "default"}}
name=$(kubectl -n "$ns" get deploy \
-l app.kubernetes.io/name={{.APP_NAME}} \
-o jsonpath='{.items[0].metadata.name}' 2>/dev/null || true)
if [ -z "$name" ]; then
name=$(kubectl -n "$ns" get deploy \
-o jsonpath='{.items[?(@.metadata.name=="{{.APP_NAME}}")].metadata.name}' 2>/dev/null || true)
fi
echo "${name:-{{.APP_NAME}}}"
cmds:
- echo "Patching deploy/{{.DEPLOYMENT}} in namespace {{.CURRENT_NAMESPACE}} -> {{.IMAGE}}:{{.VERSION}}"
- >-
kubectl -n {{.CURRENT_NAMESPACE}} set image
deploy/{{.DEPLOYMENT}}
{{.APP_NAME}}={{.IMAGE}}:{{.VERSION}}
- kubectl -n {{.CURRENT_NAMESPACE}} rollout restart deploy/{{.DEPLOYMENT}}
- kubectl -n {{.CURRENT_NAMESPACE}} rollout status deploy/{{.DEPLOYMENT}} --timeout=300s
build:
desc: "Build the scrapeui bundle then the Go binary."
deps: [build:ui]
cmds:
- make build
build:ui:
desc: "Install npm deps and build the embedded scrapeui Vite bundle."
dir: cmd/scrapeui/frontend
sources:
- src/**/*
- package.json
- package-lock.json
- vite.config.ts
- tsconfig.json
generates:
- dist/scrapeui.js
cmds:
- npm install
- npm run build
build:ui:dev:
desc: "Run the scrapeui Vite dev server (live reload)."
dir: cmd/scrapeui/frontend
cmds:
- npm install
- npm run dev