Add StateDisabled for operator-initiated disable, keeping StateRemoved for backends that disappear during a config reload. Previously both used StateRemoved, which was confusing: "removed" implies the backend no longer exists in config, but a disabled backend is still present and can be re-enabled on the fly. - health: add StateDisabled with String() "disabled", Disable() method with probe code "disabled". Record() rejects probes in all three inactive states (paused, disabled, removed). - checker: DisableBackend calls backend.Disable() instead of Remove(). - docs: healthchecks.md rewritten for pause (goroutine cancelled, not just results discarded), and separate disabled/removed state rows. user-guide.md updated to match. - Makefile: add fixstyle target (gofmt -w .).
67 lines
2.0 KiB
Makefile
67 lines
2.0 KiB
Makefile
BINARIES := maglevd maglevc
|
|
MODULE := git.ipng.ch/ipng/vpp-maglev
|
|
PROTO_DIR := proto
|
|
PROTO_FILE := $(PROTO_DIR)/maglev.proto
|
|
GEN_FILES := internal/grpcapi/maglev.pb.go internal/grpcapi/maglev_grpc.pb.go
|
|
|
|
NATIVE_ARCH := $(shell go env GOARCH)
|
|
VERSION := 0.1.1
|
|
COMMIT_HASH := $(shell git rev-parse --short HEAD 2>/dev/null || echo unknown)
|
|
DATE := $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
|
|
LDFLAGS := -X '$(MODULE)/cmd.version=$(VERSION)' \
|
|
-X '$(MODULE)/cmd.commit=$(COMMIT_HASH)' \
|
|
-X '$(MODULE)/cmd.date=$(DATE)'
|
|
|
|
TEST ?= tests/
|
|
|
|
.PHONY: all build build-amd64 build-arm64 test proto lint fixstyle pkg-deb robot-test clean
|
|
|
|
all: build
|
|
|
|
build: $(GEN_FILES)
|
|
mkdir -p build/$(NATIVE_ARCH)
|
|
go build -ldflags "$(LDFLAGS)" -o build/$(NATIVE_ARCH)/maglevd ./cmd/maglevd/
|
|
go build -ldflags "$(LDFLAGS)" -o build/$(NATIVE_ARCH)/maglevc ./cmd/maglevc/
|
|
|
|
build-amd64: $(GEN_FILES)
|
|
mkdir -p build/amd64
|
|
GOOS=linux GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o build/amd64/maglevd ./cmd/maglevd/
|
|
GOOS=linux GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o build/amd64/maglevc ./cmd/maglevc/
|
|
|
|
build-arm64: $(GEN_FILES)
|
|
mkdir -p build/arm64
|
|
GOOS=linux GOARCH=arm64 go build -ldflags "$(LDFLAGS)" -o build/arm64/maglevd ./cmd/maglevd/
|
|
GOOS=linux GOARCH=arm64 go build -ldflags "$(LDFLAGS)" -o build/arm64/maglevc ./cmd/maglevc/
|
|
|
|
pkg-deb: build-amd64 build-arm64
|
|
debian/build-deb.sh amd64 $(VERSION) $(COMMIT_HASH)
|
|
debian/build-deb.sh arm64 $(VERSION) $(COMMIT_HASH)
|
|
|
|
test: $(GEN_FILES)
|
|
go test ./...
|
|
|
|
proto: $(GEN_FILES)
|
|
|
|
$(GEN_FILES): $(PROTO_FILE)
|
|
protoc \
|
|
--go_out=. --go_opt=module=$(MODULE) \
|
|
--go-grpc_out=. --go-grpc_opt=module=$(MODULE) \
|
|
$(PROTO_FILE)
|
|
|
|
fixstyle:
|
|
gofmt -w .
|
|
|
|
lint:
|
|
golangci-lint run ./...
|
|
|
|
tests/.venv: tests/requirements.txt
|
|
python3 -m venv tests/.venv
|
|
tests/.venv/bin/pip install -q -r tests/requirements.txt
|
|
|
|
robot-test: build tests/.venv
|
|
tests/rf-run.sh docker $(TEST)
|
|
|
|
clean:
|
|
rm -rf build/
|
|
rm -f $(GEN_FILES)
|