Utility tool for upgrading talos nodes.
at main 1.4 kB view raw
1.PHONY: build install clean tidy test 2 3# Build variables 4VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev") 5LDFLAGS := -ldflags "-X main.version=$(VERSION)" 6BINARY := talos-upgrade 7 8# Default target 9all: build 10 11# Build the binary 12build: 13 go build $(LDFLAGS) -o bin/$(BINARY) ./cmd/talos-upgrade 14 15# Build for multiple platforms 16build-all: 17 GOOS=linux GOARCH=amd64 go build $(LDFLAGS) -o bin/$(BINARY)-linux-amd64 ./cmd/talos-upgrade 18 GOOS=linux GOARCH=arm64 go build $(LDFLAGS) -o bin/$(BINARY)-linux-arm64 ./cmd/talos-upgrade 19 GOOS=darwin GOARCH=amd64 go build $(LDFLAGS) -o bin/$(BINARY)-darwin-amd64 ./cmd/talos-upgrade 20 GOOS=darwin GOARCH=arm64 go build $(LDFLAGS) -o bin/$(BINARY)-darwin-arm64 ./cmd/talos-upgrade 21 22# Install to GOPATH/bin 23install: 24 go install $(LDFLAGS) ./cmd/talos-upgrade 25 26# Clean build artifacts 27clean: 28 rm -rf bin/ 29 30# Tidy dependencies 31tidy: 32 go mod tidy 33 34# Run tests 35test: 36 go test -v ./... 37 38# Run with dry-run 39dry-run: build 40 ./bin/$(BINARY) --dry-run status 41 42# Show help 43help: 44 @echo "Available targets:" 45 @echo " build - Build the binary to bin/" 46 @echo " build-all - Build for multiple platforms" 47 @echo " install - Install to GOPATH/bin" 48 @echo " clean - Remove build artifacts" 49 @echo " tidy - Tidy go.mod dependencies" 50 @echo " test - Run tests" 51 @echo " dry-run - Build and run status in dry-run mode" 52 @echo " help - Show this help"