We've been struggling to get the cache to hit on pull requests into our default branch based on the documentation. I had a feeling it could be related to our specific setup (our default branch is staging and main is a fast-forward only version that can only be pushed to from staging).
To test out this theory, I created a simple Gradle repo (via gradle init) and set it up with the workflow below:
Push commit to main, let it build. Cache successfully is written and persisted
Create branch test with minor change, open PR to main. Cache is successfully read from main's build, as read-only.
Case 2: Default Branch staging (our case):
Push commit to staging, let it build. Cache successfully is written and persisted
Create branch test2 with minor change, open PR to staging. Cache is missed with message Gradle User Home cache not found. Will initialize empty..
The Case 2 represents our actual workflow and the results that we are seeing. Is there a chance, even though the docs do say that the key matching will work for any PR against the default branch, that there is some hardcoded value where it will only work with the default branch set to main? If not, any other ideas on what's going on?
We've been struggling to get the cache to hit on pull requests into our default branch based on the documentation. I had a feeling it could be related to our specific setup (our default branch is
staging
andmain
is a fast-forward only version that can only be pushed to fromstaging
).To test out this theory, I created a simple Gradle repo (via gradle init) and set it up with the workflow below:
Case 1: Default Branch
main
:main
, let it build. Cache successfully is written and persistedtest
with minor change, open PR tomain
. Cache is successfully read frommain
's build, as read-only.Case 2: Default Branch
staging
(our case):staging
, let it build. Cache successfully is written and persistedtest2
with minor change, open PR tostaging
. Cache is missed with messageGradle User Home cache not found. Will initialize empty.
.The Case 2 represents our actual workflow and the results that we are seeing. Is there a chance, even though the docs do say that the key matching will work for any PR against the default branch, that there is some hardcoded value where it will only work with the default branch set to
main
? If not, any other ideas on what's going on?