fc94326b0e
P00 — Re-architecture Foundation (deprecation/migration/test-infra/persona/docs). Deprecation sweep (REQ-068, REQ-072, REQ-089): - Add // Deprecated: doc comments to internal/daemon (R-001), internal/transport (REQ-073), internal/security/ca.go+csr.go (D-101/REQ-076), internal/engine/ dispatcher.go+peer.go (CLI-side scheduler), internal/cli/daemon.go. - orca daemon emits slog.Warn deprecation banner on every run (ungated); fires R-001 + v0.10-P05 drain-and-stop + v0.10-P14 deletion. - orca cert and orca node join (mTLS path) emit deprecation warnings; proxmox SSH path (the v0.9 replacement) does not warn. - Add --no-deprecation-warnings global flag on root command (PersistentPreRunE) for orca upgrade migrations. - 12 new daemon/cert/node deprecation tests in internal/cli/daemon_test.go (cli coverage 81.9%, warnDeprecated 100%). - Add DEPRECATED banners to v0.8 sections of ARCHITECTURE.md (verified the v0.9 supersession section + Supersession Table from prior turn are present). Bash tooling gate (grill C-06, C-15, C-16, C-17, C-18): - scripts/tests/test_helper.bash + example_test.bash — bats framework + helpers. - scripts/lib/orca-log.sh — slog-compatible JSON logging to syslog (C-17). - scripts/orca-verify-render.sh — render-contract validator skeleton (C-16). - scripts/tests/orca-log_test.bash + orca-verify-render_test.bash — 20 bats tests total (happy + failure paths per C-15). - .shellcheckrc — project shellcheck config. - Makefile: test-bash + lint-bash targets (graceful skip if tools missing); wired into test + lint targets. - internal/emit/contract.go + contract_test.go — versioned JSON render contract (orca.emit/v1) between Go emitters and bash appliers (C-16). - .ciagent/BASH_CAPABILITY_MAP_v0.9.md — maps shipped internal/transport capabilities to bash-side equivalents or accepted drops (C-18). - D-186 recorded in PROJECT.md: bash exempt from Go coverage gate; compensating control is bats + shellcheck + shfmt (C-06). verify-reqs: 90 requirements consistent. Build/test/lint/fmt all green. 20 bats tests pass. Go tests pass. No v0.8 code deleted — only marked deprecated (deletion deferred to v0.10-P14 per REQ-090 dual-write window). ---ci--- project: orca phase: P00 milestone: v0.9 status: execute ---/ci---
131 lines
5.3 KiB
Makefile
131 lines
5.3 KiB
Makefile
.PHONY: build test test-race lint fmt clean run release version changelog help security-scan verify-reqs
|
|
|
|
BINARY := bin/orca
|
|
GOFLAGS := -trimpath
|
|
PKG := ./cmd/orca
|
|
|
|
# Version is read from the latest git tag, with a `dev` fallback.
|
|
# Override with `make build VERSION=v0.1.5` if needed.
|
|
VERSION ?= $(shell git describe --tags --abbrev=0 2>/dev/null || echo "dev")
|
|
GIT_COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
|
|
BUILD_TIME ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
|
|
|
|
# -ldflags injects version metadata into the binary. The variables live in
|
|
# internal/cli/root.go, so we target git.cloudinit.dev/coreci/orca/internal/cli.
|
|
LDFLAGS := -s -w \
|
|
-X git.cloudinit.dev/coreci/orca/internal/cli.version=$(VERSION) \
|
|
-X git.cloudinit.dev/coreci/orca/internal/cli.gitCommit=$(GIT_COMMIT) \
|
|
-X git.cloudinit.dev/coreci/orca/internal/cli.buildTime=$(BUILD_TIME)
|
|
|
|
help:
|
|
@echo "orca — make targets"
|
|
@echo " build Build binary to $(BINARY) (injects version via -ldflags)"
|
|
@echo " test Run tests"
|
|
@echo " test-race Run tests with race detection (REQ-031)"
|
|
@echo " lint Run gofmt + go vet"
|
|
@echo " fmt Format code"
|
|
@echo " clean Remove build artifacts"
|
|
@echo " run Build and run with args (use: make run ARGS='version')"
|
|
@echo " version Print the version string that would be injected"
|
|
@echo " changelog Generate CHANGELOG.md from ---ci--- commit blocks"
|
|
@echo " release Run scripts/release.sh [VERSION] — build, tar, publish"
|
|
@echo " security-scan Run gosec+govulncheck+gitleaks (P03, REQ-014/027/039)"
|
|
@echo " verify-reqs Assert ROADMAP COMPLETE ↔ REQUIREMENTS Complete (REQ-060)"
|
|
|
|
build:
|
|
@mkdir -p bin
|
|
@echo " → building $(VERSION) ($(GIT_COMMIT))"
|
|
go build $(GOFLAGS) -ldflags="$(LDFLAGS)" -o $(BINARY) $(PKG)
|
|
|
|
test:
|
|
go test -coverprofile=coverage.out ./...
|
|
$(MAKE) test-bash
|
|
|
|
# test-race runs the full test suite under the race detector (REQ-031).
|
|
# Wired into the .coreci.yml `test` pipeline as well.
|
|
test-race:
|
|
go test -race -coverprofile=coverage.out ./...
|
|
$(MAKE) test-bash
|
|
|
|
lint:
|
|
gofmt -l .
|
|
go vet ./...
|
|
$(MAKE) lint-bash
|
|
|
|
fmt:
|
|
gofmt -w .
|
|
|
|
# test-bash runs bats tests for shell scripts (grill C-15). Skips gracefully
|
|
# if bats is not installed.
|
|
test-bash:
|
|
@command -v bats >/dev/null 2>&1 && { \
|
|
echo "→ bats scripts/tests/*.bash"; \
|
|
bats scripts/tests/*.bash; \
|
|
} || echo "bats not installed; skipping bash tests (see scripts/tests/README.md)"
|
|
|
|
# lint-bash runs shellcheck + shfmt on shell scripts (grill C-15). Skips
|
|
# gracefully if the tools are not installed.
|
|
lint-bash:
|
|
@command -v shellcheck >/dev/null 2>&1 && { \
|
|
echo "→ shellcheck scripts/"; \
|
|
shellcheck scripts/*.sh scripts/lib/*.sh scripts/tests/*.bash || true; \
|
|
} || echo "shellcheck not installed; skipping (see scripts/tests/README.md)"
|
|
@command -v shfmt >/dev/null 2>&1 && { \
|
|
echo "→ shfmt -d scripts/"; \
|
|
shfmt -d scripts/; \
|
|
} || echo "shfmt not installed; skipping (see scripts/tests/README.md)"
|
|
|
|
clean:
|
|
rm -rf bin coverage.out *.tar.gz
|
|
|
|
run: build
|
|
./$(BINARY) $(ARGS)
|
|
|
|
version:
|
|
@echo "$(VERSION) (commit $(GIT_COMMIT), built $(BUILD_TIME))"
|
|
|
|
# changelog aggregates the most recent ---ci--- tagged commit messages
|
|
# into CHANGELOG.md. Idempotent; safe to run after every milestone.
|
|
changelog:
|
|
@echo "# Changelog" > CHANGELOG.md
|
|
@echo "" >> CHANGELOG.md
|
|
@echo "All notable changes to orca are documented in this file." >> CHANGELOG.md
|
|
@echo "" >> CHANGELOG.md
|
|
@echo "The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)," >> CHANGELOG.md
|
|
@echo "and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html)." >> CHANGELOG.md
|
|
@echo "" >> CHANGELOG.md
|
|
@git log --pretty=format:'%H' --grep='^feat\|^fix\|^docs\|^ship\|^chore' 2>/dev/null | head -50 | while read sha; do \
|
|
msg=$$(git log -1 --pretty=format:'%s' "$$sha"); \
|
|
if echo "$$msg" | grep -qE -- '---ci---|phase:'; then \
|
|
phase=$$(echo "$$msg" | grep -oE 'phase: [0-9]+' | head -1 | awk '{print $$2}'); \
|
|
status=$$(echo "$$msg" | grep -oE 'status: [a-z]+' | head -1 | awk '{print $$2}'); \
|
|
echo "- \`$$sha\` (phase $$phase, $$status) — $$msg" >> CHANGELOG.md; \
|
|
else \
|
|
echo "- \`$$sha\` — $$msg" >> CHANGELOG.md; \
|
|
fi; \
|
|
done
|
|
@echo "" >> CHANGELOG.md
|
|
@echo "Generated by make changelog. Do not edit by hand." >> CHANGELOG.md
|
|
@echo "✓ CHANGELOG.md updated"
|
|
|
|
release:
|
|
@if [ -z "$(VERSION)" ] || [ "$(VERSION)" = "dev" ]; then \
|
|
echo "release: no version tag found. Tag first: git tag v0.1.6"; \
|
|
exit 1; \
|
|
fi
|
|
./scripts/release.sh $(VERSION)
|
|
|
|
# security-scan runs the three tools integrated in P03 (REQ-014,
|
|
# REQ-027, REQ-039). Local equivalent of the .coreci.yml `validate`
|
|
# security stages. Exits non-zero on any unsuppressed finding.
|
|
# The script handles tool detection (silently skips tools not on PATH
|
|
# in a developer's local environment; CI requires all three).
|
|
security-scan:
|
|
./scripts/security_scan.sh
|
|
|
|
# verify-reqs asserts ROADMAP milestone COMPLETE ↔ REQUIREMENTS row Complete
|
|
# consistency (REQ-060). Catches doc-vs-doc drift; code-vs-doc drift is out
|
|
# of scope (P04 audit). Exits 0 on consistency, 1 with a diff on drift.
|
|
verify-reqs:
|
|
go run ./cmd/verify-reqs .ciagent/ROADMAP.md .ciagent/REQUIREMENTS.md
|