@@ -241,7 +241,7 @@ keepBytes = ${cacheSizeBytes}
241
241
console . log ( `BuildKit exited with error: ${ error } ` )
242
242
}
243
243
244
- await shutdown ( rootDir , task )
244
+ await shutdown ( rootDir , task , headers )
245
245
} )
246
246
247
247
try {
@@ -255,15 +255,15 @@ keepBytes = ${cacheSizeBytes}
255
255
}
256
256
257
257
// If we have successfully stopped buildkit, we can shutdown.
258
- await shutdown ( rootDir , task )
258
+ await shutdown ( rootDir , task , headers )
259
259
} catch ( error ) {
260
260
throw error
261
261
} finally {
262
262
controller . abort ( )
263
263
}
264
264
}
265
265
266
- async function shutdown ( rootDir : string , task : RegisterMachineResponse_BuildKitTask ) {
266
+ async function shutdown ( rootDir : string , task : RegisterMachineResponse_BuildKitTask , headers : HeadersInit ) {
267
267
// Remove estargz cache because we will rely on the buildkit layer cache instead.
268
268
await execa ( 'rm' , [ '-rf' , `${ rootDir } /runc-stargz/snapshots/stargz` ] , { stdio : 'inherit' } ) . catch ( ( err ) => {
269
269
console . error ( err )
@@ -290,10 +290,10 @@ async function shutdown(rootDir: string, task: RegisterMachineResponse_BuildKitT
290
290
}
291
291
292
292
// Report shutdown to the API to indicate that the machine is no longer available.
293
- await reportShutdown ( )
293
+ await reportShutdown ( headers )
294
294
}
295
295
296
- async function reportShutdown ( ) {
296
+ async function reportShutdown ( headers : HeadersInit ) {
297
297
const signal = AbortSignal . timeout ( 5000 )
298
- return await client . shutdown ( { } , { signal} )
298
+ return await client . shutdown ( { } , { headers , signal} )
299
299
}
0 commit comments