firecow / gitlab-ci-local

Tired of pushing to test your .gitlab-ci.yml?
MIT License
2.21k stars 125 forks source link

Make cache policy support variables #1091

Closed ilim-ablyaev closed 7 months ago

ilim-ablyaev commented 7 months ago

In GitLab CI/CD, version 16.5.1 introduced the capability to control a job's cache policy using variables (https://docs.gitlab.com/ee/ci/caching/#use-a-variable-to-control-a-jobs-cache-policy). However, this functionality is missing in gitlab-ci-local.

amenella commented 7 months ago

Hi, just ran into this problem too (nice coincidence :sweat_smile: )

The actual behavior by gitlab-ci-local is to refuse to run the job with following error message:

my_job_name cache[0].policy is not 'pull', 'push' or 'pull-push'

however the varibale is properly defined on the job:

my_job_name:
  stage: some_stage
  variables:
    CACHE_POLICY: pull-push
  cache:
    - key: my_cache_key
      paths:
        - some/path/to/cache
      policy: $CACHE_POLICY

hope this helps

PS: thanks a lot for gitlab-ci-local, this is a really helpful tool :pray:

ilim-ablyaev commented 7 months ago

Hi, @amenella I've made PR with fix) let's hope that it will be merged soon!) #1092