Skip to content

Commit d8c1bca

Browse files
committed
WIP
1 parent 031ee1e commit d8c1bca

File tree

4 files changed

+12
-18
lines changed

4 files changed

+12
-18
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,9 @@ jobs:
6262

6363
- uses: actions/cache@v2
6464
with:
65-
path: './root-cache'
65+
path: './.action-docker-layer-caching-docker_images'
6666
key: aws-cli-docker-image-sha-${{ github.sha }}-root
67-
restore-keys: |
68-
aws-cli-docker-image-sha
69-
- run: ls ./root-cache
67+
- run: ls ./.action-docker-layer-caching-docker_images
7068

7169
test_restoring:
7270
runs-on: ubuntu-latest

main.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const main = async () => {
77

88
const layerCache = new LayerCache(repotag)
99
await layerCache.restore(key)
10+
await layerCache.cleanUp()
1011
}
1112

1213
main().catch(e => {

post.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ const main = async () => {
77

88
const layerCache = new LayerCache(repotag)
99
await layerCache.store(key)
10-
const layercache2 = new LayerCache(repotag)
11-
// layercache2.imagesDir = `docker_images_restore`
12-
await layercache2.restore(key)
1310
}
1411

1512
main().catch(e => {

src/LayerCache.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,11 @@ class LayerCache {
3030
async store(key: string) {
3131
this.originalKeyToStore = key
3232
await this.saveImageAsUnpacked()
33-
// await this.separateAllLayerCaches()
33+
await this.separateAllLayerCaches()
3434
// Todo: remove await
3535
const storeRoot = await this.storeRoot()
36-
// const storeLayers = this.storeLayers()
37-
// await Promise.all([storeRoot, storeLayers])
38-
await this.cleanUp()
36+
const storeLayers = this.storeLayers()
37+
await Promise.all([storeRoot, storeLayers])
3938
}
4039

4140
private async saveImageAsUnpacked() {
@@ -109,14 +108,13 @@ class LayerCache {
109108
return false
110109
}
111110

112-
// const hasRestoredAllLayers = await this.restoreLayers()
113-
// if (!hasRestoredAllLayers) {
114-
// core.info(`Some layer cache could not be found. aborting.`)
115-
// return false
116-
// }
117-
// await this.joinAllLayerCaches()
111+
const hasRestoredAllLayers = await this.restoreLayers()
112+
if (!hasRestoredAllLayers) {
113+
core.info(`Some layer cache could not be found. aborting.`)
114+
return false
115+
}
116+
await this.joinAllLayerCaches()
118117
await this.loadImageFromUnpacked()
119-
await this.cleanUp()
120118
return true
121119
}
122120

0 commit comments

Comments
 (0)