test
parent
9bcd11c51c
commit
07ed0dc3b4
|
|
@ -540,21 +540,26 @@ const remote_client_system_1 = __webpack_require__(91269);
|
||||||
class SetupRemoteRepository {
|
class SetupRemoteRepository {
|
||||||
static run() {
|
static run() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
fs_1.default.mkdirSync(cloud_runner_state_1.CloudRunnerState.buildPathFull);
|
try {
|
||||||
fs_1.default.mkdirSync(cloud_runner_state_1.CloudRunnerState.repoPathFull);
|
fs_1.default.mkdirSync(cloud_runner_state_1.CloudRunnerState.buildPathFull);
|
||||||
yield SetupRemoteRepository.cloneRepoWithoutLFSFiles();
|
fs_1.default.mkdirSync(cloud_runner_state_1.CloudRunnerState.repoPathFull);
|
||||||
yield SetupRemoteRepository.createLFSHashFiles();
|
yield SetupRemoteRepository.cloneRepoWithoutLFSFiles();
|
||||||
const LFS_ASSETS_HASH = fs_1.default.readFileSync(`${path_1.default.join(cloud_runner_state_1.CloudRunnerState.repoPathFull, `.lfs-assets-guid`)}`, 'utf8');
|
yield SetupRemoteRepository.createLFSHashFiles();
|
||||||
yield SetupRemoteRepository.printLFSHashState();
|
const LFS_ASSETS_HASH = fs_1.default.readFileSync(`${path_1.default.join(cloud_runner_state_1.CloudRunnerState.repoPathFull, `.lfs-assets-guid`)}`, 'utf8');
|
||||||
const lfsCacheFolder = path_1.default.join(cloud_runner_state_1.CloudRunnerState.cacheFolderFull, `lfs`);
|
yield SetupRemoteRepository.printLFSHashState();
|
||||||
const libraryCacheFolder = path_1.default.join(cloud_runner_state_1.CloudRunnerState.cacheFolderFull, `lib`);
|
const lfsCacheFolder = path_1.default.join(cloud_runner_state_1.CloudRunnerState.cacheFolderFull, `lfs`);
|
||||||
yield remote_client_system_1.RemoteClientSystem.Run(`tree ${cloud_runner_state_1.CloudRunnerState.builderPathFull}`);
|
const libraryCacheFolder = path_1.default.join(cloud_runner_state_1.CloudRunnerState.cacheFolderFull, `lib`);
|
||||||
yield SetupRemoteRepository.libraryCaching(lfsCacheFolder, libraryCacheFolder);
|
yield remote_client_system_1.RemoteClientSystem.Run(`tree ${cloud_runner_state_1.CloudRunnerState.builderPathFull}`);
|
||||||
yield SetupRemoteRepository.lfsCaching(lfsCacheFolder, LFS_ASSETS_HASH);
|
yield SetupRemoteRepository.libraryCaching(lfsCacheFolder, libraryCacheFolder);
|
||||||
yield SetupRemoteRepository.printCacheState(lfsCacheFolder, libraryCacheFolder);
|
yield SetupRemoteRepository.lfsCaching(lfsCacheFolder, LFS_ASSETS_HASH);
|
||||||
yield SetupRemoteRepository.pullLatestLFS();
|
yield SetupRemoteRepository.printCacheState(lfsCacheFolder, libraryCacheFolder);
|
||||||
yield SetupRemoteRepository.cacheLatestLFSFiles(LFS_ASSETS_HASH, lfsCacheFolder);
|
yield SetupRemoteRepository.pullLatestLFS();
|
||||||
SetupRemoteRepository.handleCachePurging();
|
yield SetupRemoteRepository.cacheLatestLFSFiles(LFS_ASSETS_HASH, lfsCacheFolder);
|
||||||
|
SetupRemoteRepository.handleCachePurging();
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
static printLFSHashState() {
|
static printLFSHashState() {
|
||||||
|
|
@ -666,18 +671,23 @@ class SetupRemoteRepository {
|
||||||
}
|
}
|
||||||
static cloneRepoWithoutLFSFiles() {
|
static cloneRepoWithoutLFSFiles() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
cloud_runner_logger_1.default.logRemoteCli(`Initializing source repository for cloning with caching of LFS files`);
|
try {
|
||||||
process.chdir(cloud_runner_state_1.CloudRunnerState.repoPathFull);
|
cloud_runner_logger_1.default.logRemoteCli(`Initializing source repository for cloning with caching of LFS files`);
|
||||||
yield remote_client_system_1.RemoteClientSystem.Run(`git config --global advice.detachedHead false`);
|
process.chdir(cloud_runner_state_1.CloudRunnerState.repoPathFull);
|
||||||
cloud_runner_logger_1.default.logRemoteCli(`Cloning the repository being built:`);
|
yield remote_client_system_1.RemoteClientSystem.Run(`git config --global advice.detachedHead false`);
|
||||||
yield remote_client_system_1.RemoteClientSystem.Run(`git lfs install --skip-smudge`);
|
cloud_runner_logger_1.default.logRemoteCli(`Cloning the repository being built:`);
|
||||||
cloud_runner_logger_1.default.logRemoteCli(cloud_runner_state_1.CloudRunnerState.targetBuildRepoUrl);
|
yield remote_client_system_1.RemoteClientSystem.Run(`git lfs install --skip-smudge`);
|
||||||
yield remote_client_system_1.RemoteClientSystem.Run(`git clone --depth 1 ${cloud_runner_state_1.CloudRunnerState.targetBuildRepoUrl} ${cloud_runner_state_1.CloudRunnerState.repoPathFull}`);
|
cloud_runner_logger_1.default.logRemoteCli(cloud_runner_state_1.CloudRunnerState.targetBuildRepoUrl);
|
||||||
yield remote_client_system_1.RemoteClientSystem.Run(`ls -lh`);
|
yield remote_client_system_1.RemoteClientSystem.Run(`git clone --depth 1 ${cloud_runner_state_1.CloudRunnerState.targetBuildRepoUrl} ${cloud_runner_state_1.CloudRunnerState.repoPathFull}`);
|
||||||
yield remote_client_system_1.RemoteClientSystem.Run(`tree`);
|
yield remote_client_system_1.RemoteClientSystem.Run(`ls -lh`);
|
||||||
yield remote_client_system_1.RemoteClientSystem.Run(`${cloud_runner_state_1.CloudRunnerState.buildParams.gitSha}`);
|
yield remote_client_system_1.RemoteClientSystem.Run(`tree`);
|
||||||
yield remote_client_system_1.RemoteClientSystem.Run(`git checkout ${cloud_runner_state_1.CloudRunnerState.buildParams.gitSha}`);
|
yield remote_client_system_1.RemoteClientSystem.Run(`${cloud_runner_state_1.CloudRunnerState.buildParams.gitSha}`);
|
||||||
cloud_runner_logger_1.default.logRemoteCli(`Checked out ${process.env.GITHUB_SHA}`);
|
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;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -6,23 +6,30 @@ import { RemoteClientSystem } from './remote-client-system';
|
||||||
|
|
||||||
export class SetupRemoteRepository {
|
export class SetupRemoteRepository {
|
||||||
public static async run() {
|
public static async run() {
|
||||||
fs.mkdirSync(CloudRunnerState.buildPathFull);
|
try {
|
||||||
fs.mkdirSync(CloudRunnerState.repoPathFull);
|
fs.mkdirSync(CloudRunnerState.buildPathFull);
|
||||||
await SetupRemoteRepository.cloneRepoWithoutLFSFiles();
|
fs.mkdirSync(CloudRunnerState.repoPathFull);
|
||||||
|
await SetupRemoteRepository.cloneRepoWithoutLFSFiles();
|
||||||
|
|
||||||
await SetupRemoteRepository.createLFSHashFiles();
|
await SetupRemoteRepository.createLFSHashFiles();
|
||||||
const LFS_ASSETS_HASH = fs.readFileSync(`${path.join(CloudRunnerState.repoPathFull, `.lfs-assets-guid`)}`, 'utf8');
|
const LFS_ASSETS_HASH = fs.readFileSync(
|
||||||
await SetupRemoteRepository.printLFSHashState();
|
`${path.join(CloudRunnerState.repoPathFull, `.lfs-assets-guid`)}`,
|
||||||
const lfsCacheFolder = path.join(CloudRunnerState.cacheFolderFull, `lfs`);
|
'utf8',
|
||||||
const libraryCacheFolder = path.join(CloudRunnerState.cacheFolderFull, `lib`);
|
);
|
||||||
await RemoteClientSystem.Run(`tree ${CloudRunnerState.builderPathFull}`);
|
await SetupRemoteRepository.printLFSHashState();
|
||||||
await SetupRemoteRepository.libraryCaching(lfsCacheFolder, libraryCacheFolder);
|
const lfsCacheFolder = path.join(CloudRunnerState.cacheFolderFull, `lfs`);
|
||||||
await SetupRemoteRepository.lfsCaching(lfsCacheFolder, LFS_ASSETS_HASH);
|
const libraryCacheFolder = path.join(CloudRunnerState.cacheFolderFull, `lib`);
|
||||||
|
await RemoteClientSystem.Run(`tree ${CloudRunnerState.builderPathFull}`);
|
||||||
|
await SetupRemoteRepository.libraryCaching(lfsCacheFolder, libraryCacheFolder);
|
||||||
|
await SetupRemoteRepository.lfsCaching(lfsCacheFolder, LFS_ASSETS_HASH);
|
||||||
|
|
||||||
await SetupRemoteRepository.printCacheState(lfsCacheFolder, libraryCacheFolder);
|
await SetupRemoteRepository.printCacheState(lfsCacheFolder, libraryCacheFolder);
|
||||||
await SetupRemoteRepository.pullLatestLFS();
|
await SetupRemoteRepository.pullLatestLFS();
|
||||||
await SetupRemoteRepository.cacheLatestLFSFiles(LFS_ASSETS_HASH, lfsCacheFolder);
|
await SetupRemoteRepository.cacheLatestLFSFiles(LFS_ASSETS_HASH, lfsCacheFolder);
|
||||||
SetupRemoteRepository.handleCachePurging();
|
SetupRemoteRepository.handleCachePurging();
|
||||||
|
} catch (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async printLFSHashState() {
|
private static async printLFSHashState() {
|
||||||
|
|
@ -134,19 +141,23 @@ export class SetupRemoteRepository {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async cloneRepoWithoutLFSFiles() {
|
private static async cloneRepoWithoutLFSFiles() {
|
||||||
CloudRunnerLogger.logRemoteCli(`Initializing source repository for cloning with caching of LFS files`);
|
try {
|
||||||
process.chdir(CloudRunnerState.repoPathFull);
|
CloudRunnerLogger.logRemoteCli(`Initializing source repository for cloning with caching of LFS files`);
|
||||||
await RemoteClientSystem.Run(`git config --global advice.detachedHead false`);
|
process.chdir(CloudRunnerState.repoPathFull);
|
||||||
CloudRunnerLogger.logRemoteCli(`Cloning the repository being built:`);
|
await RemoteClientSystem.Run(`git config --global advice.detachedHead false`);
|
||||||
await RemoteClientSystem.Run(`git lfs install --skip-smudge`);
|
CloudRunnerLogger.logRemoteCli(`Cloning the repository being built:`);
|
||||||
CloudRunnerLogger.logRemoteCli(CloudRunnerState.targetBuildRepoUrl);
|
await RemoteClientSystem.Run(`git lfs install --skip-smudge`);
|
||||||
await RemoteClientSystem.Run(
|
CloudRunnerLogger.logRemoteCli(CloudRunnerState.targetBuildRepoUrl);
|
||||||
`git clone --depth 1 ${CloudRunnerState.targetBuildRepoUrl} ${CloudRunnerState.repoPathFull}`,
|
await RemoteClientSystem.Run(
|
||||||
);
|
`git clone --depth 1 ${CloudRunnerState.targetBuildRepoUrl} ${CloudRunnerState.repoPathFull}`,
|
||||||
await RemoteClientSystem.Run(`ls -lh`);
|
);
|
||||||
await RemoteClientSystem.Run(`tree`);
|
await RemoteClientSystem.Run(`ls -lh`);
|
||||||
await RemoteClientSystem.Run(`${CloudRunnerState.buildParams.gitSha}`);
|
await RemoteClientSystem.Run(`tree`);
|
||||||
await RemoteClientSystem.Run(`git checkout ${CloudRunnerState.buildParams.gitSha}`);
|
await RemoteClientSystem.Run(`${CloudRunnerState.buildParams.gitSha}`);
|
||||||
CloudRunnerLogger.logRemoteCli(`Checked out ${process.env.GITHUB_SHA}`);
|
await RemoteClientSystem.Run(`git checkout ${CloudRunnerState.buildParams.gitSha}`);
|
||||||
|
CloudRunnerLogger.logRemoteCli(`Checked out ${process.env.GITHUB_SHA}`);
|
||||||
|
} catch (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue