/update could report success at the correct target version while the archie-agent container running it never actually changed: the update mechanism trusted the configured installer's exit code and reported whatever version number the release claimed, with nothing verifying the two agreed. The first piece of the fix: a new internal/installtype package reports how a binary was built for distribution (Type(), defaulting to "unknown"), stamped once per release artifact via "-ldflags -X .../installtype.buildType=<value>" rather than guessed at runtime by probing the environment -- restic and Tailscale both treat "which install shape is this" as a build-time decision for the same reason: a probed signal is guessable, a compiled-in one is not. releaseupdate.Service.Install now refuses to run the configured Installer at all when InstallType is unset or installtype.Unknown, so an unstamped or misconfigured build can no longer silently attempt an update it has no way to know is even the right kind for how this instance was deployed. Wired through every real archied build path so the gate doesn't just exist in principle: Taskfile.yml's build task (binary), Dockerfile.archied (container), and install.sh (binary) all now stamp it; cmd/archied/telegram_setup.go wires Service.InstallType from installtype.Type(). Configuration-page display of install type/version and post-update verification against the actually-running reference (not just the installer's reported version) remain open -- this lands the correctness gate, not the full observability surface. Refs #522
173 lines
5.3 KiB
YAML
173 lines
5.3 KiB
YAML
version: "3"
|
|
|
|
vars:
|
|
BIN_DIR: "bin"
|
|
|
|
tasks:
|
|
default:
|
|
desc: List available tasks
|
|
cmds:
|
|
- task --list
|
|
|
|
fmt:
|
|
desc: Format and fix Go source (gofumpt, go fix)
|
|
cmds:
|
|
- gofumpt -w .
|
|
- go fix ./...
|
|
|
|
vet:
|
|
desc: Run go vet
|
|
cmds:
|
|
- go vet ./...
|
|
|
|
lint:
|
|
desc: Run golangci-lint
|
|
cmds:
|
|
- golangci-lint run ./...
|
|
|
|
ui:
|
|
desc: Build the dashboard into ui/dist (committed; the Go build embeds it)
|
|
dir: ui
|
|
cmds:
|
|
- npm install --no-audit --no-fund
|
|
- npm run build
|
|
|
|
test:ui:
|
|
desc: Run the dashboard's node tests (DOM-building primitives)
|
|
dir: ui
|
|
cmds:
|
|
- npm test
|
|
|
|
dev:
|
|
desc: "Develop: archied live-reload + Vite HMR together. Open http://localhost:5173"
|
|
summary: |
|
|
Runs both halves of the dev loop in one terminal:
|
|
|
|
* air rebuilds and restarts archied on Go changes
|
|
* vite serves the dashboard with hot reload on :5173,
|
|
proxying /api and /events through to archied on :8484
|
|
|
|
Open http://localhost:5173 -- not :8484. The Vite server is the one with
|
|
hot reload; :8484 serves the last built dist/ and will look stale.
|
|
|
|
Ctrl-C stops both.
|
|
deps: [dev:daemon, dev:ui]
|
|
|
|
dev:daemon:
|
|
desc: archied only, live-reloading via air (prefer `task dev`)
|
|
cmds:
|
|
- air
|
|
|
|
dev:ui:
|
|
desc: Vite dev server only, expects archied already running (prefer `task dev`)
|
|
dir: ui
|
|
cmds:
|
|
- npm install --no-audit --no-fund
|
|
- npm run dev
|
|
|
|
dev:mobile:
|
|
desc: Serve the dashboard on your LAN (token-protected) for phone viewing
|
|
summary: |
|
|
Starts archied with the [web] bind on 0.0.0.0 so the dashboard is
|
|
reachable from your phone, printing the URL (LAN IP + token) and a QR
|
|
code to scan. Stop `task dev` first: both use port 8484, and two daemons
|
|
sharing the bot identity would double-poll the forge. Frontend served is
|
|
the embedded dist, so run `task ui` if you changed the frontend.
|
|
deps:
|
|
- ui
|
|
cmds:
|
|
- cmd: |
|
|
IP=$(hostname -I | awk '{print $1}')
|
|
TOKEN=$(cat "${XDG_DATA_HOME:-$HOME/.local/share}/archie/web-token" 2>/dev/null)
|
|
URL="http://$IP:8484/?t=$TOKEN"
|
|
echo "Phone URL: $URL"
|
|
echo "$URL" | qrencode -t ANSIUTF8
|
|
- go run ./cmd/archied -config-overlay ~/.config/archie/mobile.toml
|
|
|
|
build:
|
|
desc: Build archied and archie-agent binaries
|
|
# Version stamping used to live only in Dockerfile.archied, so any build
|
|
# from source -- including a host deployment -- reported "dev" for
|
|
# both components and /version was useless there. Derive the same
|
|
# -X values from the release tags so a source build is stamped too.
|
|
# git describe (without --abbrev=0) yields 1.7.0-2-gbb54786 when HEAD is
|
|
# past the tag, which is the honest answer for a mid-cycle build.
|
|
vars:
|
|
GATEWAY_VERSION:
|
|
sh: git describe --tags --match 'archied/v*' 2>/dev/null | sed 's|^archied/v||' || echo dev
|
|
RUNTIME_VERSION:
|
|
sh: git describe --tags --match 'archie/v*' 2>/dev/null | sed 's|^archie/v||' || echo dev
|
|
sources:
|
|
- "**/*.go"
|
|
- go.mod
|
|
- go.sum
|
|
generates:
|
|
- "{{.BIN_DIR}}/archied"
|
|
- "{{.BIN_DIR}}/archie-agent"
|
|
cmds:
|
|
- go build -ldflags "-X main.gatewayVersion={{.GATEWAY_VERSION}} -X main.runtimeVersion={{.RUNTIME_VERSION}} -X github.com/samcharles93/archie-core/internal/installtype.buildType=binary" -o {{.BIN_DIR}}/archied ./cmd/archied
|
|
- go build -o {{.BIN_DIR}}/archie-agent ./cmd/archie-agent
|
|
|
|
test:
|
|
desc: Run the Go test suite
|
|
cmds:
|
|
- go test ./... -count=1
|
|
|
|
check:
|
|
desc: "Full quality gate: fmt, go fix, vet, build, test, ui tests (matches [[repos.gate]] in config.toml)"
|
|
cmds:
|
|
- task: fmt
|
|
- go fix ./...
|
|
- task: vet
|
|
- task: build
|
|
- task: test
|
|
# The dashboard's suite runs here too. Left out of the gate it rots
|
|
# silently: nothing else executes it, so a broken DOM primitive ships.
|
|
- task: test:ui
|
|
|
|
release:preview:
|
|
desc: "Show the release notes that would be generated (VERSION=1.2.0, or GATEWAY=/RUNTIME= to version the two components separately)"
|
|
cmds:
|
|
- tools/release.sh --gateway {{.GATEWAY | default .VERSION}} --runtime {{.RUNTIME | default .VERSION}} --dry-run
|
|
requires:
|
|
vars: [VERSION]
|
|
|
|
release:prepare:
|
|
desc: "Write the generated notes into the changelogs, uncommitted, for editing (VERSION=1.2.0)"
|
|
cmds:
|
|
- tools/release.sh --gateway {{.GATEWAY | default .VERSION}} --runtime {{.RUNTIME | default .VERSION}} --prepare
|
|
requires:
|
|
vars: [VERSION]
|
|
|
|
release:
|
|
desc: "Freeze the edited changelogs into a release commit and tags (VERSION=1.2.0). Run release:prepare first."
|
|
cmds:
|
|
- tools/release.sh --gateway {{.GATEWAY | default .VERSION}} --runtime {{.RUNTIME | default .VERSION}} --tag
|
|
requires:
|
|
vars: [VERSION]
|
|
|
|
clean:
|
|
desc: Remove build artifacts
|
|
cmds:
|
|
- rm -rf {{.BIN_DIR}}
|
|
|
|
docker-build:
|
|
desc: Build the archie-agent sandbox image
|
|
cmds:
|
|
- docker compose build agent
|
|
|
|
docker-up:
|
|
desc: Start the NATS service via docker compose
|
|
cmds:
|
|
- docker compose up -d
|
|
|
|
docker-down:
|
|
desc: Stop the docker compose stack
|
|
cmds:
|
|
- docker compose down
|
|
|
|
docker-logs:
|
|
desc: Follow the NATS container logs
|
|
cmds:
|
|
- docker compose logs -f nats
|