gradle / gradle/actions

Prefer cache entries written by dependent jobs

Open
#557 0 comments 0 reactions 0 assignees View on GitHub
enhancement in:caching
Dominant language
TypeScript
Stars
340
Forks
117
Avg merge
1d 9h
Merged PRs (30d)
11

Description

Currently, when retrieving Gradle User Home state, we look for a cache entry written by an earlier execution of the same Job. If not found, we revert to searching for the most recent cache entry written by any Job on the same OS.

An optimization to this would be to prefer an entry written by a dependent Job (as defined by the [needs context](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs#needs-context)) over an entry written by a different, arbitrary Job.

We would search for cache entries as follows:

```
1) An exact match on OS, job id, workflow name, matrix, and Git SHA
2) The most recent entry saved for the same OS, job id, workflow name, and matrix values
3) The most recent entry saved for the same OS and job id
NEW 4) The most recent entry saved for a dependent job on the same OS
5) The most recent entry saved for the same OS
```

Contributor guide

Open the contributing guide

Research direction

Start by tracing the Gradle User Home cache-retrieval path and how the existing five search priorities are implemented. Use the linked needs context documentation to determine dependent jobs; done means the most recent same-OS cache from a dependent job is considered before the general same-OS fallback.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, typescript
Domain
ci-cd, devops
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.