CI: turbo cache between Gitlab jobs #8053
Unanswered
thomasneger
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
Hi! I have been trying to setup my Gitlab CI to to properly cache and reuse the turbo cache in between jobs.
I have split my CI workflow into 2 stages:
test
stage - runs only when a dev pushes a new branch. It will check typescript, run the tests and eslintbuild
stage - runs after merge on main branchThis setup has worked well for my team, as we use it in combination of GitLab fast-forward merge method, so that developers have to pass the typescript build, tests and eslint against the latest main before merging.
Here is a reduced version of my
.gitlab-ci.yml
file:I think that with this setup, the
build
stage will benefit from the previously cached turbo run ✅.However, the
test
stage will never be able to use the fallback keycache-$CI_DEFAULT_BRANCH
❌ as that job never runs on main (by design).So far, the only solutions I have found would be to either let the
test
job run onmain
, or merge bothbuild
andtest
into a single job that would run on every branch. But that defeats the entire purpose of the original optimization.Opinions on how I could fix that?
Thank you very much for the support.
Additional information
No response
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions