diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index c194104..9bfcd52 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -61,6 +61,10 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + # Stamp the binary's reported version: the git tag's semver on a + # tagged release, otherwise the Dockerfile's release default. + build-args: | + AGENT_VERSION=${{ startsWith(github.ref, 'refs/tags/') && steps.meta.outputs.version || '1.0.1' }} # Keep the manifest list clean (one entry per arch, no "unknown/unknown" # provenance entries that confuse some ARM runtimes / imagetools). provenance: false diff --git a/CHANGELOG.md b/CHANGELOG.md index e9f016c..a7d7589 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,13 +6,20 @@ project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). The Site Agent and central Overwatch are versioned independently. -## [Unreleased] +## [1.0.1] — 2026-07-12 ### Fixed - Restore the central-dispatched cache commands (status refresh, cache resync, cache purge) that had been dropped in an earlier refactor, so operating an agent from Overwatch works again. +- The agent no longer reports its version as `dev`. Every build path now stamps + the real release version — the standalone and monorepo Docker builds default + to it, both publish workflows stamp a clean SemVer, and an `AGENT_VERSION` + environment variable overrides the reported version on an already-built image + without a rebuild. +- Defensively bound an outgoing print-server frame's payload to `MaxPayload`, so + the length always fits the 32-bit header field (parity with central). ## [1.0.0] — 2026-07-11 diff --git a/Dockerfile b/Dockerfile index 2e2cec0..2710a7d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,10 @@ # amd64/arm64/armv7 all build without QEMU — matches docker-image.yml, which # sets up buildx only (no setup-qemu). FROM --platform=$BUILDPLATFORM golang:1.25-alpine AS build -ARG AGENT_VERSION=dev +# Default to the current release so an un-tagged build (e.g. main -> :latest) +# still reports a real version, not "dev". Tagged releases override this via a +# build-arg (see docker-image.yml). Keep in sync with internal/version.Value. +ARG AGENT_VERSION=1.0.1 ARG TARGETOS TARGETARCH TARGETVARIANT WORKDIR /src COPY go.mod go.sum ./ diff --git a/internal/ozoneproto/ozoneproto.go b/internal/ozoneproto/ozoneproto.go index 8c6f0e1..3f3fb50 100644 --- a/internal/ozoneproto/ozoneproto.go +++ b/internal/ozoneproto/ozoneproto.go @@ -21,9 +21,16 @@ const ( ) // Frame wraps a JSON payload in the 5-byte header: little-endian length + 0x28. +// Payloads are bounded by MaxPayload, so the length always fits the uint32 header +// field; an over-size payload (never expected in practice) is capped defensively +// rather than overflowing the length. func Frame(payload []byte) []byte { - out := make([]byte, HeaderSize+len(payload)) - binary.LittleEndian.PutUint32(out[:4], uint32(len(payload))) + if len(payload) > MaxPayload { + payload = payload[:MaxPayload] + } + n := len(payload) // 0 <= n <= MaxPayload, so it fits in uint32 + out := make([]byte, HeaderSize+n) + binary.LittleEndian.PutUint32(out[:4], uint32(n)) out[4] = TokenByte copy(out[HeaderSize:], payload) return out diff --git a/internal/version/version.go b/internal/version/version.go index cfaad4d..92e9a30 100644 --- a/internal/version/version.go +++ b/internal/version/version.go @@ -6,4 +6,4 @@ package version // -ldflags "-X overwatch/agent/internal/version.Value=v1.2.3" // // or at runtime with the AGENT_VERSION environment variable. -var Value = "1.0.0" +var Value = "1.0.1"