pr feedback

This commit is contained in:
Frostebite
2025-12-15 02:49:27 +00:00
parent ec089529c7
commit be6f2f058a
7 changed files with 267 additions and 48 deletions
@@ -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
}
}
}