Automate cache invalidation when patches/ directory changes in GitLab Rails codebase
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Implement a process to automatically invalidate the runner cache or update the cache key whenever there's a change in the patches/ directory to prevent similar issues.
The Omnibus pipeline works the following way:
- Install Node modules using
yarn install - Apply patches to individual modules stored in the
patches/directory of the GitLab Rails codebase - Cache the resulting
node_modules/directory to the Runner cache
As long as the content of the patches/ directory does not change, this is OK: The patches in this directory will be detected as already applied and there will be no failure.
Once the content of the patches/ directory changes though, the patch application will fail blocking the Omnibus pipeline.
The NPM module that we use to apply the patches indicates that including the content of the patches/ directory in the cache key is a requirement:
If you cache node_modules rather than running yarn install every time, make sure that the patches dir is included in your cache key somehow. Otherwise if you update a patch then the change may not be reflected on subsequent CI runs.
-- https://github.com/ds300/patch-package?tab=readme-ov-file#docker-and-ci
This ticket was created from INC-2217 and was automatically exported by incident.io