Allow to use file checksum as cache key
Description
Provide a way to use project file checksum as a cache key. This will speed up pipeline execution time for many users.
Proposal
Add ability to specify key to CI YAML:
rspec:
cache:
key:
files: Gemfile # generate checksum based on SHA as the `cache:key` value
prefix: add-something
We would internally set cache:key
to "add-something-#{SHA256(File.read(Gemfile))"
.
Links / references
Documentation blurb
Overview
Currently Gitlab CI doesn't allow to run scripts or have ability to provide project commit checksum in cache key directive.
I have a java project that uses gradle as a build system. In this project all dependencies are defined in a separate file. I would like to recreate gradle cache only when this file has changed.
Other build systems will also can benefit from this approach if projects will put all dependencies in one file.
Use cases
Feature checklist
Make sure these are completed before closing the issue, with a link to the relevant commit.
-
Feature assurance -
Documentation -
Added to features.yml