Yaml Anchor

I’m trying to use yaml anchors in order to override cache policy to specific jobs.

I’m trying to replicate what is documented here.

My pipeline:

image: python:3.9-slim

stages:
 - build

default:
 cache: &venv_cache
   - key:
       files:
         - Pipfile.lock
     paths:
       - .cache/
       - .venv/
     policy: pull

build:
 stage: build
 cache:
   <<: *venv_cache
   policy: pull-push
 before_script:
   - pip install pipenv
 script:
   - pipenv install --dev --deploy

The error:

This GitLab CI configuration is invalid: jobs:build:cache config contains unknown keys: <<.

Can someone helps me to find out what I am doing wrong ?

Your default.cache definition is invalid, there should not be - before the key:. Check the example again :slight_smile:

I swear I’ve checked several times :sweat_smile:

thank you really for directing me to the solution