Restore cache first, then artifacts
We hit into an issue that sometimes
yarn check would fail due to dependencies didn't match. Retry a few times might fix it, might not. Eventually we figured that it's because we're both using artifacts and cache for node modules, so one could overwrite the other.
rake karma: cache: paths: - vendor/ruby - node_modules
There's a fix to remove cache, and fully rely on artifacts in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/10781
rake karma: cache: paths: - vendor/ruby
However, we could still reproduce the issue, because we have old branches, old caches, which could still sneak in, even if the new job doesn't have the path, because we don't just extract the paths from the cache, but everything.
We could possibly fix this by only restore/extract the files from the defined paths, but that could introduce the other issues we might not know right now.
A simpler fix would be that we always restore cache first, then artifacts, so that we overwrite cache with artifacts, which could at least fix our problems right now.
Of course, changing the cache key could be the other way to fix it, effectively immediately. But I think it's still reasonable that we restore cache first then artifacts, because artifacts should be much more important and they should not be overwritten at all.