Fix basic caching smoke test on Windows, and warn on save failure - #1028
Merged
Conversation
The basic-cache-verify-build smoke test fails on Windows: the seed job
never uploads a cache entry, but reports that it did.
The seed build leaves a Gradle daemon running, which holds the '*.lock'
files in the Gradle User Home. On Windows those locks are mandatory, so
tar cannot read them ("Device or resource busy") and exits non-zero.
`cache.saveCache()` logs the cause and returns -1 rather than throwing,
so we unconditionally logged "saved entry with key" and reported
"(Entry saved)" in the job summary. The failure only surfaced later, as
an unrelated-looking plugin resolution error in the verify job.
Caching failures should not fail the build, so check the returned cacheId
and emit a warning, reporting the entry as not saved.
Daemon management for enhanced caching is handled by the
gradle-actions-caching library. Basic caching leaves it to the workflow,
so run the seed build with --no-daemon.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #1027, which added Windows coverage for the caching smoke tests.
basic-cache-verify-buildfailed on Windows for a reason unrelated to #1013.Root cause
The Windows seed job never uploaded a cache entry, but reported that it did.
gh cache listshowed nosetup-java-Windows-*entry at all, despite the job loggingBasic caching saved entry with key: setup-java-Windows-x64-gradle-594edf…. The keys were never the problem — seed and verify requested the identical key.The seed build leaves a Gradle daemon running, holding the
*.lockfiles in the Gradle User Home. On Windows those locks are mandatory, sotarcannot read them:38 bytes is exactly Gradle's lock-file header — the region the daemon holds via
FileChannel.lock(). On Linux the lock is advisory and tar reads straight through, which is why this only ever failed on Windows.cache.saveCache()catches the tar failure, logs it, and returns-1rather than throwing.BasicCacheService.save()ignored the return value, so the seed job went green and the failure surfaced only later — as a plugin resolution error in the verify job, pointing nowhere near caching.Changes
1. Warn when the save fails. Check the returned
cacheIdand, when it is-1, emit a warning and report(Entry not saved: save failed)in the job summary. Caching failures still do not fail the build.2. Run the seed build with
--no-daemon. Daemon management for enhanced caching lives in thegradle-actions-cachinglibrary; basic caching leaves it to the workflow, so the smoke test now ensures no daemon is holding locks when the post-action save runs.Not related to #1013
The enhanced provider fails differently on Windows — every entry dies at path validation, before tar runs (
Path Validation Error: Path(s) specified in the action for caching do(es) not exist). Same symptom, different mechanism; that one is unchanged here and is still expected to be red.Verification
npm run checkandnpm testpass locally (373 tests). The real check is this PR's Windows run:basic-cache-seed-buildandbasic-cache-verify-buildshould both be green onwindows-latest, while therestore-gradle-home-*Windows jobs stay red pending the #1013 fix.🤖 Generated with Claude Code