diff --git a/.github/workflows/test-guide.yml b/.github/workflows/test-guide.yml index a47b994633..58e424b68d 100644 --- a/.github/workflows/test-guide.yml +++ b/.github/workflows/test-guide.yml @@ -94,17 +94,7 @@ jobs: - name: 🚀 Deploy the compose role against the server if: ${{ env.GUIDE_MODE == 'compose' }} shell: bash - run: | - set -euo pipefail - awk '/^### Production$/{p=1} p && /^```bash$/{c=1; next} c && /^```$/{exit} c' \ - "roles/${GUIDE_ROLE}/README.md" > /tmp/deploy.sh - sed -n '1,/docker run/p' /tmp/deploy.sh | grep -E '^[A-Z_]+=' \ - | sed 's#^HOST=.*#HOST=localhost#' > /tmp/run.sh - perl -0777 -ne "print \$1 if /bash -c '(.*)'/s" /tmp/deploy.sh >> /tmp/run.sh - test -s /tmp/run.sh - sed -i "s##ssh-ed25519 AAAA_TEST_DUMMY_KEY github-ci-dummy@infinito#" /tmp/run.sh - source scripts/meta/env/load.sh - docker exec -i "${INFINITO_CONTAINER}" bash -s < /tmp/run.sh + run: bash scripts/github/guide/compose_deploy.sh - name: 🩺 Collect rescue diagnostics (recursive DiD snapshot) if: failure() diff --git a/scripts/github/guide/compose_deploy.sh b/scripts/github/guide/compose_deploy.sh new file mode 100755 index 0000000000..ba7e5692a6 --- /dev/null +++ b/scripts/github/guide/compose_deploy.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +# Deploy a compose role against the booted server by replaying the +# Production block of its README inside the CI container. +# Env: GUIDE_ROLE. +set -euo pipefail + +awk '/^### Production$/{p=1} p && /^```bash$/{c=1; next} c && /^```$/{exit} c' \ + "roles/${GUIDE_ROLE}/README.md" >/tmp/deploy.sh +sed -n '1,/docker run/p' /tmp/deploy.sh | grep -E '^[A-Z_]+=' | + sed 's#^HOST=.*#HOST=localhost#' >/tmp/run.sh +perl -0777 -ne "print \$1 if /bash -c '(.*)'/s" /tmp/deploy.sh >>/tmp/run.sh +test -s /tmp/run.sh +sed -i "s##ssh-ed25519 AAAA_TEST_DUMMY_KEY github-ci-dummy@infinito#" /tmp/run.sh +# shellcheck source=scripts/meta/env/load.sh +source scripts/meta/env/load.sh +docker exec -i "${INFINITO_CONTAINER}" bash -s