diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index a61e860..92d0950 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/devcontainers/go:1.24-bookworm +FROM mcr.microsoft.com/devcontainers/go:1.24-trixie # Install node environment RUN apt-get update && \ diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 452cee8..4af61c6 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,7 +1,7 @@ // For format details, see https://aka.ms/devcontainer.json. For config options, see the // README at: https://github.com/devcontainers/templates/tree/main/src/python { - "name": "go:1.24-bookworm", + "name": "go:1.24-trixie", "runArgs": [ "--name=agent", "--network=host" @@ -20,5 +20,5 @@ 3000, 8080 ], - "postCreateCommand": "cd ui && yarn install && yarn build && cd ../machinery && go mod download" + "postCreateCommand": "cd ui && yarn install && yarn build && cd ../machinery && go mod download && bash ./verify-moq-devcontainer.sh" } \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..bc0dcb4 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,14 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "agent: moq verify", + "type": "shell", + "command": "bash ./verify-moq-devcontainer.sh", + "options": { + "cwd": "${workspaceFolder}/machinery" + }, + "problemMatcher": [] + } + ] +} diff --git a/README.md b/README.md index 2644cff..0ba64dd 100644 --- a/README.md +++ b/README.md @@ -443,6 +443,17 @@ The `/anon` relay route is intended for interoperability testing. Production deployments must set `AGENT_LIVE_MOQ_URL` to a short-lived, device-scoped publisher URL issued by Hub API. +To verify the native SDK in a development container, rebuild the Agent or shared +monorepo devcontainer so it uses the Trixie base, then run the VS Code task +`agent: moq verify`. The same check is available from a terminal: + + cd machinery + bash ./verify-moq-devcontainer.sh + +The check requires glibc 2.38 or newer, runs the tagged package tests, links the +complete Agent with `-tags moq`, and executes the resulting binary's version +command. Both devcontainers also run this check during their post-create setup. + ## What is new? This repository contains the next generation of Kerberos.io, **Kerberos Agent (v3)**, and is the successor of the machinery and web repositories. A switch in technologies and architecture has been made. This version is still under active development and can be followed on the [develop branch](https://github.com/kerberos-io/agent/tree/develop) and [project overview](https://github.com/kerberos-io/agent/projects/1). diff --git a/machinery/verify-moq-devcontainer.sh b/machinery/verify-moq-devcontainer.sh new file mode 100644 index 0000000..0c58308 --- /dev/null +++ b/machinery/verify-moq-devcontainer.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +set -euo pipefail + +required_glibc="2.38" +current_glibc="$(getconf GNU_LIBC_VERSION | awk '{print $2}')" + +if ! dpkg --compare-versions "$current_glibc" ge "$required_glibc"; then + echo "MoQ requires glibc ${required_glibc}+; this container has ${current_glibc}." >&2 + echo "Rebuild the devcontainer with the Trixie base, then run this check again." >&2 + exit 1 +fi + +echo "==> Testing MoQ packages (glibc ${current_glibc})" +GOWORK=off go test -tags moq ./src/cloud/livemoq ./src/cloud + +binary="${TMPDIR:-/tmp}/agent-moq" +trap 'rm -f "$binary"' EXIT + +echo "==> Linking the MoQ Agent" +GOWORK=off go build -tags moq -o "$binary" ./main.go + +echo "==> Running the linked binary" +"$binary" -action version