According to the documentation, "Subsequent jobs in the same pipeline can use the cache, if the dependencies are identical." I have the following in my gitlab-ci.yml file:
slowcompile:
stage: build
needs: [verdate]
dependencies: [verdate]
cache:
key: "$EXTERNALS_VERSION"
paths: [ externals/*, externals_st/*, fast*/*, slow*/* ]
policy: pull
script:
- ./buildstep.pl slowcompile
artifacts:
when: always
paths:
- log*/*
- slow*/*
slow:
stage: build
needs: [verdate, slowcompile]
dependencies: [verdate]
cache:
key: "$EXTERNALS_VERSION"
paths: [ externals/*, externals_st/*, fast*/*, slow*/* ]
policy: pull
script:
- measure ./buildstep.pl slowfilein
artifacts:
when: always
paths:
- log*/*
- slow*/gs/*
- slow*/GemStone64Bit*-slow.zip
The first job shows the following output when it runs:
Restoring cache 02:31
Checking cache for externals-2025-09-09-non_protected...
No URL provided, cache will not be downloaded from shared cache server. Instead a local version of cache will be extracted.
Successfully extracted cache
The second job shows the following output when it runs:
Restoring cache 00:01
Checking cache for externals-2025-09-09-non_protected...
No URL provided, cache will not be downloaded from shared cache server. Instead a local version of cache will be extracted.
WARNING: Cache file does not exist
Failed to extract cache
Since they both have the same cache definition including a "policy: pull", and since nothing else is running, I don't understand why the cache fails to exist for the second job. When the pipeline is rerun, the first job finds the cache (without recreating it), so I know it is still present.