pull/310/head
Frostebite 2021-12-26 00:47:33 +00:00
parent 9bcd11c51c
commit 07ed0dc3b4
3 changed files with 78 additions and 57 deletions

10
dist/index.js vendored
View File

@ -540,6 +540,7 @@ const remote_client_system_1 = __webpack_require__(91269);
class SetupRemoteRepository {
static run() {
return __awaiter(this, void 0, void 0, function* () {
try {
fs_1.default.mkdirSync(cloud_runner_state_1.CloudRunnerState.buildPathFull);
fs_1.default.mkdirSync(cloud_runner_state_1.CloudRunnerState.repoPathFull);
yield SetupRemoteRepository.cloneRepoWithoutLFSFiles();
@ -555,6 +556,10 @@ class SetupRemoteRepository {
yield SetupRemoteRepository.pullLatestLFS();
yield SetupRemoteRepository.cacheLatestLFSFiles(LFS_ASSETS_HASH, lfsCacheFolder);
SetupRemoteRepository.handleCachePurging();
}
catch (error) {
throw error;
}
});
}
static printLFSHashState() {
@ -666,6 +671,7 @@ class SetupRemoteRepository {
}
static cloneRepoWithoutLFSFiles() {
return __awaiter(this, void 0, void 0, function* () {
try {
cloud_runner_logger_1.default.logRemoteCli(`Initializing source repository for cloning with caching of LFS files`);
process.chdir(cloud_runner_state_1.CloudRunnerState.repoPathFull);
yield remote_client_system_1.RemoteClientSystem.Run(`git config --global advice.detachedHead false`);
@ -678,6 +684,10 @@ class SetupRemoteRepository {
yield remote_client_system_1.RemoteClientSystem.Run(`${cloud_runner_state_1.CloudRunnerState.buildParams.gitSha}`);
yield remote_client_system_1.RemoteClientSystem.Run(`git checkout ${cloud_runner_state_1.CloudRunnerState.buildParams.gitSha}`);
cloud_runner_logger_1.default.logRemoteCli(`Checked out ${process.env.GITHUB_SHA}`);
}
catch (error) {
throw error;
}
});
}
}

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -6,12 +6,16 @@ import { RemoteClientSystem } from './remote-client-system';
export class SetupRemoteRepository {
public static async run() {
try {
fs.mkdirSync(CloudRunnerState.buildPathFull);
fs.mkdirSync(CloudRunnerState.repoPathFull);
await SetupRemoteRepository.cloneRepoWithoutLFSFiles();
await SetupRemoteRepository.createLFSHashFiles();
const LFS_ASSETS_HASH = fs.readFileSync(`${path.join(CloudRunnerState.repoPathFull, `.lfs-assets-guid`)}`, 'utf8');
const LFS_ASSETS_HASH = fs.readFileSync(
`${path.join(CloudRunnerState.repoPathFull, `.lfs-assets-guid`)}`,
'utf8',
);
await SetupRemoteRepository.printLFSHashState();
const lfsCacheFolder = path.join(CloudRunnerState.cacheFolderFull, `lfs`);
const libraryCacheFolder = path.join(CloudRunnerState.cacheFolderFull, `lib`);
@ -23,6 +27,9 @@ export class SetupRemoteRepository {
await SetupRemoteRepository.pullLatestLFS();
await SetupRemoteRepository.cacheLatestLFSFiles(LFS_ASSETS_HASH, lfsCacheFolder);
SetupRemoteRepository.handleCachePurging();
} catch (error) {
throw error;
}
}
private static async printLFSHashState() {
@ -134,6 +141,7 @@ export class SetupRemoteRepository {
}
private static async cloneRepoWithoutLFSFiles() {
try {
CloudRunnerLogger.logRemoteCli(`Initializing source repository for cloning with caching of LFS files`);
process.chdir(CloudRunnerState.repoPathFull);
await RemoteClientSystem.Run(`git config --global advice.detachedHead false`);
@ -148,5 +156,8 @@ export class SetupRemoteRepository {
await RemoteClientSystem.Run(`${CloudRunnerState.buildParams.gitSha}`);
await RemoteClientSystem.Run(`git checkout ${CloudRunnerState.buildParams.gitSha}`);
CloudRunnerLogger.logRemoteCli(`Checked out ${process.env.GITHUB_SHA}`);
} catch (error) {
throw error;
}
}
}