| index 791c966..4fcd53b 100644 | ||
| --- a/.gitignore | ||
| +++ b/.gitignore | ||
| @@ -1,9 +1,12 @@ | ||
| 1 | 1 | /plugin_docker |
| 2 | 2 | /plugin_docker.exe |
| 3 | +/plugin_docker.arm64 | |
| 4 | +/plugin_docker.musl | |
| 5 | +/plugin_docker.macos-* | |
| 3 | 6 | *.o |
| 4 | 7 | *.obj |
| 5 | 8 | bin/ |
| 6 | 9 | *.tmp |
| 7 | 10 | *.log |
| 8 | -/plugin_docker.musl | |
| 9 | -/plugin_docker.macos-* | |
| 11 | +__pycache__/ | |
| 12 | +*.pyc |
| index cc652e3..efe7034 100644 | ||
| --- a/Makefile | ||
| +++ b/Makefile | ||
| @@ -1,8 +1,8 @@ | ||
| 1 | 1 | # plugin_docker — ScorpioX Bot open-source container dashboard plugin |
| 2 | -# | |
| 3 | 2 | # Targets: |
| 4 | 3 | # make native build -> ./plugin_docker |
| 5 | 4 | # make musl static musl x86_64 -> ./plugin_docker (fully static) |
| 5 | +# make arm64 static aarch64 -> ./plugin_docker.arm64 (Pi 5 / ARM64 servers) | |
| 6 | 6 | # make win64 MinGW-w64 static -> ./plugin_docker.exe |
| 7 | 7 | # make macos Apple clang -> ./plugin_docker (run on macOS) |
| 8 | 8 | # make test build + run tests/run.sh |
| @@ -12,13 +12,17 @@ CC ?= cc | ||
| 12 | 12 | CFLAGS ?= -O2 -std=c99 -Wall -Wextra -pedantic -Wno-overlength-strings |
| 13 | 13 | MUSL_CC ?= musl-gcc |
| 14 | 14 | MUSL_CFLAGS := -O2 -std=c99 -Wall -Wextra -static |
| 15 | +ARM64_CC ?= $(shell command -v aarch64-linux-musl-gcc 2>/dev/null || \ | |
| 16 | + command -v aarch64-linux-gnu-gcc 2>/dev/null || \ | |
| 17 | + echo aarch64-linux-musl-gcc) | |
| 18 | +ARM64_CFLAGS := -O2 -std=c99 -Wall -Wextra -static | |
| 15 | 19 | WIN_CC ?= x86_64-w64-mingw32-gcc |
| 16 | 20 | WIN_CFLAGS := -O2 -std=c99 -Wall -Wextra -static |
| 17 | 21 | SRC := src/plugin_docker.c |
| 18 | 22 | BIN := plugin_docker |
| 19 | 23 | EXE := plugin_docker.exe |
| 20 | 24 | |
| 21 | -.PHONY: all native musl win64 macos test clean distclean help | |
| 25 | +.PHONY: all native musl arm64 win64 macos test clean distclean help | |
| 22 | 26 | |
| 23 | 27 | all: native |
| 24 | 28 | |
| @@ -33,6 +37,13 @@ musl: $(SRC) | ||
| 33 | 37 | @echo "==> static musl build ($(MUSL_CC))" |
| 34 | 38 | $(MUSL_CC) $(MUSL_CFLAGS) -o $(BIN) $(SRC) |
| 35 | 39 | |
| 40 | +# Static aarch64 build — Raspberry Pi 5 / ARM64 servers. Prefers the musl cross | |
| 41 | +# toolchain; the Debian aarch64-linux-gnu-gcc static link also yields a | |
| 42 | +# self-contained aarch64 ELF. | |
| 43 | +arm64: $(SRC) | |
| 44 | + @echo "==> static arm64 build ($(ARM64_CC))" | |
| 45 | + $(ARM64_CC) $(ARM64_CFLAGS) -o $(BIN).arm64 $(SRC) | |
| 46 | + | |
| 36 | 47 | # Native Win64 static PE — runs on any Windows 10/11 x64 node |
| 37 | 48 | win64: $(SRC) |
| 38 | 49 | @echo "==> MinGW-w64 build ($(WIN_CC))" |
| @@ -47,10 +58,10 @@ test: native | ||
| 47 | 58 | @sh tests/run.sh |
| 48 | 59 | |
| 49 | 60 | clean: |
| 50 | - rm -f $(BIN) $(EXE) | |
| 61 | + rm -f $(BIN) $(EXE) $(BIN).arm64 $(BIN).musl $(BIN).macos-arm64 $(BIN).macos-x86_64 | |
| 51 | 62 | rm -rf bin |
| 52 | 63 | |
| 53 | 64 | distclean: clean |
| 54 | 65 | |
| 55 | 66 | help: |
| 56 | - @echo "make | make musl | make win64 | make macos | make test | make clean" | |
| 67 | + @echo "make | make musl | make arm64 | make win64 | make macos | make test | make clean" |
| index 55daa4b..1189304 100644 | ||
| --- a/README.md | ||
| +++ b/README.md | ||
| @@ -62,7 +62,7 @@ its quotes either. | ||
| 62 | 62 | ```sh |
| 63 | 63 | # Linux x86_64 — the static musl binary works on Alpine, Debian, Ubuntu, Arch, Omarchy |
| 64 | 64 | mkdir -p ~/.scorpiox/plugins |
| 65 | -curl -fsSL https://dist.scorpiox.net/bot-plugins/docker/1.1.0/linux-x86_64-musl/plugin_docker \ | |
| 65 | +curl -fsSL https://dist.scorpiox.net/bot-plugins/docker/1.1.1/linux-x86_64-musl/plugin_docker \ | |
| 66 | 66 | -o ~/.scorpiox/plugins/plugin_docker |
| 67 | 67 | chmod +x ~/.scorpiox/plugins/plugin_docker |
| 68 | 68 | ~/.scorpiox/plugins/plugin_docker --meta |
| @@ -79,7 +79,8 @@ No server restart is required — `scorpiox-server` resolves plugin routes live. | ||
| 79 | 79 | git clone https://plugingit.scorpiox.net/scorpiox-bot-plugin-docker.git |
| 80 | 80 | cd scorpiox-bot-plugin-docker |
| 81 | 81 | make # native |
| 82 | -make musl # fully static Linux — the universal artifact | |
| 82 | +make musl # fully static Linux x86_64 — the universal artifact | |
| 83 | +make arm64 # static aarch64 (ARM64 servers) -> plugin_docker.arm64 | |
| 83 | 84 | make win64 # static Windows PE via MinGW-w64 |
| 84 | 85 | make test # 90+ offline assertions, no real runtime needed |
| 85 | 86 | cp plugin_docker ~/.scorpiox/plugins/ |
| 1 | 1 | new file mode 100644 |
| index 0000000..8d9ec22 | ||
| --- /dev/null | ||
| +++ b/plugin.json | ||
| @@ -0,0 +1,10 @@ | ||
| 1 | +{ | |
| 2 | + "slug": "docker", | |
| 3 | + "id": "plugin_docker", | |
| 4 | + "title": "Local Container Dashboard", | |
| 5 | + "summary": "Zero-dependency local Docker and Podman dashboard: container list with live CPU and memory, 100-line log viewer, and safe start/stop/restart - all served from one C99 binary on your own node.", | |
| 6 | + "category": "containers", | |
| 7 | + "license": "MIT", | |
| 8 | + "capabilities": ["proc_exec_docker", "container_list", "container_logs", "container_state_change"], | |
| 9 | + "trust_notice": "Executes native C code on your node. Invokes the local docker or podman CLI to list containers, read logs and change container state; makes zero outbound network requests." | |
| 10 | +} |
| index 593f6fc..0ef9a2d 100755 | ||
| --- a/release-dist.sh | ||
| +++ b/release-dist.sh | ||
| @@ -28,7 +28,7 @@ set -euo pipefail | ||
| 28 | 28 | |
| 29 | 29 | SLUG="docker" |
| 30 | 30 | ID="plugin_docker" |
| 31 | -VERSION="1.1.0" | |
| 31 | +VERSION="1.1.1" | |
| 32 | 32 | DIST_BASE_URL="https://dist.scorpiox.net/bot-plugins" |
| 33 | 33 | |
| 34 | 34 | ROOT="$(cd "$(dirname "$0")" && pwd)" |
| @@ -37,12 +37,14 @@ cd "$ROOT" | ||
| 37 | 37 | DRY_RUN=0 |
| 38 | 38 | DO_MACOS=1 |
| 39 | 39 | DO_MIRROR=1 |
| 40 | +STANDALONE=0 | |
| 40 | 41 | for arg in "$@"; do |
| 41 | 42 | case "$arg" in |
| 42 | - --dry-run) DRY_RUN=1 ;; | |
| 43 | - --no-macos) DO_MACOS=0 ;; | |
| 44 | - --no-mirror) DO_MIRROR=0 ;; | |
| 45 | - -h|--help) sed -n '2,30p' "$0"; exit 0 ;; | |
| 43 | + --dry-run) DRY_RUN=1 ;; | |
| 44 | + --no-macos) DO_MACOS=0 ;; | |
| 45 | + --no-mirror) DO_MIRROR=0 ;; | |
| 46 | + --standalone) STANDALONE=1 ;; | |
| 47 | + -h|--help) sed -n '2,30p' "$0"; exit 0 ;; | |
| 46 | 48 | *) echo "unknown argument: $arg" >&2; exit 2 ;; |
| 47 | 49 | esac |
| 48 | 50 | done |
| @@ -63,11 +65,11 @@ die() { printf '\033[31mERROR:\033[0m %s\n' "$1" >&2; exit 1; } | ||
| 63 | 65 | # ---------------------------------------------------------------- 0. preflight |
| 64 | 66 | say "0/7 preflight" |
| 65 | 67 | |
| 66 | -if command -v scorpiox-cli-botplugin >/dev/null 2>&1; then | |
| 68 | +if [ "$STANDALONE" -eq 0 ] && command -v scorpiox-cli-botplugin >/dev/null 2>&1; then | |
| 67 | 69 | say "using scorpiox-cli-botplugin publish" |
| 68 | - exec scorpiox-cli-botplugin publish "$ROOT" | |
| 70 | + exec scorpiox-cli-botplugin publish "$ROOT" --version "$VERSION" | |
| 69 | 71 | fi |
| 70 | -echo " scorpiox-cli-botplugin not installed — running standalone pipeline" | |
| 72 | +echo " running the standalone pipeline (dist + plugingit mirror)" | |
| 71 | 73 | |
| 72 | 74 | [ -n "$(git status --porcelain 2>/dev/null)" ] && \ |
| 73 | 75 | echo " note: working tree is dirty; source.tar.gz comes from the last commit" |
| @@ -138,6 +140,20 @@ else | ||
| 138 | 140 | echo " skip linux-x86_64-musl (no musl-gcc)" |
| 139 | 141 | fi |
| 140 | 142 | |
| 143 | +# linux-arm64-musl (static aarch64 - Raspberry Pi 5 / ARM64 servers). | |
| 144 | +# Prefer musl; on a host that only has the Debian cross toolchain the static | |
| 145 | +# glibc link still yields a self-contained aarch64 ELF. | |
| 146 | +if command -v aarch64-linux-musl-gcc >/dev/null 2>&1; then | |
| 147 | + aarch64-linux-musl-gcc -O2 -std=c99 -Wall -Wextra -static -o "$STAGE/$ID.arm64" src/$ID.c \ | |
| 148 | + || die "arm64 musl build failed" | |
| 149 | + echo " built linux-arm64-musl $(wc -c < "$STAGE/$ID.arm64" | tr -d ' ') bytes" | |
| 150 | +elif command -v aarch64-linux-gnu-gcc >/dev/null 2>&1; then | |
| 151 | + aarch64-linux-gnu-gcc -O2 -std=c99 -Wall -Wextra -static -o "$STAGE/$ID.arm64" src/$ID.c \ | |
| 152 | + || die "arm64 static build failed" | |
| 153 | + echo " built linux-arm64-static $(wc -c < "$STAGE/$ID.arm64" | tr -d ' ') bytes" | |
| 154 | +else | |
| 155 | + echo " skip linux-arm64-musl (no aarch64 cross compiler)" | |
| 156 | +fi | |
| 141 | 157 | # windows-x86_64 (static PE) |
| 142 | 158 | if command -v x86_64-w64-mingw32-gcc >/dev/null 2>&1; then |
| 143 | 159 | x86_64-w64-mingw32-gcc -O2 -std=c99 -Wall -Wextra -static -o "$STAGE/$ID.exe" src/$ID.c \ |
| @@ -230,6 +246,7 @@ target_meta() { # target_meta <key> <file> <format> <relpath> <name> | ||
| 230 | 246 | emit "linux-x86_64-musl" "$STAGE/$ID.musl" "elf-x86_64-static" "linux-x86_64-musl/$ID" "$ID" |
| 231 | 247 | emit "macos-arm64" "$STAGE/$ID.macos-arm64" "macho-arm64" "macos-arm64/$ID" "$ID" |
| 232 | 248 | emit "macos-x86_64" "$STAGE/$ID.macos-x86_64" "macho-x86_64" "macos-x86_64/$ID" "$ID" |
| 249 | + emit "linux-arm64-musl" "$STAGE/$ID.arm64" "elf-arm64-static" "linux-arm64-musl/$ID" "$ID" | |
| 233 | 250 | emit "windows-x86_64" "$STAGE/$ID.exe" "pe-x86_64" "windows-x86_64/$ID.exe" "$ID" |
| 234 | 251 | printf '\n }\n}\n' |
| 235 | 252 | } > "$STAGE/manifest.json" |
| @@ -243,6 +260,7 @@ echo " manifest.json ok" | ||
| 243 | 260 | for f in source.tar.gz; do [ -f "$f" ] && sha256sum "$f"; done |
| 244 | 261 | [ -f "$ID" ] && sha256sum "$ID" | sed "s| $ID\$| linux-x86_64/$ID|" |
| 245 | 262 | [ -f "$ID.musl" ] && sha256sum "$ID.musl" | sed "s| $ID.musl\$| linux-x86_64-musl/$ID|" |
| 263 | + [ -f "$ID.arm64" ] && sha256sum "$ID.arm64" | sed "s| $ID.arm64\$| linux-arm64-musl/$ID|" | |
| 246 | 264 | [ -f "$ID.macos-arm64" ]&& sha256sum "$ID.macos-arm64"| sed "s| $ID.macos-arm64\$| macos-arm64/$ID|" |
| 247 | 265 | [ -f "$ID.macos-x86_64" ]&& sha256sum "$ID.macos-x86_64"| sed "s| $ID.macos-x86_64\$| macos-x86_64/$ID|" |
| 248 | 266 | [ -f "$ID.exe" ] && sha256sum "$ID.exe" | sed "s| $ID.exe\$| windows-x86_64/$ID.exe|" |
| @@ -252,9 +270,10 @@ echo " SHA256SUMS $(wc -l < "$STAGE/SHA256SUMS" | tr -d ' ') entries" | ||
| 252 | 270 | # ---------------------------------------------------------------- 4. stage |
| 253 | 271 | say "4/7 stage tree" |
| 254 | 272 | PKG="$STAGE/pkg" |
| 255 | -mkdir -p "$PKG/linux-x86_64" "$PKG/linux-x86_64-musl" "$PKG/macos-arm64" \ | |
| 256 | - "$PKG/macos-x86_64" "$PKG/windows-x86_64" | |
| 273 | +mkdir -p "$PKG/linux-x86_64" "$PKG/linux-x86_64-musl" "$PKG/linux-arm64-musl" \ | |
| 274 | + "$PKG/macos-arm64" "$PKG/macos-x86_64" "$PKG/windows-x86_64" | |
| 257 | 275 | cp -f "$STAGE/$ID" "$PKG/linux-x86_64/$ID" |
| 276 | +[ -f "$STAGE/$ID.arm64" ] && cp -f "$STAGE/$ID.arm64" "$PKG/linux-arm64-musl/$ID" | |
| 258 | 277 | [ -f "$STAGE/$ID.musl" ] && cp -f "$STAGE/$ID.musl" "$PKG/linux-x86_64-musl/$ID" |
| 259 | 278 | [ -f "$STAGE/$ID.macos-arm64" ]&& cp -f "$STAGE/$ID.macos-arm64" "$PKG/macos-arm64/$ID" |
| 260 | 279 | [ -f "$STAGE/$ID.macos-x86_64" ]&&cp -f "$STAGE/$ID.macos-x86_64" "$PKG/macos-x86_64/$ID" |
| index 7436fba..85d6b58 100644 | ||
| --- a/src/plugin_docker.c | ||
| +++ b/src/plugin_docker.c | ||
| @@ -52,7 +52,7 @@ | ||
| 52 | 52 | |
| 53 | 53 | #define PLUGIN_SLUG "docker" |
| 54 | 54 | #define PLUGIN_ID "plugin_docker" |
| 55 | -#define PLUGIN_VER "1.1.0" | |
| 55 | +#define PLUGIN_VER "1.1.1" | |
| 56 | 56 | |
| 57 | 57 | #define MAX_CONTAINERS 256 |
| 58 | 58 | #define LOG_TAIL 100 |
| index 1a02d6a..ebf7055 100755 | ||
| --- a/tests/run.sh | ||
| +++ b/tests/run.sh | ||
| @@ -95,7 +95,7 @@ DESC=$(printf '%s' "$META" | sed 's/.*"desc":"\([^"]*\)".*/\1/') | ||
| 95 | 95 | [ ${#DESC} -le 15 ] && pass "desc length ${#DESC} <= 15 chars" || fail "desc too long (${#DESC})" |
| 96 | 96 | NAME=$(printf '%s' "$META" | sed 's/.*"name":"\([^"]*\)".*/\1/') |
| 97 | 97 | [ "$(printf '%s' "$NAME" | wc -w | tr -d ' ')" -le 1 ] && pass "name is a single word" || fail "name has spaces" |
| 98 | -check "--version prints version" '1.1.0' "$("$BIN" --version)" | |
| 98 | +check "--version prints version" '1.1.1' "$("$BIN" --version)" | |
| 99 | 99 | check "--help is available" 'usage:' "$("$BIN" --help)" |
| 100 | 100 | |
| 101 | 101 | # ---------------------------------------------------------------- list mode |
| @@ -129,7 +129,7 @@ check_not "list header has no Content-Length" 'Content-Length' "$LIST" | ||
| 129 | 129 | check "list ok:true" '"ok":true' "$LBODY" |
| 130 | 130 | check "list plugin id" '"plugin":"plugin_docker"' "$LBODY" |
| 131 | 131 | check "list slug docker" '"slug":"docker"' "$LBODY" |
| 132 | -check "list version" '"version":"1.1.0"' "$LBODY" | |
| 132 | +check "list version" '"version":"1.1.1"' "$LBODY" | |
| 133 | 133 | check "list runtime available" '"available":true' "$LBODY" |
| 134 | 134 | check "list daemon available" '"daemon_available":true' "$LBODY" |
| 135 | 135 | check "list count 3" '"count":3' "$LBODY" |
| @@ -286,6 +286,41 @@ if [ -f plugin_docker.musl ]; then | ||
| 286 | 286 | else |
| 287 | 287 | echo " skip musl (not built)" |
| 288 | 288 | fi |
| 289 | +if [ -f plugin_docker.arm64 ]; then | |
| 290 | + case $(head -c 4 plugin_docker.arm64 | od -An -tx1 | tr -d ' \n') in | |
| 291 | + 7f454c46) pass "arm64 artifact is ELF" ;; | |
| 292 | + *) fail "arm64 artifact is not ELF" ;; | |
| 293 | + esac | |
| 294 | + # e_machine sits at offset 18, little endian: b7 00 == EM_AARCH64 | |
| 295 | + EM=$(od -An -tx1 -j 18 -N 2 plugin_docker.arm64 | tr -d ' \n') | |
| 296 | + [ "$EM" = "b700" ] && pass "arm64 artifact declares EM_AARCH64" \ | |
| 297 | + || fail "arm64 artifact e_machine is $EM, expected b700" | |
| 298 | +elif command -v aarch64-linux-musl-gcc >/dev/null 2>&1 || command -v aarch64-linux-gnu-gcc >/dev/null 2>&1; then | |
| 299 | + A64=$(command -v aarch64-linux-musl-gcc 2>/dev/null || command -v aarch64-linux-gnu-gcc) | |
| 300 | + if "$A64" -O2 -std=c99 -static -o /tmp/plugin_docker_arm64_test src/plugin_docker.c 2>/dev/null; then | |
| 301 | + pass "aarch64 cross build succeeds" | |
| 302 | + EM=$(od -An -tx1 -j 18 -N 2 /tmp/plugin_docker_arm64_test | tr -d ' \n') | |
| 303 | + [ "$EM" = "b700" ] && pass "cross-built arm64 declares EM_AARCH64" \ | |
| 304 | + || fail "cross-built arm64 e_machine is $EM, expected b700" | |
| 305 | + rm -f /tmp/plugin_docker_arm64_test | |
| 306 | + else | |
| 307 | + fail "aarch64 cross build failed" | |
| 308 | + fi | |
| 309 | +else | |
| 310 | + echo " skip arm64 (no aarch64 cross compiler)" | |
| 311 | +fi | |
| 312 | +for slice in arm64 x86_64; do | |
| 313 | + f="plugin_docker.macos-$slice" | |
| 314 | + if [ -f "$f" ]; then | |
| 315 | + MF=$(head -c 4 "$f" | od -An -tx1 | tr -d ' \n') | |
| 316 | + case "$MF" in | |
| 317 | + cffaedfe|feedfacf|cefaedfe|feedface) pass "macos-$slice artifact is Mach-O" ;; | |
| 318 | + *) fail "macos-$slice artifact is not Mach-O ($MF)" ;; | |
| 319 | + esac | |
| 320 | + else | |
| 321 | + echo " skip macos-$slice (not built)" | |
| 322 | + fi | |
| 323 | +done | |
| 289 | 324 | if [ -f plugin_docker.exe ]; then |
| 290 | 325 | MAGIC=$(head -c 2 plugin_docker.exe) |
| 291 | 326 | [ "$MAGIC" = "MZ" ] && pass "windows artifact has MZ header" || fail "windows artifact missing MZ" |
| @@ -293,6 +328,18 @@ else | ||
| 293 | 328 | echo " skip windows PE (not built)" |
| 294 | 329 | fi |
| 295 | 330 | |
| 331 | +[ -f plugin.json ] && pass "file present: plugin.json" || fail "file missing: plugin.json" | |
| 332 | +if [ -f plugin.json ]; then | |
| 333 | + python3 - <<'PY' >/dev/null 2>&1 && pass "plugin.json is valid JSON with the contract keys" || fail "plugin.json invalid or missing contract keys" | |
| 334 | +import json | |
| 335 | +d = json.load(open("plugin.json")) | |
| 336 | +for k in ("slug", "id", "title", "summary", "category", "license", "capabilities", "trust_notice"): | |
| 337 | + assert k in d, k | |
| 338 | +assert d["slug"] == "docker" and d["id"] == "plugin_docker", d | |
| 339 | +assert isinstance(d["capabilities"], list) and d["capabilities"], d | |
| 340 | +PY | |
| 341 | +fi | |
| 342 | + | |
| 296 | 343 | # ---------------------------------------------------------------- history audit |
| 297 | 344 | section "git history secret & LAN audit" |
| 298 | 345 | if git rev-parse --git-dir >/dev/null 2>&1; then |
| 299 | 346 |
| index 791c966..4fcd53b 100644 | index 791c966..4fcd53b 100644 | ||
| --- a/.gitignore | --- a/.gitignore | ||
| +++ b/.gitignore | +++ b/.gitignore | ||
| @@ -1,9 +1,12 @@ | @@ -1,9 +1,12 @@ | ||
| 1 | /plugin_docker | 1 | /plugin_docker |
| 2 | /plugin_docker.exe | 2 | /plugin_docker.exe |
| 3 | +/plugin_docker.arm64 | ||
| 4 | +/plugin_docker.musl | ||
| 5 | +/plugin_docker.macos-* | ||
| 3 | *.o | 6 | *.o |
| 4 | *.obj | 7 | *.obj |
| 5 | bin/ | 8 | bin/ |
| 6 | *.tmp | 9 | *.tmp |
| 7 | *.log | 10 | *.log |
| 8 | -/plugin_docker.musl | 11 | +__pycache__/ |
| 9 | -/plugin_docker.macos-* | 12 | +*.pyc |
| index cc652e3..efe7034 100644 | index cc652e3..efe7034 100644 | ||
| --- a/Makefile | --- a/Makefile | ||
| +++ b/Makefile | +++ b/Makefile | ||
| @@ -1,8 +1,8 @@ | @@ -1,8 +1,8 @@ | ||
| 1 | # plugin_docker — ScorpioX Bot open-source container dashboard plugin | 1 | # plugin_docker — ScorpioX Bot open-source container dashboard plugin |
| 2 | -# | ||
| 3 | # Targets: | 2 | # Targets: |
| 4 | # make native build -> ./plugin_docker | 3 | # make native build -> ./plugin_docker |
| 5 | # make musl static musl x86_64 -> ./plugin_docker (fully static) | 4 | # make musl static musl x86_64 -> ./plugin_docker (fully static) |
| 5 | +# make arm64 static aarch64 -> ./plugin_docker.arm64 (Pi 5 / ARM64 servers) | ||
| 6 | # make win64 MinGW-w64 static -> ./plugin_docker.exe | 6 | # make win64 MinGW-w64 static -> ./plugin_docker.exe |
| 7 | # make macos Apple clang -> ./plugin_docker (run on macOS) | 7 | # make macos Apple clang -> ./plugin_docker (run on macOS) |
| 8 | # make test build + run tests/run.sh | 8 | # make test build + run tests/run.sh |
| @@ -12,13 +12,17 @@ CC ?= cc | @@ -12,13 +12,17 @@ CC ?= cc | ||
| 12 | CFLAGS ?= -O2 -std=c99 -Wall -Wextra -pedantic -Wno-overlength-strings | 12 | CFLAGS ?= -O2 -std=c99 -Wall -Wextra -pedantic -Wno-overlength-strings |
| 13 | MUSL_CC ?= musl-gcc | 13 | MUSL_CC ?= musl-gcc |
| 14 | MUSL_CFLAGS := -O2 -std=c99 -Wall -Wextra -static | 14 | MUSL_CFLAGS := -O2 -std=c99 -Wall -Wextra -static |
| 15 | +ARM64_CC ?= $(shell command -v aarch64-linux-musl-gcc 2>/dev/null || \ | ||
| 16 | + command -v aarch64-linux-gnu-gcc 2>/dev/null || \ | ||
| 17 | + echo aarch64-linux-musl-gcc) | ||
| 18 | +ARM64_CFLAGS := -O2 -std=c99 -Wall -Wextra -static | ||
| 15 | WIN_CC ?= x86_64-w64-mingw32-gcc | 19 | WIN_CC ?= x86_64-w64-mingw32-gcc |
| 16 | WIN_CFLAGS := -O2 -std=c99 -Wall -Wextra -static | 20 | WIN_CFLAGS := -O2 -std=c99 -Wall -Wextra -static |
| 17 | SRC := src/plugin_docker.c | 21 | SRC := src/plugin_docker.c |
| 18 | BIN := plugin_docker | 22 | BIN := plugin_docker |
| 19 | EXE := plugin_docker.exe | 23 | EXE := plugin_docker.exe |
| 20 | 24 | ||
| 21 | -.PHONY: all native musl win64 macos test clean distclean help | 25 | +.PHONY: all native musl arm64 win64 macos test clean distclean help |
| 22 | 26 | ||
| 23 | all: native | 27 | all: native |
| 24 | 28 | ||
| @@ -33,6 +37,13 @@ musl: $(SRC) | @@ -33,6 +37,13 @@ musl: $(SRC) | ||
| 33 | @echo "==> static musl build ($(MUSL_CC))" | 37 | @echo "==> static musl build ($(MUSL_CC))" |
| 34 | $(MUSL_CC) $(MUSL_CFLAGS) -o $(BIN) $(SRC) | 38 | $(MUSL_CC) $(MUSL_CFLAGS) -o $(BIN) $(SRC) |
| 35 | 39 | ||
| 40 | +# Static aarch64 build — Raspberry Pi 5 / ARM64 servers. Prefers the musl cross | ||
| 41 | +# toolchain; the Debian aarch64-linux-gnu-gcc static link also yields a | ||
| 42 | +# self-contained aarch64 ELF. | ||
| 43 | +arm64: $(SRC) | ||
| 44 | + @echo "==> static arm64 build ($(ARM64_CC))" | ||
| 45 | + $(ARM64_CC) $(ARM64_CFLAGS) -o $(BIN).arm64 $(SRC) | ||
| 46 | + | ||
| 36 | # Native Win64 static PE — runs on any Windows 10/11 x64 node | 47 | # Native Win64 static PE — runs on any Windows 10/11 x64 node |
| 37 | win64: $(SRC) | 48 | win64: $(SRC) |
| 38 | @echo "==> MinGW-w64 build ($(WIN_CC))" | 49 | @echo "==> MinGW-w64 build ($(WIN_CC))" |
| @@ -47,10 +58,10 @@ test: native | @@ -47,10 +58,10 @@ test: native | ||
| 47 | @sh tests/run.sh | 58 | @sh tests/run.sh |
| 48 | 59 | ||
| 49 | clean: | 60 | clean: |
| 50 | - rm -f $(BIN) $(EXE) | 61 | + rm -f $(BIN) $(EXE) $(BIN).arm64 $(BIN).musl $(BIN).macos-arm64 $(BIN).macos-x86_64 |
| 51 | rm -rf bin | 62 | rm -rf bin |
| 52 | 63 | ||
| 53 | distclean: clean | 64 | distclean: clean |
| 54 | 65 | ||
| 55 | help: | 66 | help: |
| 56 | - @echo "make | make musl | make win64 | make macos | make test | make clean" | 67 | + @echo "make | make musl | make arm64 | make win64 | make macos | make test | make clean" |
| index 55daa4b..1189304 100644 | index 55daa4b..1189304 100644 | ||
| --- a/README.md | --- a/README.md | ||
| +++ b/README.md | +++ b/README.md | ||
| @@ -62,7 +62,7 @@ its quotes either. | @@ -62,7 +62,7 @@ its quotes either. | ||
| 62 | ```sh | 62 | ```sh |
| 63 | # Linux x86_64 — the static musl binary works on Alpine, Debian, Ubuntu, Arch, Omarchy | 63 | # Linux x86_64 — the static musl binary works on Alpine, Debian, Ubuntu, Arch, Omarchy |
| 64 | mkdir -p ~/.scorpiox/plugins | 64 | mkdir -p ~/.scorpiox/plugins |
| 65 | -curl -fsSL https://dist.scorpiox.net/bot-plugins/docker/1.1.0/linux-x86_64-musl/plugin_docker \ | 65 | +curl -fsSL https://dist.scorpiox.net/bot-plugins/docker/1.1.1/linux-x86_64-musl/plugin_docker \ |
| 66 | -o ~/.scorpiox/plugins/plugin_docker | 66 | -o ~/.scorpiox/plugins/plugin_docker |
| 67 | chmod +x ~/.scorpiox/plugins/plugin_docker | 67 | chmod +x ~/.scorpiox/plugins/plugin_docker |
| 68 | ~/.scorpiox/plugins/plugin_docker --meta | 68 | ~/.scorpiox/plugins/plugin_docker --meta |
| @@ -79,7 +79,8 @@ No server restart is required — `scorpiox-server` resolves plugin routes live. | @@ -79,7 +79,8 @@ No server restart is required — `scorpiox-server` resolves plugin routes live. | ||
| 79 | git clone https://plugingit.scorpiox.net/scorpiox-bot-plugin-docker.git | 79 | git clone https://plugingit.scorpiox.net/scorpiox-bot-plugin-docker.git |
| 80 | cd scorpiox-bot-plugin-docker | 80 | cd scorpiox-bot-plugin-docker |
| 81 | make # native | 81 | make # native |
| 82 | -make musl # fully static Linux — the universal artifact | 82 | +make musl # fully static Linux x86_64 — the universal artifact |
| 83 | +make arm64 # static aarch64 (ARM64 servers) -> plugin_docker.arm64 | ||
| 83 | make win64 # static Windows PE via MinGW-w64 | 84 | make win64 # static Windows PE via MinGW-w64 |
| 84 | make test # 90+ offline assertions, no real runtime needed | 85 | make test # 90+ offline assertions, no real runtime needed |
| 85 | cp plugin_docker ~/.scorpiox/plugins/ | 86 | cp plugin_docker ~/.scorpiox/plugins/ |
| 1 | new file mode 100644 | 1 | new file mode 100644 |
| index 0000000..8d9ec22 | index 0000000..8d9ec22 | ||
| --- /dev/null | --- /dev/null | ||
| +++ b/plugin.json | +++ b/plugin.json | ||
| @@ -0,0 +1,10 @@ | @@ -0,0 +1,10 @@ | ||
| 1 | +{ | ||
| 2 | + "slug": "docker", | ||
| 3 | + "id": "plugin_docker", | ||
| 4 | + "title": "Local Container Dashboard", | ||
| 5 | + "summary": "Zero-dependency local Docker and Podman dashboard: container list with live CPU and memory, 100-line log viewer, and safe start/stop/restart - all served from one C99 binary on your own node.", | ||
| 6 | + "category": "containers", | ||
| 7 | + "license": "MIT", | ||
| 8 | + "capabilities": ["proc_exec_docker", "container_list", "container_logs", "container_state_change"], | ||
| 9 | + "trust_notice": "Executes native C code on your node. Invokes the local docker or podman CLI to list containers, read logs and change container state; makes zero outbound network requests." | ||
| 10 | +} |
| index 593f6fc..0ef9a2d 100755 | index 593f6fc..0ef9a2d 100755 | ||
| --- a/release-dist.sh | --- a/release-dist.sh | ||
| +++ b/release-dist.sh | +++ b/release-dist.sh | ||
| @@ -28,7 +28,7 @@ set -euo pipefail | @@ -28,7 +28,7 @@ set -euo pipefail | ||
| 28 | 28 | ||
| 29 | SLUG="docker" | 29 | SLUG="docker" |
| 30 | ID="plugin_docker" | 30 | ID="plugin_docker" |
| 31 | -VERSION="1.1.0" | 31 | +VERSION="1.1.1" |
| 32 | DIST_BASE_URL="https://dist.scorpiox.net/bot-plugins" | 32 | DIST_BASE_URL="https://dist.scorpiox.net/bot-plugins" |
| 33 | 33 | ||
| 34 | ROOT="$(cd "$(dirname "$0")" && pwd)" | 34 | ROOT="$(cd "$(dirname "$0")" && pwd)" |
| @@ -37,12 +37,14 @@ cd "$ROOT" | @@ -37,12 +37,14 @@ cd "$ROOT" | ||
| 37 | DRY_RUN=0 | 37 | DRY_RUN=0 |
| 38 | DO_MACOS=1 | 38 | DO_MACOS=1 |
| 39 | DO_MIRROR=1 | 39 | DO_MIRROR=1 |
| 40 | +STANDALONE=0 | ||
| 40 | for arg in "$@"; do | 41 | for arg in "$@"; do |
| 41 | case "$arg" in | 42 | case "$arg" in |
| 42 | - --dry-run) DRY_RUN=1 ;; | 43 | + --dry-run) DRY_RUN=1 ;; |
| 43 | - --no-macos) DO_MACOS=0 ;; | 44 | + --no-macos) DO_MACOS=0 ;; |
| 44 | - --no-mirror) DO_MIRROR=0 ;; | 45 | + --no-mirror) DO_MIRROR=0 ;; |
| 45 | - -h|--help) sed -n '2,30p' "$0"; exit 0 ;; | 46 | + --standalone) STANDALONE=1 ;; |
| 47 | + -h|--help) sed -n '2,30p' "$0"; exit 0 ;; | ||
| 46 | *) echo "unknown argument: $arg" >&2; exit 2 ;; | 48 | *) echo "unknown argument: $arg" >&2; exit 2 ;; |
| 47 | esac | 49 | esac |
| 48 | done | 50 | done |
| @@ -63,11 +65,11 @@ die() { printf '\033[31mERROR:\033[0m %s\n' "$1" >&2; exit 1; } | @@ -63,11 +65,11 @@ die() { printf '\033[31mERROR:\033[0m %s\n' "$1" >&2; exit 1; } | ||
| 63 | # ---------------------------------------------------------------- 0. preflight | 65 | # ---------------------------------------------------------------- 0. preflight |
| 64 | say "0/7 preflight" | 66 | say "0/7 preflight" |
| 65 | 67 | ||
| 66 | -if command -v scorpiox-cli-botplugin >/dev/null 2>&1; then | 68 | +if [ "$STANDALONE" -eq 0 ] && command -v scorpiox-cli-botplugin >/dev/null 2>&1; then |
| 67 | say "using scorpiox-cli-botplugin publish" | 69 | say "using scorpiox-cli-botplugin publish" |
| 68 | - exec scorpiox-cli-botplugin publish "$ROOT" | 70 | + exec scorpiox-cli-botplugin publish "$ROOT" --version "$VERSION" |
| 69 | fi | 71 | fi |
| 70 | -echo " scorpiox-cli-botplugin not installed — running standalone pipeline" | 72 | +echo " running the standalone pipeline (dist + plugingit mirror)" |
| 71 | 73 | ||
| 72 | [ -n "$(git status --porcelain 2>/dev/null)" ] && \ | 74 | [ -n "$(git status --porcelain 2>/dev/null)" ] && \ |
| 73 | echo " note: working tree is dirty; source.tar.gz comes from the last commit" | 75 | echo " note: working tree is dirty; source.tar.gz comes from the last commit" |
| @@ -138,6 +140,20 @@ else | @@ -138,6 +140,20 @@ else | ||
| 138 | echo " skip linux-x86_64-musl (no musl-gcc)" | 140 | echo " skip linux-x86_64-musl (no musl-gcc)" |
| 139 | fi | 141 | fi |
| 140 | 142 | ||
| 143 | +# linux-arm64-musl (static aarch64 - Raspberry Pi 5 / ARM64 servers). | ||
| 144 | +# Prefer musl; on a host that only has the Debian cross toolchain the static | ||
| 145 | +# glibc link still yields a self-contained aarch64 ELF. | ||
| 146 | +if command -v aarch64-linux-musl-gcc >/dev/null 2>&1; then | ||
| 147 | + aarch64-linux-musl-gcc -O2 -std=c99 -Wall -Wextra -static -o "$STAGE/$ID.arm64" src/$ID.c \ | ||
| 148 | + || die "arm64 musl build failed" | ||
| 149 | + echo " built linux-arm64-musl $(wc -c < "$STAGE/$ID.arm64" | tr -d ' ') bytes" | ||
| 150 | +elif command -v aarch64-linux-gnu-gcc >/dev/null 2>&1; then | ||
| 151 | + aarch64-linux-gnu-gcc -O2 -std=c99 -Wall -Wextra -static -o "$STAGE/$ID.arm64" src/$ID.c \ | ||
| 152 | + || die "arm64 static build failed" | ||
| 153 | + echo " built linux-arm64-static $(wc -c < "$STAGE/$ID.arm64" | tr -d ' ') bytes" | ||
| 154 | +else | ||
| 155 | + echo " skip linux-arm64-musl (no aarch64 cross compiler)" | ||
| 156 | +fi | ||
| 141 | # windows-x86_64 (static PE) | 157 | # windows-x86_64 (static PE) |
| 142 | if command -v x86_64-w64-mingw32-gcc >/dev/null 2>&1; then | 158 | if command -v x86_64-w64-mingw32-gcc >/dev/null 2>&1; then |
| 143 | x86_64-w64-mingw32-gcc -O2 -std=c99 -Wall -Wextra -static -o "$STAGE/$ID.exe" src/$ID.c \ | 159 | x86_64-w64-mingw32-gcc -O2 -std=c99 -Wall -Wextra -static -o "$STAGE/$ID.exe" src/$ID.c \ |
| @@ -230,6 +246,7 @@ target_meta() { # target_meta <key> <file> <format> <relpath> <name> | @@ -230,6 +246,7 @@ target_meta() { # target_meta <key> <file> <format> <relpath> <name> | ||
| 230 | emit "linux-x86_64-musl" "$STAGE/$ID.musl" "elf-x86_64-static" "linux-x86_64-musl/$ID" "$ID" | 246 | emit "linux-x86_64-musl" "$STAGE/$ID.musl" "elf-x86_64-static" "linux-x86_64-musl/$ID" "$ID" |
| 231 | emit "macos-arm64" "$STAGE/$ID.macos-arm64" "macho-arm64" "macos-arm64/$ID" "$ID" | 247 | emit "macos-arm64" "$STAGE/$ID.macos-arm64" "macho-arm64" "macos-arm64/$ID" "$ID" |
| 232 | emit "macos-x86_64" "$STAGE/$ID.macos-x86_64" "macho-x86_64" "macos-x86_64/$ID" "$ID" | 248 | emit "macos-x86_64" "$STAGE/$ID.macos-x86_64" "macho-x86_64" "macos-x86_64/$ID" "$ID" |
| 249 | + emit "linux-arm64-musl" "$STAGE/$ID.arm64" "elf-arm64-static" "linux-arm64-musl/$ID" "$ID" | ||
| 233 | emit "windows-x86_64" "$STAGE/$ID.exe" "pe-x86_64" "windows-x86_64/$ID.exe" "$ID" | 250 | emit "windows-x86_64" "$STAGE/$ID.exe" "pe-x86_64" "windows-x86_64/$ID.exe" "$ID" |
| 234 | printf '\n }\n}\n' | 251 | printf '\n }\n}\n' |
| 235 | } > "$STAGE/manifest.json" | 252 | } > "$STAGE/manifest.json" |
| @@ -243,6 +260,7 @@ echo " manifest.json ok" | @@ -243,6 +260,7 @@ echo " manifest.json ok" | ||
| 243 | for f in source.tar.gz; do [ -f "$f" ] && sha256sum "$f"; done | 260 | for f in source.tar.gz; do [ -f "$f" ] && sha256sum "$f"; done |
| 244 | [ -f "$ID" ] && sha256sum "$ID" | sed "s| $ID\$| linux-x86_64/$ID|" | 261 | [ -f "$ID" ] && sha256sum "$ID" | sed "s| $ID\$| linux-x86_64/$ID|" |
| 245 | [ -f "$ID.musl" ] && sha256sum "$ID.musl" | sed "s| $ID.musl\$| linux-x86_64-musl/$ID|" | 262 | [ -f "$ID.musl" ] && sha256sum "$ID.musl" | sed "s| $ID.musl\$| linux-x86_64-musl/$ID|" |
| 263 | + [ -f "$ID.arm64" ] && sha256sum "$ID.arm64" | sed "s| $ID.arm64\$| linux-arm64-musl/$ID|" | ||
| 246 | [ -f "$ID.macos-arm64" ]&& sha256sum "$ID.macos-arm64"| sed "s| $ID.macos-arm64\$| macos-arm64/$ID|" | 264 | [ -f "$ID.macos-arm64" ]&& sha256sum "$ID.macos-arm64"| sed "s| $ID.macos-arm64\$| macos-arm64/$ID|" |
| 247 | [ -f "$ID.macos-x86_64" ]&& sha256sum "$ID.macos-x86_64"| sed "s| $ID.macos-x86_64\$| macos-x86_64/$ID|" | 265 | [ -f "$ID.macos-x86_64" ]&& sha256sum "$ID.macos-x86_64"| sed "s| $ID.macos-x86_64\$| macos-x86_64/$ID|" |
| 248 | [ -f "$ID.exe" ] && sha256sum "$ID.exe" | sed "s| $ID.exe\$| windows-x86_64/$ID.exe|" | 266 | [ -f "$ID.exe" ] && sha256sum "$ID.exe" | sed "s| $ID.exe\$| windows-x86_64/$ID.exe|" |
| @@ -252,9 +270,10 @@ echo " SHA256SUMS $(wc -l < "$STAGE/SHA256SUMS" | tr -d ' ') entries" | @@ -252,9 +270,10 @@ echo " SHA256SUMS $(wc -l < "$STAGE/SHA256SUMS" | tr -d ' ') entries" | ||
| 252 | # ---------------------------------------------------------------- 4. stage | 270 | # ---------------------------------------------------------------- 4. stage |
| 253 | say "4/7 stage tree" | 271 | say "4/7 stage tree" |
| 254 | PKG="$STAGE/pkg" | 272 | PKG="$STAGE/pkg" |
| 255 | -mkdir -p "$PKG/linux-x86_64" "$PKG/linux-x86_64-musl" "$PKG/macos-arm64" \ | 273 | +mkdir -p "$PKG/linux-x86_64" "$PKG/linux-x86_64-musl" "$PKG/linux-arm64-musl" \ |
| 256 | - "$PKG/macos-x86_64" "$PKG/windows-x86_64" | 274 | + "$PKG/macos-arm64" "$PKG/macos-x86_64" "$PKG/windows-x86_64" |
| 257 | cp -f "$STAGE/$ID" "$PKG/linux-x86_64/$ID" | 275 | cp -f "$STAGE/$ID" "$PKG/linux-x86_64/$ID" |
| 276 | +[ -f "$STAGE/$ID.arm64" ] && cp -f "$STAGE/$ID.arm64" "$PKG/linux-arm64-musl/$ID" | ||
| 258 | [ -f "$STAGE/$ID.musl" ] && cp -f "$STAGE/$ID.musl" "$PKG/linux-x86_64-musl/$ID" | 277 | [ -f "$STAGE/$ID.musl" ] && cp -f "$STAGE/$ID.musl" "$PKG/linux-x86_64-musl/$ID" |
| 259 | [ -f "$STAGE/$ID.macos-arm64" ]&& cp -f "$STAGE/$ID.macos-arm64" "$PKG/macos-arm64/$ID" | 278 | [ -f "$STAGE/$ID.macos-arm64" ]&& cp -f "$STAGE/$ID.macos-arm64" "$PKG/macos-arm64/$ID" |
| 260 | [ -f "$STAGE/$ID.macos-x86_64" ]&&cp -f "$STAGE/$ID.macos-x86_64" "$PKG/macos-x86_64/$ID" | 279 | [ -f "$STAGE/$ID.macos-x86_64" ]&&cp -f "$STAGE/$ID.macos-x86_64" "$PKG/macos-x86_64/$ID" |
| index 7436fba..85d6b58 100644 | index 7436fba..85d6b58 100644 | ||
| --- a/src/plugin_docker.c | --- a/src/plugin_docker.c | ||
| +++ b/src/plugin_docker.c | +++ b/src/plugin_docker.c | ||
| @@ -52,7 +52,7 @@ | @@ -52,7 +52,7 @@ | ||
| 52 | 52 | ||
| 53 | #define PLUGIN_SLUG "docker" | 53 | #define PLUGIN_SLUG "docker" |
| 54 | #define PLUGIN_ID "plugin_docker" | 54 | #define PLUGIN_ID "plugin_docker" |
| 55 | -#define PLUGIN_VER "1.1.0" | 55 | +#define PLUGIN_VER "1.1.1" |
| 56 | 56 | ||
| 57 | #define MAX_CONTAINERS 256 | 57 | #define MAX_CONTAINERS 256 |
| 58 | #define LOG_TAIL 100 | 58 | #define LOG_TAIL 100 |
| index 1a02d6a..ebf7055 100755 | index 1a02d6a..ebf7055 100755 | ||
| --- a/tests/run.sh | --- a/tests/run.sh | ||
| +++ b/tests/run.sh | +++ b/tests/run.sh | ||
| @@ -95,7 +95,7 @@ DESC=$(printf '%s' "$META" | sed 's/.*"desc":"\([^"]*\)".*/\1/') | @@ -95,7 +95,7 @@ DESC=$(printf '%s' "$META" | sed 's/.*"desc":"\([^"]*\)".*/\1/') | ||
| 95 | [ ${#DESC} -le 15 ] && pass "desc length ${#DESC} <= 15 chars" || fail "desc too long (${#DESC})" | 95 | [ ${#DESC} -le 15 ] && pass "desc length ${#DESC} <= 15 chars" || fail "desc too long (${#DESC})" |
| 96 | NAME=$(printf '%s' "$META" | sed 's/.*"name":"\([^"]*\)".*/\1/') | 96 | NAME=$(printf '%s' "$META" | sed 's/.*"name":"\([^"]*\)".*/\1/') |
| 97 | [ "$(printf '%s' "$NAME" | wc -w | tr -d ' ')" -le 1 ] && pass "name is a single word" || fail "name has spaces" | 97 | [ "$(printf '%s' "$NAME" | wc -w | tr -d ' ')" -le 1 ] && pass "name is a single word" || fail "name has spaces" |
| 98 | -check "--version prints version" '1.1.0' "$("$BIN" --version)" | 98 | +check "--version prints version" '1.1.1' "$("$BIN" --version)" |
| 99 | check "--help is available" 'usage:' "$("$BIN" --help)" | 99 | check "--help is available" 'usage:' "$("$BIN" --help)" |
| 100 | 100 | ||
| 101 | # ---------------------------------------------------------------- list mode | 101 | # ---------------------------------------------------------------- list mode |
| @@ -129,7 +129,7 @@ check_not "list header has no Content-Length" 'Content-Length' "$LIST" | @@ -129,7 +129,7 @@ check_not "list header has no Content-Length" 'Content-Length' "$LIST" | ||
| 129 | check "list ok:true" '"ok":true' "$LBODY" | 129 | check "list ok:true" '"ok":true' "$LBODY" |
| 130 | check "list plugin id" '"plugin":"plugin_docker"' "$LBODY" | 130 | check "list plugin id" '"plugin":"plugin_docker"' "$LBODY" |
| 131 | check "list slug docker" '"slug":"docker"' "$LBODY" | 131 | check "list slug docker" '"slug":"docker"' "$LBODY" |
| 132 | -check "list version" '"version":"1.1.0"' "$LBODY" | 132 | +check "list version" '"version":"1.1.1"' "$LBODY" |
| 133 | check "list runtime available" '"available":true' "$LBODY" | 133 | check "list runtime available" '"available":true' "$LBODY" |
| 134 | check "list daemon available" '"daemon_available":true' "$LBODY" | 134 | check "list daemon available" '"daemon_available":true' "$LBODY" |
| 135 | check "list count 3" '"count":3' "$LBODY" | 135 | check "list count 3" '"count":3' "$LBODY" |
| @@ -286,6 +286,41 @@ if [ -f plugin_docker.musl ]; then | @@ -286,6 +286,41 @@ if [ -f plugin_docker.musl ]; then | ||
| 286 | else | 286 | else |
| 287 | echo " skip musl (not built)" | 287 | echo " skip musl (not built)" |
| 288 | fi | 288 | fi |
| 289 | +if [ -f plugin_docker.arm64 ]; then | ||
| 290 | + case $(head -c 4 plugin_docker.arm64 | od -An -tx1 | tr -d ' \n') in | ||
| 291 | + 7f454c46) pass "arm64 artifact is ELF" ;; | ||
| 292 | + *) fail "arm64 artifact is not ELF" ;; | ||
| 293 | + esac | ||
| 294 | + # e_machine sits at offset 18, little endian: b7 00 == EM_AARCH64 | ||
| 295 | + EM=$(od -An -tx1 -j 18 -N 2 plugin_docker.arm64 | tr -d ' \n') | ||
| 296 | + [ "$EM" = "b700" ] && pass "arm64 artifact declares EM_AARCH64" \ | ||
| 297 | + || fail "arm64 artifact e_machine is $EM, expected b700" | ||
| 298 | +elif command -v aarch64-linux-musl-gcc >/dev/null 2>&1 || command -v aarch64-linux-gnu-gcc >/dev/null 2>&1; then | ||
| 299 | + A64=$(command -v aarch64-linux-musl-gcc 2>/dev/null || command -v aarch64-linux-gnu-gcc) | ||
| 300 | + if "$A64" -O2 -std=c99 -static -o /tmp/plugin_docker_arm64_test src/plugin_docker.c 2>/dev/null; then | ||
| 301 | + pass "aarch64 cross build succeeds" | ||
| 302 | + EM=$(od -An -tx1 -j 18 -N 2 /tmp/plugin_docker_arm64_test | tr -d ' \n') | ||
| 303 | + [ "$EM" = "b700" ] && pass "cross-built arm64 declares EM_AARCH64" \ | ||
| 304 | + || fail "cross-built arm64 e_machine is $EM, expected b700" | ||
| 305 | + rm -f /tmp/plugin_docker_arm64_test | ||
| 306 | + else | ||
| 307 | + fail "aarch64 cross build failed" | ||
| 308 | + fi | ||
| 309 | +else | ||
| 310 | + echo " skip arm64 (no aarch64 cross compiler)" | ||
| 311 | +fi | ||
| 312 | +for slice in arm64 x86_64; do | ||
| 313 | + f="plugin_docker.macos-$slice" | ||
| 314 | + if [ -f "$f" ]; then | ||
| 315 | + MF=$(head -c 4 "$f" | od -An -tx1 | tr -d ' \n') | ||
| 316 | + case "$MF" in | ||
| 317 | + cffaedfe|feedfacf|cefaedfe|feedface) pass "macos-$slice artifact is Mach-O" ;; | ||
| 318 | + *) fail "macos-$slice artifact is not Mach-O ($MF)" ;; | ||
| 319 | + esac | ||
| 320 | + else | ||
| 321 | + echo " skip macos-$slice (not built)" | ||
| 322 | + fi | ||
| 323 | +done | ||
| 289 | if [ -f plugin_docker.exe ]; then | 324 | if [ -f plugin_docker.exe ]; then |
| 290 | MAGIC=$(head -c 2 plugin_docker.exe) | 325 | MAGIC=$(head -c 2 plugin_docker.exe) |
| 291 | [ "$MAGIC" = "MZ" ] && pass "windows artifact has MZ header" || fail "windows artifact missing MZ" | 326 | [ "$MAGIC" = "MZ" ] && pass "windows artifact has MZ header" || fail "windows artifact missing MZ" |
| @@ -293,6 +328,18 @@ else | @@ -293,6 +328,18 @@ else | ||
| 293 | echo " skip windows PE (not built)" | 328 | echo " skip windows PE (not built)" |
| 294 | fi | 329 | fi |
| 295 | 330 | ||
| 331 | +[ -f plugin.json ] && pass "file present: plugin.json" || fail "file missing: plugin.json" | ||
| 332 | +if [ -f plugin.json ]; then | ||
| 333 | + python3 - <<'PY' >/dev/null 2>&1 && pass "plugin.json is valid JSON with the contract keys" || fail "plugin.json invalid or missing contract keys" | ||
| 334 | +import json | ||
| 335 | +d = json.load(open("plugin.json")) | ||
| 336 | +for k in ("slug", "id", "title", "summary", "category", "license", "capabilities", "trust_notice"): | ||
| 337 | + assert k in d, k | ||
| 338 | +assert d["slug"] == "docker" and d["id"] == "plugin_docker", d | ||
| 339 | +assert isinstance(d["capabilities"], list) and d["capabilities"], d | ||
| 340 | +PY | ||
| 341 | +fi | ||
| 342 | + | ||
| 296 | # ---------------------------------------------------------------- history audit | 343 | # ---------------------------------------------------------------- history audit |
| 297 | section "git history secret & LAN audit" | 344 | section "git history secret & LAN audit" |
| 298 | if git rev-parse --git-dir >/dev/null 2>&1; then | 345 | if git rev-parse --git-dir >/dev/null 2>&1; then |
| 299 | 346 |