From d8c1bcad82079c68bc8191603325fddbfecdb174 Mon Sep 17 00:00:00 2001 From: satackey <21271711+satackey@users.noreply.github.com> Date: Sun, 14 Jun 2020 18:18:41 +0900 Subject: [PATCH] WIP --- .github/workflows/release.yml | 6 ++---- main.ts | 1 + post.ts | 3 --- src/LayerCache.ts | 20 +++++++++----------- 4 files changed, 12 insertions(+), 18 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 360a7ad6..6ee9d074 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -62,11 +62,9 @@ jobs: - uses: actions/cache@v2 with: - path: './root-cache' + path: './.action-docker-layer-caching-docker_images' key: aws-cli-docker-image-sha-${{ github.sha }}-root - restore-keys: | - aws-cli-docker-image-sha - - run: ls ./root-cache + - run: ls ./.action-docker-layer-caching-docker_images test_restoring: runs-on: ubuntu-latest diff --git a/main.ts b/main.ts index 8c6f5a2c..da1a723b 100644 --- a/main.ts +++ b/main.ts @@ -7,6 +7,7 @@ const main = async () => { const layerCache = new LayerCache(repotag) await layerCache.restore(key) + await layerCache.cleanUp() } main().catch(e => { diff --git a/post.ts b/post.ts index a5f358ab..7df87ed9 100644 --- a/post.ts +++ b/post.ts @@ -7,9 +7,6 @@ const main = async () => { const layerCache = new LayerCache(repotag) await layerCache.store(key) - const layercache2 = new LayerCache(repotag) - // layercache2.imagesDir = `docker_images_restore` - await layercache2.restore(key) } main().catch(e => { diff --git a/src/LayerCache.ts b/src/LayerCache.ts index fe9b0ed0..4f929397 100644 --- a/src/LayerCache.ts +++ b/src/LayerCache.ts @@ -30,12 +30,11 @@ class LayerCache { async store(key: string) { this.originalKeyToStore = key await this.saveImageAsUnpacked() - // await this.separateAllLayerCaches() + await this.separateAllLayerCaches() // Todo: remove await const storeRoot = await this.storeRoot() - // const storeLayers = this.storeLayers() - // await Promise.all([storeRoot, storeLayers]) - await this.cleanUp() + const storeLayers = this.storeLayers() + await Promise.all([storeRoot, storeLayers]) } private async saveImageAsUnpacked() { @@ -109,14 +108,13 @@ class LayerCache { return false } - // const hasRestoredAllLayers = await this.restoreLayers() - // if (!hasRestoredAllLayers) { - // core.info(`Some layer cache could not be found. aborting.`) - // return false - // } - // await this.joinAllLayerCaches() + const hasRestoredAllLayers = await this.restoreLayers() + if (!hasRestoredAllLayers) { + core.info(`Some layer cache could not be found. aborting.`) + return false + } + await this.joinAllLayerCaches() await this.loadImageFromUnpacked() - await this.cleanUp() return true }