Skip to content

Commit

Permalink
Handle failure in cache-cleanup
Browse files Browse the repository at this point in the history
Do not abort the remainder of the post-action on failure in cache-cleanup.
Instead, just log a warning and continue.

Fixes #858
Fixes #990
  • Loading branch information
bigdaz committed Dec 12, 2023
1 parent 77699ba commit a71aff6
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 5 deletions.
7 changes: 6 additions & 1 deletion dist/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -93490,7 +93490,12 @@ function save(gradleUserHome, cacheListener, daemonController) {
if ((0, cache_utils_1.isCacheCleanupEnabled)()) {
core.info('Forcing cache cleanup.');
const cacheCleaner = new cache_cleaner_1.CacheCleaner(gradleUserHome, process.env['RUNNER_TEMP']);
yield cacheCleaner.forceCleanup();
try {
yield cacheCleaner.forceCleanup();
}
catch (e) {
core.warning(`Cache cleanup failed. Will continue. ${String(e)}`);
}
}
yield core.group('Caching Gradle state', () => __awaiter(this, void 0, void 0, function* () {
return new cache_base_1.GradleStateCache(gradleUserHome).save(cacheListener);
Expand Down
2 changes: 1 addition & 1 deletion dist/main/index.js.map

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion dist/post/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -93490,7 +93490,12 @@ function save(gradleUserHome, cacheListener, daemonController) {
if ((0, cache_utils_1.isCacheCleanupEnabled)()) {
core.info('Forcing cache cleanup.');
const cacheCleaner = new cache_cleaner_1.CacheCleaner(gradleUserHome, process.env['RUNNER_TEMP']);
yield cacheCleaner.forceCleanup();
try {
yield cacheCleaner.forceCleanup();
}
catch (e) {
core.warning(`Cache cleanup failed. Will continue. ${String(e)}`);
}
}
yield core.group('Caching Gradle state', () => __awaiter(this, void 0, void 0, function* () {
return new cache_base_1.GradleStateCache(gradleUserHome).save(cacheListener);
Expand Down
2 changes: 1 addition & 1 deletion dist/post/index.js.map

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion src/caches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ export async function save(
if (isCacheCleanupEnabled()) {
core.info('Forcing cache cleanup.')
const cacheCleaner = new CacheCleaner(gradleUserHome, process.env['RUNNER_TEMP']!)
await cacheCleaner.forceCleanup()
try {
await cacheCleaner.forceCleanup()
} catch (e) {
core.warning(`Cache cleanup failed. Will continue. ${String(e)}`)
}
}

await core.group('Caching Gradle state', async () => {
Expand Down

0 comments on commit a71aff6

Please sign in to comment.