Skip to content

Commit 81d5923

Browse files
frostebiteclaude
andauthored
fix(ci): fix Windows image digest extraction and Docker daemon readiness (#276)
* fix(ci): resolve Windows Docker build pipeline failures Apply five targeted fixes across all Windows workflow files: 1. Add "Wait for Docker daemon" step before any docker commands to handle cases where the Docker service is not yet ready on Windows runners, preventing spurious login/pull failures. 2. Fix digest extraction to use RepoDigests instead of the incorrect Config.Image path, which returns the base image hash rather than the actual pushed image digest. 3. Handle "image already exists" gracefully in the retry workflow by extracting the existing digest and reporting success instead of failing the entire workflow. 4. Scope "Report failure" conditions to reference specific build step outcomes rather than using broad failure()/cancelled() checks that would misfire when unrelated steps (like report-publication) fail. 5. Fix missing $ prefixes in hub workflow's workflow_dispatch branch where github.event.inputs expressions were not being evaluated. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor: trim PR to root cause fixes only (digest + daemon readiness) Remove fixes 3-5 to keep the PR focused on the two confirmed root causes: - Fix 1: Docker daemon readiness check before build (all 5 workflows) - Fix 2: Digest extraction via RepoDigests[0] instead of Config.Image (all 5 workflows) Reverted changes: - Fix 3: retry workflow "already exists" skip-build logic - Fix 4: Report failure condition scoping (restored failure()||cancelled()) - Fix 5: Missing $ prefixes in hub workflow (debatable whether broken) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1a94952 commit 81d5923

5 files changed

Lines changed: 125 additions & 5 deletions

.github/workflows/new-windows-base-image-requested.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,29 @@ jobs:
8686
#############
8787
# Setup #
8888
#############
89+
- name: Wait for Docker daemon
90+
shell: powershell
91+
run: |
92+
$maxRetries = 10
93+
$retryDelay = 6
94+
for ($i = 0; $i -lt $maxRetries; $i++) {
95+
$svc = Get-Service docker -ErrorAction SilentlyContinue
96+
if ($svc -and $svc.Status -eq 'Running') {
97+
docker version 2>$null
98+
if ($LASTEXITCODE -eq 0) {
99+
Write-Host "Docker is ready."
100+
exit 0
101+
}
102+
}
103+
if ($svc -and $svc.Status -eq 'Stopped') {
104+
Write-Host "Docker service stopped, attempting to start..."
105+
Start-Service docker -ErrorAction SilentlyContinue
106+
}
107+
Write-Host "Waiting for Docker daemon (attempt $($i+1)/$maxRetries)..."
108+
Start-Sleep -Seconds $retryDelay
109+
}
110+
Write-Error "Docker daemon did not start within $($maxRetries * $retryDelay) seconds"
111+
exit 1
89112
- name: Login to DockerHub
90113
env:
91114
username: ${{ secrets.DOCKERHUB_USERNAME }}
@@ -131,7 +154,8 @@ jobs:
131154
132155
$MetaData = docker inspect unityci/base:windows-${{ steps.buildParameters.outputs.repoVersionFull }}
133156
$ImageDetails = $MetaData | ConvertFrom-Json
134-
$Digest = $ImageDetails.Config.Image
157+
$RepoDigest = $ImageDetails[0].RepoDigests[0]
158+
$Digest = ($RepoDigest -split '@')[1]
135159
echo "digest=$Digest" >> $Env:GITHUB_OUTPUT
136160
echo "metadata=$MetaData" >> $Env:GITHUB_OUTPUT
137161

.github/workflows/new-windows-hub-image-requested.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,29 @@ jobs:
8686
#############
8787
# Setup #
8888
#############
89+
- name: Wait for Docker daemon
90+
shell: powershell
91+
run: |
92+
$maxRetries = 10
93+
$retryDelay = 6
94+
for ($i = 0; $i -lt $maxRetries; $i++) {
95+
$svc = Get-Service docker -ErrorAction SilentlyContinue
96+
if ($svc -and $svc.Status -eq 'Running') {
97+
docker version 2>$null
98+
if ($LASTEXITCODE -eq 0) {
99+
Write-Host "Docker is ready."
100+
exit 0
101+
}
102+
}
103+
if ($svc -and $svc.Status -eq 'Stopped') {
104+
Write-Host "Docker service stopped, attempting to start..."
105+
Start-Service docker -ErrorAction SilentlyContinue
106+
}
107+
Write-Host "Waiting for Docker daemon (attempt $($i+1)/$maxRetries)..."
108+
Start-Sleep -Seconds $retryDelay
109+
}
110+
Write-Error "Docker daemon did not start within $($maxRetries * $retryDelay) seconds"
111+
exit 1
89112
- name: Login to DockerHub
90113
env:
91114
username: ${{ secrets.DOCKERHUB_USERNAME }}
@@ -137,7 +160,8 @@ jobs:
137160
138161
$MetaData = docker inspect unityci/hub:windows-${{ steps.buildParameters.outputs.repoVersionFull }}
139162
$ImageDetails = $MetaData | ConvertFrom-Json
140-
$Digest = $ImageDetails.Config.Image
163+
$RepoDigest = $ImageDetails[0].RepoDigests[0]
164+
$Digest = ($RepoDigest -split '@')[1]
141165
echo "digest=$Digest" >> $Env:GITHUB_OUTPUT
142166
echo "metadata=$MetaData" >> $Env:GITHUB_OUTPUT
143167

.github/workflows/new-windows-legacy-editor-image-requested.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,29 @@ jobs:
104104
#############
105105
# Setup #
106106
#############
107+
- name: Wait for Docker daemon
108+
shell: powershell
109+
run: |
110+
$maxRetries = 10
111+
$retryDelay = 6
112+
for ($i = 0; $i -lt $maxRetries; $i++) {
113+
$svc = Get-Service docker -ErrorAction SilentlyContinue
114+
if ($svc -and $svc.Status -eq 'Running') {
115+
docker version 2>$null
116+
if ($LASTEXITCODE -eq 0) {
117+
Write-Host "Docker is ready."
118+
exit 0
119+
}
120+
}
121+
if ($svc -and $svc.Status -eq 'Stopped') {
122+
Write-Host "Docker service stopped, attempting to start..."
123+
Start-Service docker -ErrorAction SilentlyContinue
124+
}
125+
Write-Host "Waiting for Docker daemon (attempt $($i+1)/$maxRetries)..."
126+
Start-Sleep -Seconds $retryDelay
127+
}
128+
Write-Error "Docker daemon did not start within $($maxRetries * $retryDelay) seconds"
129+
exit 1
107130
- name: Login to DockerHub
108131
env:
109132
username: ${{ secrets.DOCKERHUB_USERNAME }}
@@ -204,7 +227,8 @@ jobs:
204227
run: |
205228
$MetaData = docker inspect unityci/editor:windows-${{ steps.buildParameters.outputs.editorVersion }}-${{ matrix.targetPlatform }}-${{ steps.buildParameters.outputs.repoVersionFull }}
206229
$ImageDetails = $MetaData | ConvertFrom-Json
207-
$Digest = $ImageDetails.Config.Image
230+
$RepoDigest = $ImageDetails[0].RepoDigests[0]
231+
$Digest = ($RepoDigest -split '@')[1]
208232
echo "digest=$Digest" >> $Env:GITHUB_OUTPUT
209233
echo "metadata=$MetaData" >> $Env:GITHUB_OUTPUT
210234

.github/workflows/new-windows-post-2019-2-editor-image-requested.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,29 @@ jobs:
112112
#############
113113
# Setup #
114114
#############
115+
- name: Wait for Docker daemon
116+
shell: powershell
117+
run: |
118+
$maxRetries = 10
119+
$retryDelay = 6
120+
for ($i = 0; $i -lt $maxRetries; $i++) {
121+
$svc = Get-Service docker -ErrorAction SilentlyContinue
122+
if ($svc -and $svc.Status -eq 'Running') {
123+
docker version 2>$null
124+
if ($LASTEXITCODE -eq 0) {
125+
Write-Host "Docker is ready."
126+
exit 0
127+
}
128+
}
129+
if ($svc -and $svc.Status -eq 'Stopped') {
130+
Write-Host "Docker service stopped, attempting to start..."
131+
Start-Service docker -ErrorAction SilentlyContinue
132+
}
133+
Write-Host "Waiting for Docker daemon (attempt $($i+1)/$maxRetries)..."
134+
Start-Sleep -Seconds $retryDelay
135+
}
136+
Write-Error "Docker daemon did not start within $($maxRetries * $retryDelay) seconds"
137+
exit 1
115138
- name: Login to DockerHub
116139
env:
117140
username: ${{ secrets.DOCKERHUB_USERNAME }}
@@ -211,7 +234,8 @@ jobs:
211234
run: |
212235
$MetaData = docker inspect unityci/editor:windows-${{ steps.buildParameters.outputs.editorVersion }}-${{ matrix.targetPlatform }}-${{ steps.buildParameters.outputs.repoVersionFull }}
213236
$ImageDetails = $MetaData | ConvertFrom-Json
214-
$Digest = $ImageDetails.Config.Image
237+
$RepoDigest = $ImageDetails[0].RepoDigests[0]
238+
$Digest = ($RepoDigest -split '@')[1]
215239
echo "digest=$Digest" >> $Env:GITHUB_OUTPUT
216240
echo "metadata=$MetaData" >> $Env:GITHUB_OUTPUT
217241

.github/workflows/retry-windows-editor-image-requested.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,29 @@ jobs:
4545
#############
4646
# Setup #
4747
#############
48+
- name: Wait for Docker daemon
49+
shell: powershell
50+
run: |
51+
$maxRetries = 10
52+
$retryDelay = 6
53+
for ($i = 0; $i -lt $maxRetries; $i++) {
54+
$svc = Get-Service docker -ErrorAction SilentlyContinue
55+
if ($svc -and $svc.Status -eq 'Running') {
56+
docker version 2>$null
57+
if ($LASTEXITCODE -eq 0) {
58+
Write-Host "Docker is ready."
59+
exit 0
60+
}
61+
}
62+
if ($svc -and $svc.Status -eq 'Stopped') {
63+
Write-Host "Docker service stopped, attempting to start..."
64+
Start-Service docker -ErrorAction SilentlyContinue
65+
}
66+
Write-Host "Waiting for Docker daemon (attempt $($i+1)/$maxRetries)..."
67+
Start-Sleep -Seconds $retryDelay
68+
}
69+
Write-Error "Docker daemon did not start within $($maxRetries * $retryDelay) seconds"
70+
exit 1
4871
- name: Login to DockerHub
4972
env:
5073
username: ${{ secrets.DOCKERHUB_USERNAME }}
@@ -143,7 +166,8 @@ jobs:
143166
run: |
144167
$MetaData = docker inspect unityci/editor:windows-${{ github.event.client_payload.editorVersion }}-${{ github.event.client_payload.targetPlatform }}-${{ github.event.client_payload.repoVersionFull }}
145168
$ImageDetails = $MetaData | ConvertFrom-Json
146-
$Digest = $ImageDetails.Config.Image
169+
$RepoDigest = $ImageDetails[0].RepoDigests[0]
170+
$Digest = ($RepoDigest -split '@')[1]
147171
echo "digest=$Digest" >> $Env:GITHUB_OUTPUT
148172
echo "metadata=$MetaData" >> $Env:GITHUB_OUTPUT
149173

0 commit comments

Comments
 (0)