Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
satackey committed Jun 14, 2020
1 parent 031ee1e commit d8c1bca
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 18 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const main = async () => {

const layerCache = new LayerCache(repotag)
await layerCache.restore(key)
await layerCache.cleanUp()
}

main().catch(e => {
Expand Down
3 changes: 0 additions & 3 deletions post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
20 changes: 9 additions & 11 deletions src/LayerCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit d8c1bca

Please sign in to comment.