@@ -21,40 +21,24 @@ jobs:
21
21
shell : pwsh
22
22
run : |
23
23
Set-MpPreference -DisableRealtimeMonitoring $true
24
-
25
24
- name : Restore BuildKit Cache
26
25
uses : actions/cache/restore@v4
27
26
id : restore-buildkit-cache
28
27
with :
29
28
path : |
30
- buildkit.tar
29
+ buildkit
31
30
key : buildkit-${{ runner.os }}-
32
31
restore-keys : |
33
32
buildkit-${{ runner.os }}-
34
-
35
33
- name : Restore Daemon Cache
36
34
uses : actions/cache/restore@v4
37
35
id : restore-droot-cache
38
36
with :
39
37
path : |
40
- droot.tar
38
+ droot
41
39
key : droot-${{ runner.os }}-
42
40
restore-keys : |
43
41
droot-${{ runner.os }}-
44
-
45
- - name : Unpack cache artifacts
46
- shell : pwsh
47
- run : |
48
- if ((Test-Path "buildkit.tar.zst")) {
49
- tar -xvf buildkit.tar
50
- Write-Host "✅ unpacked buildkit!"
51
- }
52
-
53
- if ((Test-Path "droot.tar.zst")) {
54
- tar -xvf droot.tar
55
- Write-Host "✅ unpacked daemons root!"
56
- }
57
-
58
42
- name : Log in to Container Registry
59
43
uses : docker/login-action@v3
60
44
with :
@@ -67,23 +51,19 @@ jobs:
67
51
run : |
68
52
if (-Not (Test-Path "buildkit")) {
69
53
Write-Host "📂 'buildkit' directory not found. Downloading and extracting daemons..."
70
-
71
54
New-Item -ItemType Directory -Path "buildkit" -Force
72
- Invoke-WebRequest -Uri "https://github.com/moby/buildkit/releases/download/v0.20.1/buildkit-v0.20.1.windows-amd64.tar.gz" -OutFile "output .tar.gz"
73
- tar -xf output .tar.gz -C buildkit
55
+ Invoke-WebRequest -Uri "https://github.com/moby/buildkit/releases/download/v0.20.1/buildkit-v0.20.1.windows-amd64.tar.gz" -OutFile "buildkit .tar.gz"
56
+ tar -xf buildkit .tar.gz -C buildkit
74
57
75
- Invoke-WebRequest -Uri "https://github.com/containerd/containerd/releases/download/v2.0.4/containerd-2.0.4-windows-amd64.tar.gz" -OutFile "output .tar.gz"
76
- tar -xf output .tar.gz -C buildkit
58
+ Invoke-WebRequest -Uri "https://github.com/containerd/containerd/releases/download/v2.0.4/containerd-2.0.4-windows-amd64.tar.gz" -OutFile "containerd .tar.gz"
59
+ tar -xf containerd .tar.gz -C buildkit
77
60
} else {
78
61
Write-Host "✅ 'buildkit' directory already exists. Skipping download."
79
62
}
80
-
81
63
.\cni\setup-nat.ps1
82
-
83
64
New-Item -ItemType Directory -Path "buildkit/logs" -Force
84
65
$Bin = "${{ github.workspace }}\buildkit\bin"
85
66
echo "PATH=$Bin;$env:PATH" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
86
-
87
67
- name : Run daemons
88
68
shell : pwsh
89
69
run : |
@@ -108,11 +88,9 @@ jobs:
108
88
Write-Error "❌ Timeout: $Command did not succeed!"
109
89
exit 1
110
90
}
111
-
112
91
$logs = "buildkit/logs"
113
92
$cni = "${{ github.workspace }}\buildkit\cni"
114
93
$droot = "${{ github.workspace }}\droot"
115
-
116
94
Start-Job -ScriptBlock {
117
95
param($logs, $droot)
118
96
Start-Process containerd.exe `
121
99
-RedirectStandardError "$logs/containerd_error.log" `
122
100
-NoNewWindow -PassThru
123
101
} -ArgumentList $logs, $droot
124
-
125
102
Wait-For "ctr --namespace buildkit image ls"
126
-
127
103
Start-Job -ScriptBlock {
128
104
param($logs, $cni, $droot)
129
105
Start-Process buildkitd.exe `
@@ -134,9 +110,7 @@ jobs:
134
110
-RedirectStandardError "$logs/buildkitd_error.log" `
135
111
-NoNewWindow -PassThru
136
112
} -ArgumentList $logs, $cni, $droot
137
-
138
113
Wait-For "buildctl du"
139
-
140
114
- name : Build base image
141
115
shell : cmd
142
116
run : |
@@ -145,12 +119,10 @@ jobs:
145
119
--export-cache=type=inline ^
146
120
--import-cache=type=registry,ref=dr-private.devsh.eu/actions/cache/nano/base ^
147
121
--opt target=buildtools
148
-
149
122
- name : Prune images
150
123
shell : pwsh
151
124
run : |
152
125
buildctl prune
153
-
154
126
- name : Stop daemons
155
127
shell : pwsh
156
128
run : |
@@ -162,7 +134,6 @@ jobs:
162
134
} else {
163
135
Write-Host "⚠️ No background jobs found."
164
136
}
165
-
166
137
Write-Host "🔴 Stopping containerd and buildkitd..."
167
138
if (Get-Process -Name "containerd" -ErrorAction SilentlyContinue) {
168
139
Stop-Process -Name "containerd" -Force
@@ -177,15 +148,6 @@ jobs:
177
148
} else {
178
149
Write-Host "⚠️ buildkitd is not running."
179
150
}
180
-
181
- - name : Pack cache
182
- shell : pwsh
183
- run : |
184
- tar -cvf buildkit.tar buildkit
185
- Write-Host "✅ packed buildkit!"
186
- tar -cvf droot.tar droot
187
- Write-Host "✅ packed daemons root!"
188
-
189
151
# - name: Build app image
190
152
# shell: cmd
191
153
# run: |
@@ -200,13 +162,13 @@ jobs:
200
162
uses : actions/cache/save@v4
201
163
with :
202
164
path : |
203
- buildkit.tar
165
+ buildkit
204
166
key : buildkit-${{ runner.os }}-
205
167
206
168
- name : Save Daemon Cache
207
169
id : save-droot-cache
208
170
uses : actions/cache/save@v4
209
171
with :
210
172
path : |
211
- droot.tar
173
+ droot
212
174
key : droot-${{ runner.os }}-
0 commit comments