Files
Vantz Stockwell 180631989a
All checks were successful
Build Host Agent / build (push) Successful in 28s
Test Asgard Runner / test (push) Successful in 3s
fix(panel): real auto-updating version + remove fake agent footer; rename companion -> Corrosion host agent
Version badge: was hardcoded '1.0.8' — now single-sourced from frontend/package.json (1.0.0) via Vite define __APP_VERSION__, so it auto-updates on release. Sidebar agent footer: removed the FABRICATED 'asgard-01' host name and the fake 'Agent v1.0.8' line — now shows real server.connection data, or an honest 'No host agent connected' empty state when nothing is deployed (the operator's actual state). Renamed 'Companion agent' -> 'Corrosion host agent' across the UI (ServerView/SetupWizard/Dashboard/Plugins), the binary names (corrosion-host-agent-<os>-<arch>) + CDN path (/host-agent/), the Go Makefile build output, and the Gitea CI workflow — frontend download links and CI output now match. Marketing hero mock host names neutralized (asgard-01 -> rust-host/dune-host/conan-host). DB column names (companion_last_seen) left intact. Build green; zero 'asgard'/'1.0.8' remain in frontend/src.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-11 09:03:37 -04:00

93 lines
2.3 KiB
Makefile

.PHONY: all build build-linux build-windows clean test run
# Binary names
BINARY_NAME=corrosion-host-agent
BINARY_LINUX=$(BINARY_NAME)-linux-amd64
BINARY_WINDOWS=$(BINARY_NAME)-windows-amd64.exe
# Build directory
BUILD_DIR=bin
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
GOMOD=$(GOCMD) mod
# Version (overridable via: make build-linux VERSION=v1.2.3)
VERSION ?= dev
# Build flags
LDFLAGS = -ldflags "-s -w -X main.version=$(VERSION)"
all: clean build
build: build-linux build-windows
build-linux:
@echo "Building for Linux (amd64)..."
@mkdir -p $(BUILD_DIR)
GOOS=linux GOARCH=amd64 $(GOBUILD) $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_LINUX) ./cmd/agent
@echo "Built: $(BUILD_DIR)/$(BINARY_LINUX)"
build-windows:
@echo "Building for Windows (amd64)..."
@mkdir -p $(BUILD_DIR)
GOOS=windows GOARCH=amd64 $(GOBUILD) $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_WINDOWS) ./cmd/agent
@echo "Built: $(BUILD_DIR)/$(BINARY_WINDOWS)"
build-local:
@echo "Building for current platform..."
@mkdir -p $(BUILD_DIR)
$(GOBUILD) $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME) ./cmd/agent
@echo "Built: $(BUILD_DIR)/$(BINARY_NAME)"
clean:
@echo "Cleaning..."
@$(GOCLEAN)
@rm -rf $(BUILD_DIR)
test:
@echo "Running tests..."
@$(GOTEST) -v ./...
deps:
@echo "Downloading dependencies..."
@$(GOMOD) download
@$(GOMOD) tidy
run: build-local
@echo "Running agent..."
@./$(BUILD_DIR)/$(BINARY_NAME)
# Install systemd service (Linux only)
install-service:
@echo "Installing systemd service..."
@sudo cp $(BUILD_DIR)/$(BINARY_LINUX) /usr/local/bin/$(BINARY_NAME)
@sudo cp deployment/corrosion-host-agent.service /etc/systemd/system/
@sudo systemctl daemon-reload
@sudo systemctl enable corrosion-host-agent
@echo "Service installed. Configure /etc/corrosion-host-agent/.env then start with: sudo systemctl start corrosion-host-agent"
# Development helpers
dev: build-local
@./$(BUILD_DIR)/$(BINARY_NAME)
fmt:
@echo "Formatting code..."
@$(GOCMD) fmt ./...
lint:
@echo "Running linter..."
@golangci-lint run ./...
# Show build info
info:
@echo "Build Information:"
@echo " Binary Name: $(BINARY_NAME)"
@echo " Linux Binary: $(BUILD_DIR)/$(BINARY_LINUX)"
@echo " Windows Binary: $(BUILD_DIR)/$(BINARY_WINDOWS)"
@echo " Go Version: $(shell go version)"