Skip to content

Commit bc7009f

Browse files
committed
mkdir restoreSingleLayerBy
1 parent d61cc58 commit bc7009f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/LayerCache.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,9 @@ class LayerCache {
178178
}
179179

180180
private async restoreLayers(): Promise<boolean> {
181-
const pool = new PromisePool(this.concurrency)
182181

182+
183+
const pool = new PromisePool(this.concurrency)
183184
const tasks = (await this.getLayerIds()).map(
184185
layerId => pool.open(() => this.restoreSingleLayerBy(layerId))
185186
)
@@ -204,9 +205,11 @@ class LayerCache {
204205
private async restoreSingleLayerBy(id: string): Promise<string> {
205206
const path = this.genSingleLayerStorePath(id)
206207
const key = await this.recoverSingleLayerKey(id)
208+
const dir = path.replace(/[^/\\]+$/, ``)
207209

208-
core.debug(JSON.stringify({ log: `restoreSingleLayerBy`, id, path, key }))
210+
core.debug(JSON.stringify({ log: `restoreSingleLayerBy`, id, path, dir, key }))
209211

212+
await fs.mkdir(dir, { recursive: true })
210213
const result = await cache.restoreCache([path], key)
211214

212215
if (result == null) {
@@ -247,7 +250,7 @@ class LayerCache {
247250
}
248251

249252
genSingleLayerStorePath(id: string) {
250-
return `${this.getLayerCachesDir()}/${id}/layer.tar`
253+
return path.resolve(`${this.getLayerCachesDir()}/${id}/layer.tar`)
251254
}
252255

253256
async generateRootHashFromManifest(): Promise<string> {

0 commit comments

Comments
 (0)