Fix lib caching

pull/310/head
Frostebite 2021-12-27 20:24:44 +00:00
parent 3f9ebcb203
commit e82f003015
3 changed files with 17 additions and 4 deletions

13
dist/index.js vendored
View File

@ -544,6 +544,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.SetupRemoteRepository = void 0;
const console_1 = __webpack_require__(57082);
const fs_1 = __importDefault(__webpack_require__(35747));
const path_1 = __importDefault(__webpack_require__(85622));
const cloud_runner_logger_1 = __importDefault(__webpack_require__(22855));
@ -615,7 +616,7 @@ class SetupRemoteRepository {
return __awaiter(this, void 0, void 0, function* () {
process.chdir(`${cloud_runner_state_1.CloudRunnerState.lfsDirectory}/..`);
yield remote_client_system_1.RemoteClientSystem.Run(`zip -r "${SetupRemoteRepository.LFS_ASSETS_HASH}.zip" "lfs"`);
cloud_runner_logger_1.default.logCli(fs_1.default.existsSync(`${SetupRemoteRepository.LFS_ASSETS_HASH}.zip`).toString());
console_1.assert(fs_1.default.existsSync(`${SetupRemoteRepository.LFS_ASSETS_HASH}.zip`));
yield remote_client_system_1.RemoteClientSystem.Run(`cp "${SetupRemoteRepository.LFS_ASSETS_HASH}.zip" "${path_1.default.join(lfsCacheFolder, `${SetupRemoteRepository.LFS_ASSETS_HASH}.zip`)}"`);
cloud_runner_logger_1.default.logCli(`copied ${SetupRemoteRepository.LFS_ASSETS_HASH} to ${lfsCacheFolder}`);
});
@ -640,7 +641,7 @@ class SetupRemoteRepository {
latestLFSCacheFile = `${SetupRemoteRepository.LFS_ASSETS_HASH}.zip`;
}
else {
latestLFSCacheFile = yield remote_client_system_1.RemoteClientSystem.Run(`ls -t "${lfsCacheFolder}" | grep .zip$ | head -1`);
latestLFSCacheFile = yield (yield remote_client_system_1.RemoteClientSystem.Run(`ls -t "${lfsCacheFolder}" | grep .zip$ | head -1`)).replace(`\n`, ``);
}
if (fs_1.default.existsSync(latestLFSCacheFile)) {
cloud_runner_logger_1.default.logCli(`LFS cache exists`);
@ -266322,6 +266323,14 @@ module.exports = require("child_process");;
/***/ }),
/***/ 57082:
/***/ ((module) => {
"use strict";
module.exports = require("console");;
/***/ }),
/***/ 33373:
/***/ ((module) => {

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -1,3 +1,4 @@
import { assert } from 'console';
import fs from 'fs';
import path from 'path';
import CloudRunnerLogger from '../../cloud-runner/services/cloud-runner-logger';
@ -73,6 +74,7 @@ export class SetupRemoteRepository {
private static async cacheLatestLFSFiles(lfsCacheFolder: string) {
process.chdir(`${CloudRunnerState.lfsDirectory}/..`);
await RemoteClientSystem.Run(`zip -r "${SetupRemoteRepository.LFS_ASSETS_HASH}.zip" "lfs"`);
assert();
CloudRunnerLogger.logCli(fs.existsSync(`${SetupRemoteRepository.LFS_ASSETS_HASH}.zip`).toString());
await RemoteClientSystem.Run(
`cp "${SetupRemoteRepository.LFS_ASSETS_HASH}.zip" "${path.join(
@ -100,7 +102,9 @@ export class SetupRemoteRepository {
CloudRunnerLogger.logCli(`Match found: using large file hash match ${SetupRemoteRepository.LFS_ASSETS_HASH}.zip`);
latestLFSCacheFile = `${SetupRemoteRepository.LFS_ASSETS_HASH}.zip`;
} else {
latestLFSCacheFile = await RemoteClientSystem.Run(`ls -t "${lfsCacheFolder}" | grep .zip$ | head -1`);
latestLFSCacheFile = await (
await RemoteClientSystem.Run(`ls -t "${lfsCacheFolder}" | grep .zip$ | head -1`)
).replace(`\n`, ``);
}
if (fs.existsSync(latestLFSCacheFile)) {
CloudRunnerLogger.logCli(`LFS cache exists`);