-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
208 lines (165 loc) · 8.58 KB
/
Copy pathMakefile
File metadata and controls
208 lines (165 loc) · 8.58 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
RELEASE ?= firebolt
NAMESPACE ?= firebolt
CHART := ./helm
VALUES_FILE := $(CHART)/values-dev.yaml
KIND_CLUSTER ?= firebolt-instance-helm
# Kubernetes version for the e2e kind cluster, pinned by digest as kind requires.
# Single source of truth: override on the CLI (`make prepare-test-e2e NODE_IMAGE=...`)
# or via the NODE_IMAGE env (the CI matrix sets it). Bump in one place here.
NODE_IMAGE ?= kindest/node:v1.35.0@sha256:452d707d4862f52530247495d180205e029056831160e22870e37e3f6c1ac31f
# Local Docker registry the kind node mirrors through (serves the private
# engine/metadata images locally so the node never anonymously pulls ghcr.io,
# and keeps a layer cache across cluster recreations). Override REGISTRY_PORT /
# REGISTRY_NAME if 5001 / kind-registry collide. Same defaults are baked into
# scripts/lib/setup-local-registry.sh.
REGISTRY_NAME ?= kind-registry
REGISTRY_PORT ?= 5001
# The ghcr.io/firebolt-db engine + metadata packages are now public, so the
# default is "true": the kind nodes pull every image directly from upstream and
# the local registry above, the containerd mirror wiring, and the
# image-publishing step are all skipped. Override to "false" only to exercise
# the private-package path (mirror the images through the local registry, pulled
# once on a host authenticated with `docker login ghcr.io`).
GHCR_PACKAGES_PUBLIC ?= true
# Agent verification depth. "false" (default) runs the fast SELECT 1 smoke query;
# "true" additionally runs the chart's full helm test suite after rollout. An
# iterating agent sets THOROUGH=true when its change warrants broader coverage.
THOROUGH ?= false
.DEFAULT_GOAL := help
.PHONY: \
help \
check-pre-commit \
check-helm-docs \
setup-pre-commit \
docs \
docs-check \
lint \
create \
delete \
floci \
install \
dev \
upgrade \
upgrade-dev \
uninstall \
cleanup \
test \
test-cleanup \
agent-up \
agent-verify \
agent-down \
prepare-test-e2e \
setup-local-registry \
setup-kind \
load-test-images \
helm-test \
flush-local-registry \
cleanup-test-e2e \
cleanup-local-registry
help: ## Show this help message
@printf '\033[33m%s\n' \
' _____ ___ ____ _____ ____ ___ _ _____ ' \
'| ___|_ _| _ \| ____| __ ) / _ \| | |_ _|' \
'| |_ | || |_) | _| | _ \| | | | | | | ' \
'| _| | || _ <| |___| |_) | |_| | |___ | | ' \
'|_| |___|_| \_\_____|____/ \___/|_____| |_| '
@printf '\033[0m\n'
@awk 'BEGIN {FS = ":.*##"; printf "Usage: make \033[36m<target>\033[0m\n\nTargets:\n"} \
/^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } \
/^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-24s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
##@ Tooling
check-helm-docs: ## Verify that helm-docs is installed
@command -v helm-docs >/dev/null 2>&1 || { \
echo "Error: helm-docs is not installed."; \
echo "Install it from https://github.com/norwoodj/helm-docs"; \
exit 1; \
}
check-pre-commit: ## Verify that pre-commit is installed
@command -v pre-commit >/dev/null 2>&1 || { \
echo "Error: pre-commit is not installed."; \
echo "Install it from https://github.com/pre-commit/pre-commit"; \
exit 1; \
}
setup-pre-commit: check-pre-commit check-helm-docs ## Install pre-commit hooks for this repo
pre-commit install
pre-commit install-hooks
##@ Docs
docs: check-helm-docs ## Regenerate chart documentation with helm-docs
helm-docs --chart-search-root=helm
docs-check: ## Validate Mintlify docs navigation (path depth and lost pages)
$(MAKE) -C docs check
##@ Lint
lint: ## Lint and template-render the helm chart
helm lint --strict $(CHART)
helm template $(RELEASE) $(CHART) > /dev/null
@echo "All helm checks passed."
##@ Local kind cluster (single-node dev)
create: ## Create a local kind cluster
kind create cluster
delete: ## Delete the local kind cluster
kind delete cluster
##@ Release lifecycle (install / upgrade / uninstall)
floci: ## Deploy floci S3 emulator + create the engine's managed_storage bucket in $(NAMESPACE)
kubectl create namespace $(NAMESPACE) --dry-run=client -o yaml | kubectl apply -f -
kubectl apply -n $(NAMESPACE) -f local-floci.yaml
kubectl rollout status deployment/floci -n $(NAMESPACE) --timeout=120s
kubectl wait --for=condition=complete job/floci-mkbucket -n $(NAMESPACE) --timeout=120s
install: ## Install the chart into $(NAMESPACE) with chart defaults (no overlay)
kubectl create namespace $(NAMESPACE) --dry-run=client -o yaml | kubectl apply -f -
helm install $(RELEASE) $(CHART) --namespace $(NAMESPACE)
dev: floci ## Install with the dev overlay: floci pre-step + values-dev.yaml (engine/metadata at the :dev tag)
helm install $(RELEASE) $(CHART) --namespace $(NAMESPACE) \
-f $(VALUES_FILE)
upgrade: ## Upgrade the release with chart defaults (no overlay)
helm upgrade $(RELEASE) $(CHART) --namespace $(NAMESPACE)
upgrade-dev: ## Upgrade the release with the dev values overlay
helm upgrade $(RELEASE) $(CHART) --namespace $(NAMESPACE) -f $(VALUES_FILE)
uninstall: ## Uninstall the release
helm uninstall $(RELEASE) --namespace $(NAMESPACE)
cleanup: ## Uninstall the release, delete PVCs, and remove the namespace
-$(MAKE) uninstall
kubectl delete pvc --namespace $(NAMESPACE) --all --ignore-not-found
kubectl delete namespace $(NAMESPACE) --ignore-not-found
##@ Helm tests (against the installed release)
test: ## Run helm tests against the installed release
helm test $(RELEASE) --namespace $(NAMESPACE) --logs
test-cleanup: ## Delete leftover helm test pods from previous runs
@pods=$$(kubectl get pods -n $(NAMESPACE) -o name 2>/dev/null | grep "^pod/$(RELEASE)-test-" || true); \
if [ -z "$$pods" ]; then \
echo "No stale test pods found."; \
else \
echo "$$pods" | xargs kubectl delete -n $(NAMESPACE); \
fi
##@ Agentic deployment (single-command up/down for AI agents)
agent-up: ## Clean machine -> running instance on kind (creates/reuses cluster, installs, smoke-queries). JSON on stdout, logs on stderr. THOROUGH=true also runs the helm test suite.
@KIND_CLUSTER=$(KIND_CLUSTER) NAMESPACE=$(NAMESPACE) RELEASE=$(RELEASE) CHART_DIR=$(CHART) \
NODE_IMAGE='$(NODE_IMAGE)' GHCR_PACKAGES_PUBLIC=$(GHCR_PACKAGES_PUBLIC) THOROUGH=$(THOROUGH) ./scripts/agent/up.sh
agent-verify: ## Fast iteration: apply chart changes in place (helm upgrade) + smoke-query. JSON on stdout, logs on stderr. THOROUGH=true also runs the full helm test suite.
@KIND_CLUSTER=$(KIND_CLUSTER) NAMESPACE=$(NAMESPACE) RELEASE=$(RELEASE) CHART_DIR=$(CHART) \
NODE_IMAGE='$(NODE_IMAGE)' GHCR_PACKAGES_PUBLIC=$(GHCR_PACKAGES_PUBLIC) THOROUGH=$(THOROUGH) ./scripts/agent/verify.sh
agent-down: ## Tear down the agentic kind cluster, returning the host to a clean state. JSON result on stdout, logs on stderr.
@KIND_CLUSTER=$(KIND_CLUSTER) ./scripts/agent/down.sh
##@ E2E quickstart pipeline
prepare-test-e2e: setup-kind load-test-images ## Full e2e setup: start the registry, create the kind cluster, publish images
setup-local-registry: ## Start the local Docker registry the kind node mirrors through (idempotent)
@if [ "$(GHCR_PACKAGES_PUBLIC)" = "true" ]; then \
echo "GHCR_PACKAGES_PUBLIC=true: skipping local registry (kind nodes pull images directly)."; \
else \
REGISTRY_NAME=$(REGISTRY_NAME) REGISTRY_PORT=$(REGISTRY_PORT) ./scripts/lib/setup-local-registry.sh; \
fi
setup-kind: setup-local-registry ## Create (or reuse) the e2e kind cluster and wire it to the local registry
@NODE_IMAGE='$(NODE_IMAGE)' REGISTRY_NAME=$(REGISTRY_NAME) REGISTRY_PORT=$(REGISTRY_PORT) GHCR_PACKAGES_PUBLIC=$(GHCR_PACKAGES_PUBLIC) ./scripts/lib/setup-kind-cluster.sh $(KIND_CLUSTER)
load-test-images: ## Pull the chart + floci images and push them into the local registry
@if [ "$(GHCR_PACKAGES_PUBLIC)" = "true" ]; then \
echo "GHCR_PACKAGES_PUBLIC=true: skipping image publishing (kind nodes pull images directly)."; \
else \
REGISTRY_NAME=$(REGISTRY_NAME) REGISTRY_PORT=$(REGISTRY_PORT) ./scripts/ci/load-e2e-images.sh $(KIND_CLUSTER); \
fi
helm-test: ## Run the quickstart end-to-end check against the current cluster (run prepare-test-e2e first)
NAMESPACE=$(NAMESPACE) RELEASE=$(RELEASE) CHART_DIR=$(CHART) ./scripts/ci/helm-test.sh
flush-local-registry: cleanup-local-registry setup-local-registry ## Recreate the local registry from scratch (drops cached images)
cleanup-test-e2e: ## Tear down the e2e kind cluster (the local registry is left running; use flush-local-registry to drop it)
kind delete cluster --name $(KIND_CLUSTER)
cleanup-local-registry: ## Stop and remove the local Docker registry container (cached images are lost)
@docker rm -f $(REGISTRY_NAME) >/dev/null 2>&1 || true
@echo "Removed local registry '$(REGISTRY_NAME)' (if it existed). Re-run 'make setup-local-registry' to recreate."