What to do if Gitlab cache doesn’t work?
That seems to be a peculiarity of the Gitlab because of its nature.
The thing is that local cache is really local to the particular runner, so if you use shared runners each next task will be assigned most probably to the different runner(node). In this way you will not have the same cache unless you’re using distributed cache stored on S3.
The easiest way to tackle this is to use a tag for each of your stage. Thus it’s going to stick to particular runner.