hashing driven enhancement for cache
parent
00937a75df
commit
7d106a632d
|
|
@ -568,18 +568,15 @@ class Caching {
|
||||||
if (!fs_1.default.existsSync(destinationFolder)) {
|
if (!fs_1.default.existsSync(destinationFolder)) {
|
||||||
yield cloud_runner_agent_system_1.CloudRunnerAgentSystem.Run(`mkdir -p ${destinationFolder}`);
|
yield cloud_runner_agent_system_1.CloudRunnerAgentSystem.Run(`mkdir -p ${destinationFolder}`);
|
||||||
}
|
}
|
||||||
const latest = 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, ``);
|
||||||
process.chdir(cacheFolder);
|
process.chdir(cacheFolder);
|
||||||
let cacheSelection;
|
|
||||||
if (__1.Input.cloudRunnerTests) {
|
if (__1.Input.cloudRunnerTests) {
|
||||||
cloud_runner_logger_1.default.log(yield lfs_hashing_1.LFSHashing.hashAllFiles(destinationFolder));
|
cloud_runner_logger_1.default.log(yield lfs_hashing_1.LFSHashing.hashAllFiles(destinationFolder));
|
||||||
yield cloud_runner_agent_system_1.CloudRunnerAgentSystem.Run(`tree ${cacheFolder}`);
|
yield cloud_runner_agent_system_1.CloudRunnerAgentSystem.Run(`tree ${cacheFolder}`);
|
||||||
}
|
}
|
||||||
if (cacheKey !== ``) {
|
const cacheSelection = cacheKey !== `` && fs_1.default.existsSync(cacheKey) ? cacheKey : latestInBranch;
|
||||||
cacheSelection = fs_1.default.existsSync(cacheKey) ? cacheKey : latest;
|
if (__1.Input.cloudRunnerTests) {
|
||||||
}
|
yield cloud_runner_agent_system_1.CloudRunnerAgentSystem.Run(`cache key ${cacheKey} selection ${cacheSelection}`);
|
||||||
else {
|
|
||||||
cacheSelection = latest;
|
|
||||||
}
|
}
|
||||||
if (fs_1.default.existsSync(cacheSelection)) {
|
if (fs_1.default.existsSync(cacheSelection)) {
|
||||||
if (__1.Input.cloudRunnerTests) {
|
if (__1.Input.cloudRunnerTests) {
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -47,24 +47,23 @@ export class Caching {
|
||||||
await CloudRunnerAgentSystem.Run(`mkdir -p ${destinationFolder}`);
|
await CloudRunnerAgentSystem.Run(`mkdir -p ${destinationFolder}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const latest = await (await CloudRunnerAgentSystem.Run(`ls -t "${cacheFolder}" | grep .zip$ | head -1`)).replace(
|
const latestInBranch = await (
|
||||||
/\n/g,
|
await CloudRunnerAgentSystem.Run(`ls -t "${cacheFolder}" | grep .zip$ | head -1`)
|
||||||
``,
|
).replace(/\n/g, ``);
|
||||||
);
|
|
||||||
|
|
||||||
process.chdir(cacheFolder);
|
process.chdir(cacheFolder);
|
||||||
let cacheSelection;
|
|
||||||
|
|
||||||
if (Input.cloudRunnerTests) {
|
if (Input.cloudRunnerTests) {
|
||||||
CloudRunnerLogger.log(await LFSHashing.hashAllFiles(destinationFolder));
|
CloudRunnerLogger.log(await LFSHashing.hashAllFiles(destinationFolder));
|
||||||
await CloudRunnerAgentSystem.Run(`tree ${cacheFolder}`);
|
await CloudRunnerAgentSystem.Run(`tree ${cacheFolder}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cacheKey !== ``) {
|
const cacheSelection = cacheKey !== `` && fs.existsSync(cacheKey) ? cacheKey : latestInBranch;
|
||||||
cacheSelection = fs.existsSync(cacheKey) ? cacheKey : latest;
|
|
||||||
} else {
|
if (Input.cloudRunnerTests) {
|
||||||
cacheSelection = latest;
|
await CloudRunnerAgentSystem.Run(`cache key ${cacheKey} selection ${cacheSelection}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fs.existsSync(cacheSelection)) {
|
if (fs.existsSync(cacheSelection)) {
|
||||||
if (Input.cloudRunnerTests) {
|
if (Input.cloudRunnerTests) {
|
||||||
await CloudRunnerAgentSystem.Run(`tree ${destinationFolder}`);
|
await CloudRunnerAgentSystem.Run(`tree ${destinationFolder}`);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue