mirror of
https://github.com/game-ci/unity-builder.git
synced 2026-06-11 16:34:03 -07:00
pr feedback
This commit is contained in:
@@ -101,9 +101,24 @@ describe('Cloud Runner Caching', () => {
|
||||
if (fs.existsSync(cachePath)) {
|
||||
try {
|
||||
CloudRunnerLogger.log(`Cleaning up cache directory: ${cachePath}`);
|
||||
await CloudRunnerSystem.Run(`rm -rf ${cachePath}/* || true`);
|
||||
// Try to change ownership first (if running as root or with sudo)
|
||||
// Then try multiple cleanup methods to handle permission issues
|
||||
await CloudRunnerSystem.Run(
|
||||
`chmod -R u+w ${cachePath} 2>/dev/null || chown -R $(whoami) ${cachePath} 2>/dev/null || true`,
|
||||
);
|
||||
// Try regular rm first
|
||||
await CloudRunnerSystem.Run(`rm -rf ${cachePath}/* 2>/dev/null || true`);
|
||||
// If that fails, try with sudo if available
|
||||
await CloudRunnerSystem.Run(`sudo rm -rf ${cachePath}/* 2>/dev/null || true`);
|
||||
// As last resort, try to remove files one by one, ignoring permission errors
|
||||
await CloudRunnerSystem.Run(
|
||||
`find ${cachePath} -type f -exec rm -f {} + 2>/dev/null || find ${cachePath} -type f -delete 2>/dev/null || true`,
|
||||
);
|
||||
// Remove empty directories
|
||||
await CloudRunnerSystem.Run(`find ${cachePath} -type d -empty -delete 2>/dev/null || true`);
|
||||
} catch (error: any) {
|
||||
CloudRunnerLogger.log(`Failed to cleanup cache: ${error.message}`);
|
||||
// Don't throw - cleanup failures shouldn't fail the test suite
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user