Cache with environement variable works for save_cache but not restore_cache

From this example:
https://app.circleci.com/pipelines/github/tlaurion/heads/232/workflows/75df14b1-0a72-4622-8cc3-3a1ae2539557/jobs/252

in .circleci/config.yml:

- restore_cache:
          key: heads-{{ .Environment.CIRCLE_USERNAME }}-{{ .Environment.CACHE_VERSION }}


- save_cache:
          key: heads-{{ .Environment.CIRCLE_USERNAME }}{{ .Environment.CACHE_VERSION }}
          paths:
            - packages
            - crossgcc
            - build

Results:

restore_cache:

No cache is found for key: heads-tlaurion-2

save_cache:

Skipping cache generation, cache already exists for key: heads-tlaurion2
Found one created at 2020-06-08 04:02:10 +0000 UTC

I would expect restore_cache to restore it byt get on next run:
No cache is found for key: heads-tlaurion-2

Seems like my save_cache and restore_cache keys were different.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.