Files
computer-playbook/scripts/tests/deploy/act/exec/node.sh
kevinveenbirkenbachandClaude Opus 4.8 9563948782 feat(make): add swarm-app-exec, group act exec scripts under exec/
swarm-exec reaches a DinD node; reaching a swarm service container (moodle,
openldap) needed a nested docker exec. Add swarm-app-exec, which resolves one
running replica on the node and runs a base64-encoded command inside it, so
live in-container inspection stays on a sanctioned make helper. Adding a
second exec_* script tripped the prefix-group lint, so exec_node.sh moves to
exec/node.sh and the new one lands at exec/service.sh.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-20 05:45:25 +02:00

17 lines
587 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
: "${node:?node= must be set, e.g. node=swarm-mgr-01}"
: "${cmd:?cmd= must be set, e.g. cmd='docker service ls'}"
if ! docker inspect --format '{{.State.Running}}' "${node}" 2>/dev/null | grep -q '^true$'; then
echo "ERROR: container '${node}' is not running." >&2
echo "Available swarm-test containers (if any):" >&2
docker ps --format ' {{.Names}}\t{{.Status}}' |
grep -E 'swarm-|nfs-server' >&2 ||
echo " (none — run \`make swarm-zombie app=<id>\` first)" >&2
exit 1
fi
docker exec -i "${node}" bash --noprofile --norc -c "${cmd}"