-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
193 lines (158 loc) · 8.08 KB
/
Taskfile.yml
File metadata and controls
193 lines (158 loc) · 8.08 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
version: "3"
vars:
MODULE: github.com/jtomasevic/cloud-forge
REGISTRY: ghcr.io/jtomasevic/cloud-forge
tasks:
# ── Dev cluster lifecycle ────────────────────────────────────────────────────
dev:up:
desc: Start local k3d cluster, bootstrap base infrastructure, and deploy ScyllaDB
cmds:
- k3d cluster create --config deploy/k3d/cluster.yaml
- kubectl apply -k deploy/kustomize/base/
- bash scripts/dev-bootstrap.sh
- task: deploy:scylladb
dev:down:
desc: Stop and delete local k3d cluster
cmds:
- k3d cluster delete cloudforge-dev
dev:reset:
desc: Destroy and recreate local cluster from scratch
cmds:
- task: dev:down
- task: dev:up
dev:status:
desc: Show cluster node and pod status
cmds:
- k3d cluster list
- kubectl get pods -A
# ── Component deployment ─────────────────────────────────────────────────────
deploy:component:
desc: "Deploy a named CloudForge component. Usage: task deploy:component -- cf-iam"
cmds:
- helm upgrade --install {{.CLI_ARGS}} deploy/helm/components/{{.CLI_ARGS}} -n cf-system --create-namespace
# ── ScyllaDB ─────────────────────────────────────────────────────────────────
deploy:scylladb:
desc: Install Scylla Operator (Helm) and provision the dev ScyllaDB cluster and schema
vars:
SCYLLA_OPERATOR_VERSION: "1.15.0"
cmds:
- echo "── Adding ScyllaDB Helm repo ────────────────────────────────────────"
- helm repo add scylladb https://storage.googleapis.com/scylla-operator-charts/stable --force-update
- helm repo update scylladb
- echo "── Installing / upgrading Scylla Operator v{{.SCYLLA_OPERATOR_VERSION}} ──"
- helm upgrade --install scylla-operator scylladb/scylla-operator
--namespace scylla-operator
--create-namespace
--version {{.SCYLLA_OPERATOR_VERSION}}
-f deploy/helm/components/scylla-operator/values.yaml
--wait
- echo "── Applying ScyllaDB cluster and schema resources ───────────────────"
- kubectl apply -k deploy/kustomize/components/scylladb/
- task: wait:scylladb
wait:scylladb:
desc: Wait for ScyllaDB cluster Available condition and schema init Job to complete
cmds:
- echo "Waiting for ScyllaCluster cloudforge-scylla to become Available (up to 5 min)..."
- kubectl wait scyllacluster/cloudforge-scylla
--for='condition=Available'
--timeout=300s
-n cf-data
- echo "Waiting for schema init Job to complete (up to 2 min)..."
- kubectl wait job/scylladb-schema-init
--for=condition=complete
--timeout=120s
-n cf-data
- echo "✓ ScyllaDB is ready."
scylladb:status:
desc: Show ScyllaDB cluster and pod status
cmds:
- echo "── ScyllaCluster ───────────────────────────────────────────────────"
- kubectl get scyllacluster -n cf-data
- echo "── Pods ────────────────────────────────────────────────────────────"
- kubectl get pods -n cf-data -l scylla/cluster=cloudforge-scylla
- echo "── Schema init Job ─────────────────────────────────────────────────"
- kubectl get job scylladb-schema-init -n cf-data 2>/dev/null || echo "(not yet deployed)"
undeploy:scylladb:
desc: Remove ScyllaDB cluster, schema resources, and Scylla Operator
cmds:
- kubectl delete -k deploy/kustomize/components/scylladb/ --ignore-not-found
- helm uninstall scylla-operator -n scylla-operator --ignore-not-found
- kubectl delete namespace scylla-operator --ignore-not-found
# ── Code generation ──────────────────────────────────────────────────────────
gen:api:
desc: "Generate server stubs and client SDK from OpenAPI spec. Usage: task gen:api -- storage"
cmds:
- oapi-codegen --config api/{{.CLI_ARGS}}/v1/oapi-server.cfg.yaml api/{{.CLI_ARGS}}/v1/openapi.yaml
- oapi-codegen --config api/{{.CLI_ARGS}}/v1/oapi-client.cfg.yaml api/{{.CLI_ARGS}}/v1/openapi.yaml
gen:all:
desc: Regenerate all OpenAPI server stubs and client SDKs
cmds:
- for: [ai, database, events, functions, gateway, iam, observability, resource, secrets, storage]
cmd: task gen:api -- {{.ITEM}}
# ── Testing ──────────────────────────────────────────────────────────────────
test:unit:
desc: Run unit tests (excludes integration tests)
cmds:
- go test -short -race -count=1 ./...
test:integration:
desc: Run integration tests (requires Docker for testcontainers)
cmds:
- go test -tags=integration -race -count=1 -timeout=120s ./...
test:all:
desc: Run all tests
cmds:
- task: test:unit
- task: test:integration
test:coverage:
desc: Run unit tests with coverage report
cmds:
- go test -short -race -coverprofile=coverage.out ./...
- go tool cover -html=coverage.out -o coverage.html
- echo "Coverage report written to coverage.html"
# ── Linting and formatting ───────────────────────────────────────────────────
lint:
desc: Run golangci-lint
cmds:
- golangci-lint run ./...
lint:fix:
desc: Run golangci-lint with auto-fix
cmds:
- golangci-lint run --fix ./...
fmt:
desc: Format all Go files
cmds:
- goimports -w -local {{.MODULE}} .
- gofmt -w .
# ── Build ────────────────────────────────────────────────────────────────────
build:
desc: Build all CloudForge binaries to ./bin/
cmds:
- mkdir -p bin
- for: [cf, cf-install, cf-iam, cf-secrets, cf-resource, cf-events, cf-functions, cf-db, cf-gateway, cf-observe, cf-ai]
cmd: go build -trimpath -ldflags="-s -w" -o bin/{{.ITEM}} ./cmd/{{.ITEM}}
build:service:
desc: "Build a single service binary. Usage: task build:service -- cf-iam"
cmds:
- mkdir -p bin
- go build -trimpath -ldflags="-s -w" -o bin/{{.CLI_ARGS}} ./cmd/{{.CLI_ARGS}}
# ── Container images ─────────────────────────────────────────────────────────
image:build:
desc: "Build a container image for a service using ko. Usage: task image:build -- cf-iam"
cmds:
- ko build --local ./cmd/{{.CLI_ARGS}}
image:push:
desc: "Build and push a container image. Usage: task image:push -- cf-iam"
env:
KO_DOCKER_REPO: "{{.REGISTRY}}"
cmds:
- ko build ./cmd/{{.CLI_ARGS}}
# ── Utilities ────────────────────────────────────────────────────────────────
tidy:
desc: Run go mod tidy across the workspace
cmds:
- go work sync
- go mod tidy
clean:
desc: Remove build artifacts
cmds:
- rm -rf bin/ coverage.out coverage.html dist/