feat: Companion agent download in ServerView + Gitea CI pipeline fix
All checks were successful
Test Asgard Runner / test (push) Successful in 3s

Frontend:
- Add Companion Agent card to ServerView (status, download links, setup instructions)
- Shows agent connection status, last heartbeat, license key for copy
- Download buttons for Linux/Windows amd64 from Gitea releases

CI/CD:
- Fix build-companion.yml: replace actions/github-script with Gitea API curl
- Inject version from git tag via ldflags (-X main.version)
- Add VERSION variable to Makefile with ldflags injection
- Change main.go version from const to var for ldflags compatibility

Deployment:
- Add systemd service file (deployment/corrosion-companion.service)
- Add .gitignore for bin/ (binaries should come from CI, not repo)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Vantz Stockwell
2026-02-21 13:47:09 -05:00
parent d2e7a42536
commit e0f9438dfa
6 changed files with 215 additions and 74 deletions

1
companion-agent/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
bin/

View File

@@ -16,8 +16,11 @@ 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"
LDFLAGS = -ldflags "-s -w -X main.version=$(VERSION)"
all: clean build

View File

@@ -32,7 +32,7 @@ type Config struct {
LogLevel string `envconfig:"LOG_LEVEL" default:"info"`
}
const version = "1.0.0"
var version = "dev"
func main() {
log.SetFlags(log.LstdFlags | log.Lshortfile)

View File

@@ -0,0 +1,28 @@
[Unit]
Description=Corrosion Companion Agent
Documentation=https://corrosionmgmt.com
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=rust
Group=rust
WorkingDirectory=/opt/corrosion
ExecStart=/opt/corrosion/corrosion-companion-linux-amd64
Restart=on-failure
RestartSec=5
StartLimitInterval=60
StartLimitBurst=3
# Environment
EnvironmentFile=/opt/corrosion/.env
# Security hardening
NoNewPrivileges=true
ProtectSystem=strict
ReadWritePaths=/opt/corrosion /home/rust
ProtectHome=read-only
[Install]
WantedBy=multi-user.target