Skip to content

Commit 3868219

Browse files
authored
Update main.yml
1 parent f64d15c commit 3868219

File tree

1 file changed

+8
-46
lines changed

1 file changed

+8
-46
lines changed

.github/workflows/main.yml

Lines changed: 8 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -21,40 +21,24 @@ jobs:
2121
shell: pwsh
2222
run: |
2323
Set-MpPreference -DisableRealtimeMonitoring $true
24-
2524
- name: Restore BuildKit Cache
2625
uses: actions/cache/restore@v4
2726
id: restore-buildkit-cache
2827
with:
2928
path: |
30-
buildkit.tar
29+
buildkit
3130
key: buildkit-${{ runner.os }}-
3231
restore-keys: |
3332
buildkit-${{ runner.os }}-
34-
3533
- name: Restore Daemon Cache
3634
uses: actions/cache/restore@v4
3735
id: restore-droot-cache
3836
with:
3937
path: |
40-
droot.tar
38+
droot
4139
key: droot-${{ runner.os }}-
4240
restore-keys: |
4341
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-
5842
- name: Log in to Container Registry
5943
uses: docker/login-action@v3
6044
with:
@@ -67,23 +51,19 @@ jobs:
6751
run: |
6852
if (-Not (Test-Path "buildkit")) {
6953
Write-Host "📂 'buildkit' directory not found. Downloading and extracting daemons..."
70-
7154
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
7457
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
7760
} else {
7861
Write-Host "✅ 'buildkit' directory already exists. Skipping download."
7962
}
80-
8163
.\cni\setup-nat.ps1
82-
8364
New-Item -ItemType Directory -Path "buildkit/logs" -Force
8465
$Bin = "${{ github.workspace }}\buildkit\bin"
8566
echo "PATH=$Bin;$env:PATH" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
86-
8767
- name: Run daemons
8868
shell: pwsh
8969
run: |
@@ -108,11 +88,9 @@ jobs:
10888
Write-Error "❌ Timeout: $Command did not succeed!"
10989
exit 1
11090
}
111-
11291
$logs = "buildkit/logs"
11392
$cni = "${{ github.workspace }}\buildkit\cni"
11493
$droot = "${{ github.workspace }}\droot"
115-
11694
Start-Job -ScriptBlock {
11795
param($logs, $droot)
11896
Start-Process containerd.exe `
@@ -121,9 +99,7 @@ jobs:
12199
-RedirectStandardError "$logs/containerd_error.log" `
122100
-NoNewWindow -PassThru
123101
} -ArgumentList $logs, $droot
124-
125102
Wait-For "ctr --namespace buildkit image ls"
126-
127103
Start-Job -ScriptBlock {
128104
param($logs, $cni, $droot)
129105
Start-Process buildkitd.exe `
@@ -134,9 +110,7 @@ jobs:
134110
-RedirectStandardError "$logs/buildkitd_error.log" `
135111
-NoNewWindow -PassThru
136112
} -ArgumentList $logs, $cni, $droot
137-
138113
Wait-For "buildctl du"
139-
140114
- name: Build base image
141115
shell: cmd
142116
run: |
@@ -145,12 +119,10 @@ jobs:
145119
--export-cache=type=inline ^
146120
--import-cache=type=registry,ref=dr-private.devsh.eu/actions/cache/nano/base ^
147121
--opt target=buildtools
148-
149122
- name: Prune images
150123
shell: pwsh
151124
run: |
152125
buildctl prune
153-
154126
- name: Stop daemons
155127
shell: pwsh
156128
run: |
@@ -162,7 +134,6 @@ jobs:
162134
} else {
163135
Write-Host "⚠️ No background jobs found."
164136
}
165-
166137
Write-Host "🔴 Stopping containerd and buildkitd..."
167138
if (Get-Process -Name "containerd" -ErrorAction SilentlyContinue) {
168139
Stop-Process -Name "containerd" -Force
@@ -177,15 +148,6 @@ jobs:
177148
} else {
178149
Write-Host "⚠️ buildkitd is not running."
179150
}
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-
189151
#- name: Build app image
190152
# shell: cmd
191153
# run: |
@@ -200,13 +162,13 @@ jobs:
200162
uses: actions/cache/save@v4
201163
with:
202164
path: |
203-
buildkit.tar
165+
buildkit
204166
key: buildkit-${{ runner.os }}-
205167

206168
- name: Save Daemon Cache
207169
id: save-droot-cache
208170
uses: actions/cache/save@v4
209171
with:
210172
path: |
211-
droot.tar
173+
droot
212174
key: droot-${{ runner.os }}-

0 commit comments

Comments
 (0)