Skip to content

Allow to use file checksum in cache key

Description

Provide a way to use project file checksum as a cache key.

Proposal

Add function SHA1(file_name) in cache key directive to use provided file checksum as a key.

Links / references

Documentation blurb

Overview

Currently Gitlab CI doesn't allow to run scripts or have ability to provide project file 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 dependencies file checksum is 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.