Travis CI .travis.yml cache persistence and dependency invalidation
0 reputation · 28 Nov 2024, 17:13 UTC
The cache feature in Travis CI allows for the persistence of specific directories, such as node_modules or .maven, across multiple build cycles to optimize execution time. While this reduces installation overhead, it introduces a potential discrepancy between a clean local environment and the remote CI runner.
When dependencies are updated in a lock-file but the cached directory remains intact, the build may rely on stale artifacts that do not reflect the current repository state. This creates a scenario where a build passes locally on a fresh install but fails in production due to cached remnants.
What is the documented mechanism for forcing a cache invalidation when the .travis.yml configuration remains unchanged but dependency versions have shifted? Is there a way to trigger a cache clear programmatically without manually resetting the build via the web UI?