Assistant: codex Assistant-Model: gpt-6-astra Assistant-Session: 01a15374-f59f-7a31-86d2-d23b5d2ed181
95 lines
2.9 KiB
Makefile
95 lines
2.9 KiB
Makefile
BIN_DIR ?= bin
|
|
BIN := $(BIN_DIR)/access-engine
|
|
PKG := ./...
|
|
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo 0.0.0-dev)
|
|
LDFLAGS := -X main.version=$(VERSION)
|
|
|
|
.PHONY: all build test vet lint fmt tidy sbom clean ci overlay-render overlay-dry-run verify-posture check-layer
|
|
|
|
all: vet lint test build
|
|
|
|
build:
|
|
@mkdir -p $(BIN_DIR)
|
|
go build -ldflags "$(LDFLAGS)" -o $(BIN) ./cmd/access-engine
|
|
|
|
test: check-layer
|
|
go test -race $(PKG)
|
|
|
|
check-layer:
|
|
go run ./tools/check_layer_conformance.go
|
|
|
|
vet:
|
|
go vet $(PKG)
|
|
|
|
fmt:
|
|
gofmt -l -w .
|
|
|
|
tidy:
|
|
go mod tidy
|
|
|
|
lint:
|
|
@if command -v golangci-lint >/dev/null 2>&1; then \
|
|
golangci-lint run $(PKG); \
|
|
else \
|
|
echo "golangci-lint not installed; run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest"; \
|
|
echo "falling back to: go vet"; \
|
|
go vet $(PKG); \
|
|
fi
|
|
|
|
GOBIN_PATH := $(shell go env GOPATH)/bin
|
|
|
|
sbom:
|
|
@mkdir -p $(BIN_DIR)
|
|
@if command -v cyclonedx-gomod >/dev/null 2>&1; then \
|
|
cyclonedx-gomod mod -json -output $(BIN_DIR)/sbom.cdx.json .; \
|
|
echo "SBOM written to $(BIN_DIR)/sbom.cdx.json (cyclonedx-gomod)"; \
|
|
elif [ -x "$(GOBIN_PATH)/cyclonedx-gomod" ]; then \
|
|
"$(GOBIN_PATH)/cyclonedx-gomod" mod -json -output $(BIN_DIR)/sbom.cdx.json .; \
|
|
echo "SBOM written to $(BIN_DIR)/sbom.cdx.json (cyclonedx-gomod via GOPATH)"; \
|
|
elif command -v syft >/dev/null 2>&1; then \
|
|
syft . -o cyclonedx-json=$(BIN_DIR)/sbom.cdx.json; \
|
|
echo "SBOM written to $(BIN_DIR)/sbom.cdx.json (syft)"; \
|
|
else \
|
|
echo "no SBOM tool found. install one:"; \
|
|
echo " go install github.com/CycloneDX/cyclonedx-gomod/cmd/cyclonedx-gomod@latest"; \
|
|
echo " or syft: https://github.com/anchore/syft"; \
|
|
exit 1; \
|
|
fi
|
|
|
|
clean:
|
|
rm -rf $(BIN_DIR)
|
|
|
|
ci: vet lint test build overlay-render
|
|
|
|
verify-posture:
|
|
@bash tools/verify-posture.sh
|
|
|
|
.PHONY: verify-emission-cadence
|
|
verify-emission-cadence:
|
|
python3 tools/verify_emission_cadence.py
|
|
|
|
overlay-render:
|
|
@tests/stage1.sh
|
|
|
|
overlay-dry-run:
|
|
@test -n "$$KUBECONFIG" || { echo "set KUBECONFIG to the railiance01 kubeconfig"; exit 1; }
|
|
@for values in values/stage2-canary.yaml values/user-engine.yaml values/tenant-engine.yaml; do \
|
|
echo "server-dry-run $$values"; \
|
|
helm template flex-auth charts/flex-auth -f "$$values" --namespace flex-auth \
|
|
| kubectl apply --dry-run=server --server-side -f -; \
|
|
done
|
|
|
|
.PHONY: decisionpep-export decisionpep-check
|
|
decisionpep-export:
|
|
python3 tools/export_decisionpep_adapter.py
|
|
|
|
decisionpep-check:
|
|
python3 tools/export_decisionpep_adapter.py --check
|
|
go test ./pkg/decisionpep
|
|
|
|
# CUST-WP-0079-T05: staged-source generation; hook uses the isolated recipe.
|
|
.PHONY: generated-work-records generated-work-records-check
|
|
generated-work-records:
|
|
$(MAKE) --no-print-directory -f .generated-work-records.mk generated-work-records
|
|
generated-work-records-check:
|
|
$(MAKE) --no-print-directory -f .generated-work-records.mk generated-work-records-check
|