# Monthly restore drill (ADR 0015, issue #87): restores the latest backup # set of the drilled stage into a scratch environment on the runner's Docker # daemon (the stage host), verifies it, and logs the outcome as a comment on # the pinned "Restore drills" issue. Pre-go-live the drilled stage is Test; # switch DRILL_SOURCE_VOLUME to the Prod backups volume at go-live (#89). name: Restore drill on: schedule: # 04:17 UTC on the 1st — after the 03:00 stage-local nightly backups. - cron: '17 4 1 * *' workflow_dispatch: env: IMAGE_BASE: gitea.101010.cloud/stwaidele/dorfteich DRILL_SOURCE_VOLUME: dorfteich-test_backups DRILL_LOG_ISSUE: '98' jobs: drill: name: Restore the latest backup into a scratch stack runs-on: ubuntu-latest timeout-minutes: 20 steps: - name: Check out repository uses: actions/checkout@v4 - name: Log in to the Gitea registry run: printf '%s' "${{ secrets.REGISTRY_TOKEN }}" | tr -d '[:space:]' | docker login gitea.101010.cloud -u fable-5 --password-stdin - name: Run the drill id: drill run: | set -o pipefail SOURCE_VOLUME=$DRILL_SOURCE_VOLUME IMAGE_BASE=$IMAGE_BASE TAG=test \ sh deploy/backup/drill.sh 2>&1 | tee drill.log - name: Report the outcome on the drill log issue if: always() run: | OUTCOME="${{ steps.drill.outcome }}" { printf '**Restore drill %s** — source `%s`, run %s\n\n```\n' \ "$OUTCOME" "$DRILL_SOURCE_VOLUME" "${{ github.run_number }}" tail -c 3000 drill.log 2>/dev/null || echo 'drill produced no log output' printf '```\n' } > comment.md # JSON-encode via a node container — the runner image guarantees # only git/curl/docker, not python or node. docker run --rm -i node:22.15-alpine node -e \ 'const fs=require("fs");process.stdout.write(JSON.stringify({body:fs.readFileSync(0,"utf8")}))' \ < comment.md > comment.json curl -sf -X POST \ -H "Authorization: token ${{ github.token }}" \ -H 'Content-Type: application/json' \ --data @comment.json \ "${{ github.server_url }}/api/v1/repos/${{ github.repository }}/issues/$DRILL_LOG_ISSUE/comments" \ > /dev/null && echo "reported to issue #$DRILL_LOG_ISSUE"