Allow optional caching in failed builds
Description
It's possible that you have a configuration where the outcome of the pipeline has nothing really to do with the quality of the cache. For example, you may be syncing quite a lot of NPM dependencies that are otherwise unchanged by your code. Throwing this valuable cache away because your own code failed to build is not an efficient use of time and resources.
This is particularly exacerbated when getting an initial pipeline working and nothing is ever cached until your first green checkbox shows up.
Proposal
Just like it's possible to specify artifacts:when = always
, it should be possible to specify cache:when = always
.
Links / references
Documentation blurb
In the documentation we should highlight this as a way to speed up pipelines when you're caching external dependencies, and also mention it in the efficiency docs.
Overview
What is it? cache:when
in gitlab-ci.yml
Why should someone use this feature? To save time on failed builds.
What is the underlying (business) problem? Productivity.
How do you use this feature? Add cache:when = always
to gitlab-ci.yml
Use cases
Save time on subsequent failed builds.
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
This page may contain information related to upcoming products, features and functionality. It is important to note that the information presented is for informational purposes only, so please do not rely on the information for purchasing or planning purposes. Just like with all projects, the items mentioned on the page are subject to change or delay, and the development, release, and timing of any products, features, or functionality remain at the sole discretion of GitLab Inc.