reproducible-containers / buildkit-cache-dance

Save `RUN --mount=type=cache` caches on GitHub Actions ( Forked from https://github.com/overmindtech/buildkit-cache-dance )
Apache License 2.0
98 stars 25 forks source link

Ensure scratch directory exists when calling extractCache #29

Closed Chagui- closed 1 month ago

Chagui- commented 2 months ago

When running the action for the first time and no cache exists, inject does not get called, so scratch dir is not created. Then extracting the cache fails because it tries to write to scratch/buildstamp but the scratch folder does not exist.

Workaround is to chance the scrath folder to some other folder that already exists:

  - name: inject cache into docker
    uses: reproducible-containers/buildkit-cache-dance@v3
    with:
      ...
      scratch-dir: folder_that_exists_in_the_repo

This PR ensures the directory exists even if the inject job is not called. Should fix #23

AkihiroSuda commented 2 months ago

Thanks, but CI is failing

Chagui- commented 2 months ago

yeah i forgot to build, so i did, then i was missing the signed off so i added it following the instructions (which added a new commit). But the the pipeline was mad because the last commit didn't contain the build.

I reverted and now everything should be contained in a single commit.

Chagui- commented 2 months ago

Not sure why its failing now

AkihiroSuda commented 2 months ago

Please try this https://github.com/reproducible-containers/buildkit-cache-dance/blob/5de31fc1534ed8789e63d41ea933c5df9944a261/.github/workflows/unit-tests.yml#L17-L26

Chagui- commented 2 months ago

I did try that but it was not updating anything in the dist folder. I added --no-cache and it seem to have worked.