Caching on a machine executor

Is caching on the machine executor done as below:

      - restore_cache:
          keys:
            - make-382-{{ arch }}-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
            - make-382-{{ arch }}-{{ .Branch }}
      - run:
          name: Build and install make via script
          command: ./build/x86_64/linux_macos/installMake.sh
          timeout: 1m
      - save_cache:
          key: make-382-{{ arch }}-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
          paths:
            - /make-3.82/
            - /usr/bin/make
            - /usr/local/bin/make
            - /usr/share/man/man1/make.1.gz
            - /lib/

I tried doing this sometime back and got a lot of errors when trying to restore the cache on a new build - this could have to do with file permissions on the new instance.

Is there a way around this?

This portion effectively says to only cache/restore these files for the current commit. Try removing this last portion to allow your cache to apply to {{ arch }}-{{ .Branch }}, which scopes to this Arch type and this branch.

Thanks I have just applied it and will let you know what transpires from it.

When I mentioned about errors earlier if you take a look at https://circleci.com/gh/neomatrix369/awesome-graal/627 and https://circleci.com/gh/neomatrix369/awesome-graal/628 you will see what I mean.

I think the ones in https://circleci.com/gh/neomatrix369/awesome-graal/627 can be avoided by using unique names but we can still come across these unintentionally. For the ones in https://circleci.com/gh/neomatrix369/awesome-graal/628 I have had them in the past and it stopped me from using caches.

A side question, which folders are of importance when we install a linux package, are these sufficient:

    - "vendor/apt"
    - "vendor/apt/archives"

@KyleTryon any feedback for me on this issue?

It’s not clear if your post after this one gave the detail of your findings. Would you expand on how you acted on Kyle’s advice? :slight_smile:

If you look at this commit onwards - https://github.com/neomatrix369/awesome-graal/commit/0a73f25cc455300fb642f306fc532c1c4feb84d7, its what I applied after @KyleTryon’s advise.

And the results are here Caching on a machine executor (see post above starting with When I mentioned....).

Does this help to give a starting point?

Cheers
Mani