Caching cleanup

pull/310/head
Frostebite 2022-01-02 17:24:50 +00:00
parent 19be95bef3
commit e1d6d6fd3a
3 changed files with 11 additions and 9 deletions

9
dist/index.js vendored
View File

@ -547,11 +547,12 @@ class Caching {
} }
yield cloud_runner_agent_system_1.CloudRunnerAgentSystem.Run(`zip -q -r ${cacheKey} ${path_1.default.basename(sourceFolder)}`); yield cloud_runner_agent_system_1.CloudRunnerAgentSystem.Run(`zip -q -r ${cacheKey} ${path_1.default.basename(sourceFolder)}`);
console_1.assert(fs_1.default.existsSync(`${cacheKey}`)); console_1.assert(fs_1.default.existsSync(`${cacheKey}`));
console_1.assert(cacheFolder); console_1.assert(fs_1.default.existsSync(`${cacheFolder}`));
console_1.assert(sourceFolder); console_1.assert(fs_1.default.existsSync(`${sourceFolder}`));
console_1.assert(fs_1.default.existsSync(`${path_1.default.basename(sourceFolder)}`));
yield cloud_runner_agent_system_1.CloudRunnerAgentSystem.Run(`mv ${cacheKey}.zip ${cacheFolder}`); yield cloud_runner_agent_system_1.CloudRunnerAgentSystem.Run(`mv ${cacheKey}.zip ${cacheFolder}`);
remote_client_logger_1.RemoteClientLogger.log(`moved ${cacheKey}.zip to ${cacheFolder}`); remote_client_logger_1.RemoteClientLogger.log(`moved ${cacheKey}.zip to ${cacheFolder}`);
console_1.assert(path_1.default.join(cacheFolder, `${cacheKey}.zip`)); console_1.assert(fs_1.default.existsSync(`${path_1.default.join(cacheFolder, cacheKey)}.zip`));
if (__1.Input.cloudRunnerTests) { if (__1.Input.cloudRunnerTests) {
yield Caching.printFullCacheHierarchySize(); yield Caching.printFullCacheHierarchySize();
} }
@ -585,7 +586,7 @@ class Caching {
console_1.assert(fs_1.default.existsSync(destinationFolder)); console_1.assert(fs_1.default.existsSync(destinationFolder));
yield cloud_runner_agent_system_1.CloudRunnerAgentSystem.Run(`unzip -q ${cacheSelection}.zip -d ${path_1.default.basename(destinationFolder)}`); yield cloud_runner_agent_system_1.CloudRunnerAgentSystem.Run(`unzip -q ${cacheSelection}.zip -d ${path_1.default.basename(destinationFolder)}`);
yield cloud_runner_agent_system_1.CloudRunnerAgentSystem.Run(`mv ${path_1.default.basename(destinationFolder)}/* ${destinationFolder}`); yield cloud_runner_agent_system_1.CloudRunnerAgentSystem.Run(`mv ${path_1.default.basename(destinationFolder)}/* ${destinationFolder}`);
console_1.assert(path_1.default.join(destinationFolder, `${cacheSelection}.zip`)); console_1.assert(fs_1.default.existsSync(`${path_1.default.join(destinationFolder, `${cacheSelection}.zip`)}`));
} }
else { else {
remote_client_logger_1.RemoteClientLogger.logWarning(`cache item ${cacheKey} doesn't exist ${destinationFolder}`); remote_client_logger_1.RemoteClientLogger.logWarning(`cache item ${cacheKey} doesn't exist ${destinationFolder}`);

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -22,11 +22,12 @@ export class Caching {
await CloudRunnerAgentSystem.Run(`zip -q -r ${cacheKey} ${path.basename(sourceFolder)}`); await CloudRunnerAgentSystem.Run(`zip -q -r ${cacheKey} ${path.basename(sourceFolder)}`);
assert(fs.existsSync(`${cacheKey}`)); assert(fs.existsSync(`${cacheKey}`));
assert(cacheFolder); assert(fs.existsSync(`${cacheFolder}`));
assert(sourceFolder); assert(fs.existsSync(`${sourceFolder}`));
assert(fs.existsSync(`${path.basename(sourceFolder)}`));
await CloudRunnerAgentSystem.Run(`mv ${cacheKey}.zip ${cacheFolder}`); await CloudRunnerAgentSystem.Run(`mv ${cacheKey}.zip ${cacheFolder}`);
RemoteClientLogger.log(`moved ${cacheKey}.zip to ${cacheFolder}`); RemoteClientLogger.log(`moved ${cacheKey}.zip to ${cacheFolder}`);
assert(path.join(cacheFolder, `${cacheKey}.zip`)); assert(fs.existsSync(`${path.join(cacheFolder, cacheKey)}.zip`));
if (Input.cloudRunnerTests) { if (Input.cloudRunnerTests) {
await Caching.printFullCacheHierarchySize(); await Caching.printFullCacheHierarchySize();
@ -63,7 +64,7 @@ export class Caching {
assert(fs.existsSync(destinationFolder)); assert(fs.existsSync(destinationFolder));
await CloudRunnerAgentSystem.Run(`unzip -q ${cacheSelection}.zip -d ${path.basename(destinationFolder)}`); await CloudRunnerAgentSystem.Run(`unzip -q ${cacheSelection}.zip -d ${path.basename(destinationFolder)}`);
await CloudRunnerAgentSystem.Run(`mv ${path.basename(destinationFolder)}/* ${destinationFolder}`); await CloudRunnerAgentSystem.Run(`mv ${path.basename(destinationFolder)}/* ${destinationFolder}`);
assert(path.join(destinationFolder, `${cacheSelection}.zip`)); assert(fs.existsSync(`${path.join(destinationFolder, `${cacheSelection}.zip`)}`));
} else { } else {
RemoteClientLogger.logWarning(`cache item ${cacheKey} doesn't exist ${destinationFolder}`); RemoteClientLogger.logWarning(`cache item ${cacheKey} doesn't exist ${destinationFolder}`);
if (cacheSelection !== ``) { if (cacheSelection !== ``) {