Fix lib caching

pull/310/head
Frostebite 2021-12-27 03:26:53 +00:00
parent 9a2757e69f
commit e57d9d0a83
3 changed files with 17 additions and 3 deletions

9
dist/index.js vendored
View File

@ -669,7 +669,7 @@ class SetupRemoteRepository {
yield remote_client_system_1.RemoteClientSystem.Run(`ls -lh "${libraryCacheFolder}"`);
cloud_runner_logger_1.default.logCli(`Checking if Library cache ${libraryCacheFolder}/${latestLibraryCacheFile} exists`);
const latestCacheFilePath = path_1.default.join(libraryCacheFolder, latestLibraryCacheFile);
if (fs_1.default.existsSync(latestCacheFilePath)) {
if (yield SetupRemoteRepository.checkFileExists(latestCacheFilePath)) {
cloud_runner_logger_1.default.logCli(`Library cache exists`);
yield remote_client_system_1.RemoteClientSystem.Run(`unzip -q "${latestCacheFilePath}" -d "$projectPathFull"`);
}
@ -681,6 +681,13 @@ class SetupRemoteRepository {
}
});
}
static checkFileExists(filepath) {
return new Promise((resolve) => {
fs_1.default.access(filepath, fs_1.default.constants.F_OK, (error) => {
resolve(!error);
});
});
}
static createLFSHashFiles() {
return __awaiter(this, void 0, void 0, function* () {
yield remote_client_system_1.RemoteClientSystem.Run(`git lfs ls-files -l | cut -d ' ' -f1 | sort > .lfs-assets-guid`);

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -132,7 +132,7 @@ export class SetupRemoteRepository {
await RemoteClientSystem.Run(`ls -lh "${libraryCacheFolder}"`);
CloudRunnerLogger.logCli(`Checking if Library cache ${libraryCacheFolder}/${latestLibraryCacheFile} exists`);
const latestCacheFilePath = path.join(libraryCacheFolder, latestLibraryCacheFile);
if (fs.existsSync(latestCacheFilePath)) {
if (await SetupRemoteRepository.checkFileExists(latestCacheFilePath)) {
CloudRunnerLogger.logCli(`Library cache exists`);
await RemoteClientSystem.Run(`unzip -q "${latestCacheFilePath}" -d "$projectPathFull"`);
} else {
@ -142,6 +142,13 @@ export class SetupRemoteRepository {
}
}
}
static checkFileExists(filepath) {
return new Promise((resolve) => {
fs.access(filepath, fs.constants.F_OK, (error) => {
resolve(!error);
});
});
}
private static async createLFSHashFiles() {
await RemoteClientSystem.Run(`git lfs ls-files -l | cut -d ' ' -f1 | sort > .lfs-assets-guid`);