Skip to content

Commit cd9577b

Browse files
jeremyederclaude
andauthored
feat: Add automated version sync for local development (#448)
## Summary Implements automated version synchronization for local development to prevent version drift between git tags and deployment manifests. ## Changes - **Makefile**: Add `local-sync-version` target to automatically sync version from git - **local-up workflow**: Integrated version sync to run before deploying services - **local-status enhancement**: Show Git/Manifest/Running version alignment with drift warnings - **Frontend manifest**: Updated to current version (auto-synced from git describe) ## Problem Solved Previously, the web UI displayed version `v0.0.3` (hardcoded in manifest) instead of the current release `v0.0.12`. This required manual updates every release and caused version drift. ## Solution Automatic version injection using `git describe --tags --always`, matching the pattern used in CI/CD workflows: - **Production**: Uses release tags - **Staging**: Uses git SHA - **Local Dev**: Now uses git describe (latest tag + commits ahead) ## Workflow Every `make local-up` now: 1. Syncs version from git → manifest 2. Applies updated manifest 3. Deploys with current version ## Verification After deployment: - API returns correct version: `{"version":"v0.0.12-22-g5553056"}` - `make local-status` shows aligned versions with no warnings ## Benefits - ✅ Single source of truth (git tags) - ✅ No manual version updates needed - ✅ Consistent across all environments (local/staging/prod) - ✅ Prevents version drift permanently 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 5553056 commit cd9577b

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

Makefile

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.PHONY: help setup build-all build-frontend build-backend build-operator build-runner deploy clean
2-
.PHONY: local-up local-down local-clean local-status local-rebuild local-reload-backend local-reload-frontend local-reload-operator
2+
.PHONY: local-up local-down local-clean local-status local-rebuild local-reload-backend local-reload-frontend local-reload-operator local-sync-version
33
.PHONY: local-logs local-logs-backend local-logs-frontend local-logs-operator local-shell local-shell-frontend
44
.PHONY: local-test local-test-dev local-test-quick test-all local-url local-troubleshoot local-port-forward local-stop-port-forward
55
.PHONY: push-all registry-login setup-hooks remove-hooks check-minikube check-kubectl
@@ -145,6 +145,7 @@ local-up: check-minikube check-kubectl ## Start local development environment (m
145145
@kubectl apply -f components/manifests/base/workspace-pvc.yaml -n $(NAMESPACE) >/dev/null 2>&1 || true
146146
@echo "$(COLOR_BLUE)$(COLOR_RESET) Step 6.5/8: Configuring operator..."
147147
@$(MAKE) --no-print-directory _create-operator-config
148+
@$(MAKE) --no-print-directory local-sync-version
148149
@echo "$(COLOR_BLUE)$(COLOR_RESET) Step 7/8: Deploying services..."
149150
@kubectl apply -f components/manifests/minikube/backend-deployment.yaml >/dev/null 2>&1
150151
@kubectl apply -f components/manifests/minikube/backend-service.yaml >/dev/null 2>&1
@@ -192,6 +193,26 @@ local-status: check-kubectl ## Show status of local deployment
192193
@kubectl get svc -n $(NAMESPACE) 2>/dev/null | grep -E "NAME|NodePort" || echo "No services found"
193194
@echo ""
194195
@$(MAKE) --no-print-directory _show-access-info
196+
@echo ""
197+
@echo "$(COLOR_BOLD)Version Status:$(COLOR_RESET)"
198+
@GIT_VERSION=$$(git describe --tags --always 2>/dev/null || echo "unknown") && \
199+
MANIFEST_VERSION=$$(grep -A1 "name: VTEAM_VERSION" components/manifests/minikube/frontend-deployment.yaml | tail -1 | sed 's/.*value: "\(.*\)"/\1/' | tr -d ' ') && \
200+
RUNNING_VERSION=$$(kubectl get deployment frontend -n $(NAMESPACE) -o jsonpath='{.spec.template.spec.containers[0].env[?(@.name=="VTEAM_VERSION")].value}' 2>/dev/null || echo "not-deployed") && \
201+
echo " Git: $$GIT_VERSION" && \
202+
echo " Manifest: $$MANIFEST_VERSION" && \
203+
echo " Running: $$RUNNING_VERSION" && \
204+
if [ "$$GIT_VERSION" != "$$MANIFEST_VERSION" ]; then \
205+
echo " $(COLOR_YELLOW)$(COLOR_RESET) Manifest version differs from git (run 'make local-sync-version')"; \
206+
fi
207+
208+
local-sync-version: ## Sync version from git to local deployment manifests
209+
@echo "$(COLOR_BLUE)$(COLOR_RESET) Syncing version from git..."
210+
@VERSION=$$(git describe --tags --always 2>/dev/null || echo "dev") && \
211+
echo " Using version: $$VERSION" && \
212+
sed -i.bak "s|value: \"v.*\"|value: \"$$VERSION\"|" \
213+
components/manifests/minikube/frontend-deployment.yaml && \
214+
rm -f components/manifests/minikube/frontend-deployment.yaml.bak && \
215+
echo " $(COLOR_GREEN)$(COLOR_RESET) Version synced to $$VERSION"
195216

196217
local-rebuild: ## Rebuild and reload all components
197218
@echo "$(COLOR_BOLD)🔄 Rebuilding all components...$(COLOR_RESET)"

components/manifests/minikube/frontend-deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ spec:
4141
- name: GITHUB_APP_SLUG
4242
value: "ambient-code"
4343
- name: VTEAM_VERSION
44-
value: "v0.0.3"
44+
value: "v0.0.12-22-g5553056"
4545
- name: DISABLE_AUTH
4646
value: "true"
4747
- name: MOCK_USER

0 commit comments

Comments
 (0)