ci(distribution): verify Docker Compose package lifecycle #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Docker Compose Acceptance | ||
|
Check failure on line 1 in .github/workflows/docker-compose-acceptance.yml
|
||
| on: | ||
| pull_request: | ||
| branches: [agent/bootstrap-siteops] | ||
| push: | ||
| branches: [agent/bootstrap-siteops] | ||
| workflow_dispatch: | ||
| permissions: | ||
| contents: read | ||
| jobs: | ||
| docker-compose-acceptance: | ||
| runs-on: ubuntu-24.04 | ||
| timeout-minutes: 25 | ||
| env: | ||
| COMPOSE_PROJECT_NAME: siteops-acceptance-${{ github.run_id }} | ||
| ACCEPTANCE_DIR: ${{ runner.temp }}/siteops-acceptance | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 22 | ||
| cache: pnpm | ||
| - name: Enable pnpm | ||
| run: corepack enable | ||
| - name: Preflight source and Docker tools | ||
| shell: bash | ||
| run: | | ||
| set -Eeuo pipefail | ||
| pnpm install --frozen-lockfile | ||
| pnpm verify | ||
| sh -n scripts/qa-distribution.sh scripts/qa-local-fixture.sh scripts/install-local.sh | ||
| docker version --format '{{.Server.Version}}' | ||
| docker compose version | ||
| - name: Run canonical Docker distribution acceptance | ||
| shell: bash | ||
| run: | | ||
| set -Eeuo pipefail | ||
| mkdir -p "$ACCEPTANCE_DIR" | ||
| log="$ACCEPTANCE_DIR/acceptance.log" | ||
| summary="$ACCEPTANCE_DIR/acceptance-summary.txt" | ||
| cleanup="$ACCEPTANCE_DIR/cleanup-receipt.txt" | ||
| : >"$log" | ||
| echo "commit=${GITHUB_SHA}" >"$summary" | ||
| docker version --format 'docker_server={{.Server.Version}}' >>"$summary" | ||
| docker compose version >>"$summary" | ||
| trap 'status=$?; set +e; docker compose down --volumes >>"$log" 2>&1; cleanup_status=$?; printf "project=%s\\ncleanup_status=%s\\n" "$COMPOSE_PROJECT_NAME" "$cleanup_status" >"$cleanup"; printf "acceptance_status=%s\\ncleanup_status=%s\\n" "$status" "$cleanup_status" >>"$summary"; if [ "$status" -eq 0 ] && [ "$cleanup_status" -ne 0 ]; then exit "$cleanup_status"; fi; exit "$status"' EXIT | ||
| scripts/qa-distribution.sh >>"$log" 2>&1 | ||
| image_id="$(docker image inspect --format '{{.Id}}' baota-siteops:test)" | ||
| printf "image_id=%s\\nhealth_url=http://127.0.0.1:3210/healthz\\nresult=passed\\n" "$image_id" >>"$summary" | ||
| - name: Publish run summary | ||
| if: always() | ||
| shell: bash | ||
| run: | | ||
| set -Eeuo pipefail | ||
| { | ||
| echo '## Docker Compose Acceptance' | ||
| echo | ||
| echo "Tested commit: \`${GITHUB_SHA}\`" | ||
| test -f "$ACCEPTANCE_DIR/acceptance-summary.txt" && sed 's/^/- /' "$ACCEPTANCE_DIR/acceptance-summary.txt" || echo '- No acceptance summary was produced.' | ||
| test -f "$ACCEPTANCE_DIR/cleanup-receipt.txt" && sed 's/^/- /' "$ACCEPTANCE_DIR/cleanup-receipt.txt" || echo '- No cleanup receipt was produced.' | ||
| } >> "$GITHUB_STEP_SUMMARY" | ||
| - name: Upload successful acceptance summary | ||
| if: success() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: siteops-docker-acceptance-summary-${{ github.run_id }} | ||
| path: ${{ runner.temp }}/siteops-acceptance/acceptance-summary.txt | ||
| if-no-files-found: error | ||
| retention-days: 7 | ||
| - name: Upload failed acceptance evidence | ||
| if: failure() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: siteops-docker-acceptance-failure-${{ github.run_id }} | ||
| path: | | ||
| ${{ runner.temp }}/siteops-acceptance/acceptance.log | ||
| ${{ runner.temp }}/siteops-acceptance/acceptance-summary.txt | ||
| ${{ runner.temp }}/siteops-acceptance/cleanup-receipt.txt | ||
| if-no-files-found: warn | ||
| retention-days: 7 | ||