Skip to content

Commit 916e79e

Browse files
radicalCopilot
andcommitted
Consolidate Docker verification into a shared composite action
Replace ad-hoc `docker info` calls in the CI workflows with a single shared composite action at `.github/actions/verify-docker`. The action runs `docker info` as the gating check and always emits `docker version` and `docker buildx version` diagnostics, so the build log is useful even when the daemon is broken. `docker info`'s exit code is re-raised at the end so the step still fails on a missing or unreachable daemon. The action is a no-op on non-Linux runners, so callers in cross-OS matrices (run-tests.yml, reproduce-flaky-tests.yml) can drop their `if: runner.os == 'Linux'` guards. Migrate all five callers (build-cli-e2e-image, deployment-tests, reproduce-flaky-tests, run-tests, tests-daily-smoke) and add docs/ci/verify-docker.md. Co-authored-by: Copilot <[email protected]>
1 parent 8875e8f commit 916e79e

7 files changed

Lines changed: 33 additions & 13 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: 'Verify Docker'
2+
description: 'Verify that the runner Docker daemon is available and emit Docker/buildx version diagnostics. No-op on non-Linux runners.'
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: Verify Docker daemon and emit diagnostics
7+
# Aspire CI only relies on Docker on Linux runners; the macOS and Windows
8+
# GitHub-hosted runners don't have a working Docker daemon. Skip there so
9+
# callers don't need to repeat `if: runner.os == 'Linux'` at every call site.
10+
if: runner.os == 'Linux'
11+
shell: bash
12+
run: |
13+
# Run docker info first as the gating check, but never let it short-circuit
14+
# the diagnostics that follow — those are most useful when the daemon is
15+
# broken. Re-raise its exit code at the end so the step still fails.
16+
rc=0
17+
docker info || rc=$?
18+
docker version || echo "::warning::docker version failed with exit code $?"
19+
docker buildx version || echo "::warning::docker buildx version failed with exit code $?"
20+
exit $rc

.github/workflows/build-cli-e2e-image.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3939

4040
- name: Verify Docker is running
41-
run: docker info
41+
uses: ./.github/actions/verify-docker
4242

4343
- name: Export GitHub Actions cache runtime
4444
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1

.github/workflows/deployment-tests.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -245,11 +245,7 @@ jobs:
245245
echo "✅ Azure authentication successful"
246246
247247
- name: Verify Docker is running
248-
run: |
249-
echo "Verifying Docker daemon..."
250-
docker version
251-
docker info | head -20
252-
echo "✅ Docker is available"
248+
uses: ./.github/actions/verify-docker
253249

254250
- name: Run deployment test (${{ matrix.shortname }})
255251
id: run_tests

.github/workflows/reproduce-flaky-tests.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,8 @@ jobs:
177177
env:
178178
WSL_INTEROP: ""
179179

180-
- name: Verify Docker is running (Linux)
181-
if: runner.os == 'Linux'
182-
run: docker info
180+
- name: Verify Docker is running
181+
uses: ./.github/actions/verify-docker
183182

184183
- name: Download prebuilt CLI E2E Docker image
185184
if: ${{ needs.setup.outputs.is_cli_e2e == 'true' && runner.os == 'Linux' }}

.github/workflows/run-tests.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,7 @@ jobs:
114114
WSL_INTEROP: ""
115115

116116
- name: Verify Docker is running
117-
# nested docker containers not supported on windows
118-
if: runner.os == 'Linux'
119-
run: docker info
117+
uses: ./.github/actions/verify-docker
120118

121119
- name: Download prebuilt CLI E2E Docker image
122120
if: ${{ fromJson(inputs.properties).requiresCliArchive == true && runner.os == 'Linux' }}

.github/workflows/tests-daily-smoke.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
run: ./restore.sh
5454

5555
- name: Verify Docker is running
56-
run: docker info
56+
uses: ./.github/actions/verify-docker
5757

5858
- name: Download prebuilt CLI E2E Docker image
5959
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1

docs/ci/verify-docker.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Verify Docker action
2+
3+
Workflows that need Docker should use `.github/actions/verify-docker` instead of running `docker info` directly. The action checks that the Docker daemon is reachable with `docker info` and always emits `docker version` and `docker buildx version` so logs are useful when the daemon is broken.
4+
5+
The action is a no-op on non-Linux runners, so callers can use it unconditionally even from cross-OS jobs — there's no need to gate the step with `if: runner.os == 'Linux'`.
6+
7+
Extend this action when CI needs a stronger Docker runner contract.

0 commit comments

Comments
 (0)