Hello,
I have a .gitlab-ci.yml
file that looks similar to the following:
cache:
key: ${CI_JOB_IMAGE}
paths:
- _build
- deps
default:
before_script:
- mix local.hex --force
- mix local.rebar --force
- mix deps.get
.compile_template: &compile_definition
stage: build
script:
- mix compile --warnings-as-errors
.test_template: &test_definition
stage: test
script:
- mix test --cover
compile:1.10:
image: elixir:1.10-alpine
<<: *compile_definition
compile:1.9:
image: elixir:1.9-alpine
<<: *compile_definition
test:1.10:
image: elixir:1.10-alpine
<<: *test_definition
test:1.9:
image: elixir:1.9-alpine
<<: *test_definition
Despite using $CI_JOB_IMAGE
as the cache key, they are all pulling from the same cache (labeled -4
) and thus failing. Am I using this environment variable correctly? I’ve checked the table of predefined variables there are no others that mention images.
My goal is to have each cache tied to what docker image is being used (thus the version of elixir) to prevent compiling errors.
Thank you!