Caching cleanup

pull/310/head
Frostebite 2022-01-02 06:52:32 +00:00
parent 3e9b2eefb9
commit 33d5e3c4df
4 changed files with 17 additions and 23 deletions

18
dist/index.js vendored
View File

@ -547,10 +547,10 @@ class Caching {
yield cloud_runner_agent_system_1.CloudRunnerAgentSystem.Run(`tree ${sourceFolder}`);
yield cloud_runner_agent_system_1.CloudRunnerAgentSystem.Run(`tree ${cacheFolder}`);
}
yield cloud_runner_agent_system_1.CloudRunnerAgentSystem.Run(`zip -r "${cacheKey}" "${path_1.default.basename(sourceFolder)}"`);
yield cloud_runner_agent_system_1.CloudRunnerAgentSystem.Run(`zip -r ${cacheKey} ${path_1.default.basename(sourceFolder)}`);
console_1.assert(fs_1.default.existsSync(`${cacheKey}`));
yield cloud_runner_agent_system_1.CloudRunnerAgentSystem.Run(`cp "${cacheKey}" "${path_1.default.join(cacheFolder, `${cacheKey}`)}"`);
remote_client_logger_1.RemoteClientLogger.log(`copied ${cacheKey} to ${cacheFolder}`);
yield cloud_runner_agent_system_1.CloudRunnerAgentSystem.Run(`mv ${cacheKey}.zip ${cacheFolder}`);
remote_client_logger_1.RemoteClientLogger.log(`moved ${cacheKey}.zip to ${cacheFolder}`);
if (__1.Input.cloudRunnerTests) {
yield cloud_runner_agent_system_1.CloudRunnerAgentSystem.Run(`tree ${cacheFolder}`);
}
@ -573,7 +573,9 @@ class Caching {
if (!fs_1.default.existsSync(destinationFolder)) {
yield cloud_runner_agent_system_1.CloudRunnerAgentSystem.Run(`mkdir -p ${destinationFolder}`);
}
const latestInBranch = yield (yield cloud_runner_agent_system_1.CloudRunnerAgentSystem.Run(`ls -t "${cacheFolder}" | grep .zip$ | head -1`)).replace(/\n/g, ``);
const latestInBranch = yield (yield cloud_runner_agent_system_1.CloudRunnerAgentSystem.Run(`ls -t "${cacheFolder}" | grep .zip$ | head -1`))
.replace(/\n/g, ``)
.replace('.zip', '');
process.chdir(cacheFolder);
if (__1.Input.cloudRunnerTests) {
yield cloud_runner_agent_system_1.CloudRunnerAgentSystem.Run(`tree ${cacheFolder}`);
@ -588,8 +590,8 @@ class Caching {
}
remote_client_logger_1.RemoteClientLogger.log(`cache item exists`);
console_1.assert(fs_1.default.existsSync(destinationFolder));
yield cloud_runner_agent_system_1.CloudRunnerAgentSystem.Run(`unzip "${cacheSelection}" -d "${path_1.default.basename(destinationFolder)}"`);
yield cloud_runner_agent_system_1.CloudRunnerAgentSystem.Run(`cp -r "${cacheSelection}" "${destinationFolder}/..""`);
yield cloud_runner_agent_system_1.CloudRunnerAgentSystem.Run(`unzip ${cacheSelection}.zip -d ${path_1.default.basename(destinationFolder)}`);
yield cloud_runner_agent_system_1.CloudRunnerAgentSystem.Run(`mv ${path_1.default.basename(destinationFolder)}/* ${destinationFolder}`);
if (__1.Input.cloudRunnerTests) {
yield cloud_runner_agent_system_1.CloudRunnerAgentSystem.Run(`tree ${destinationFolder}`);
}
@ -2508,7 +2510,6 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Hook = exports.CloudRunnerBuildCommandProcessor = void 0;
const __1 = __webpack_require__(41359);
const yaml_1 = __importDefault(__webpack_require__(13552));
const cloud_runner_logger_1 = __importDefault(__webpack_require__(22855));
class CloudRunnerBuildCommandProcessor {
static ProcessCommands(commands, buildParameters) {
const hooks = CloudRunnerBuildCommandProcessor.getHooks().filter((x) => x.step.includes(`all`));
@ -2534,9 +2535,6 @@ class CloudRunnerBuildCommandProcessor {
throw error;
}
}
if (__1.Input.cloudRunnerTests) {
cloud_runner_logger_1.default.log(`Getting hooks: ${JSON.stringify(output, undefined, 4)}`);
}
return output.filter((x) => x.step !== undefined && x.hook !== undefined && x.hook.length > 0);
}
}

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -21,10 +21,10 @@ export class Caching {
await CloudRunnerAgentSystem.Run(`tree ${sourceFolder}`);
await CloudRunnerAgentSystem.Run(`tree ${cacheFolder}`);
}
await CloudRunnerAgentSystem.Run(`zip -r "${cacheKey}" "${path.basename(sourceFolder)}"`);
await CloudRunnerAgentSystem.Run(`zip -r ${cacheKey} ${path.basename(sourceFolder)}`);
assert(fs.existsSync(`${cacheKey}`));
await CloudRunnerAgentSystem.Run(`cp "${cacheKey}" "${path.join(cacheFolder, `${cacheKey}`)}"`);
RemoteClientLogger.log(`copied ${cacheKey} to ${cacheFolder}`);
await CloudRunnerAgentSystem.Run(`mv ${cacheKey}.zip ${cacheFolder}`);
RemoteClientLogger.log(`moved ${cacheKey}.zip to ${cacheFolder}`);
if (Input.cloudRunnerTests) {
await CloudRunnerAgentSystem.Run(`tree ${cacheFolder}`);
@ -47,9 +47,9 @@ export class Caching {
await CloudRunnerAgentSystem.Run(`mkdir -p ${destinationFolder}`);
}
const latestInBranch = await (
await CloudRunnerAgentSystem.Run(`ls -t "${cacheFolder}" | grep .zip$ | head -1`)
).replace(/\n/g, ``);
const latestInBranch = await (await CloudRunnerAgentSystem.Run(`ls -t "${cacheFolder}" | grep .zip$ | head -1`))
.replace(/\n/g, ``)
.replace('.zip', '');
process.chdir(cacheFolder);
@ -69,8 +69,8 @@ export class Caching {
}
RemoteClientLogger.log(`cache item exists`);
assert(fs.existsSync(destinationFolder));
await CloudRunnerAgentSystem.Run(`unzip "${cacheSelection}" -d "${path.basename(destinationFolder)}"`);
await CloudRunnerAgentSystem.Run(`cp -r "${cacheSelection}" "${destinationFolder}/..""`);
await CloudRunnerAgentSystem.Run(`unzip ${cacheSelection}.zip -d ${path.basename(destinationFolder)}`);
await CloudRunnerAgentSystem.Run(`mv ${path.basename(destinationFolder)}/* ${destinationFolder}`);
if (Input.cloudRunnerTests) {
await CloudRunnerAgentSystem.Run(`tree ${destinationFolder}`);
}

View File

@ -1,7 +1,6 @@
import { BuildParameters, Input } from '../..';
import YAML from 'yaml';
import CloudRunnerSecret from './cloud-runner-secret';
import CloudRunnerLogger from './cloud-runner-logger';
export class CloudRunnerBuildCommandProcessor {
public static ProcessCommands(commands: string, buildParameters: BuildParameters): string {
@ -29,9 +28,6 @@ export class CloudRunnerBuildCommandProcessor {
throw error;
}
}
if (Input.cloudRunnerTests) {
CloudRunnerLogger.log(`Getting hooks: ${JSON.stringify(output, undefined, 4)}`);
}
return output.filter((x) => x.step !== undefined && x.hook !== undefined && x.hook.length > 0);
}
}