Converting caching from shell to typescript
parent
9079429c8d
commit
f67f5bc615
|
|
@ -2073,26 +2073,28 @@ class DownloadRepository {
|
||||||
tree "${cloud_runner_state_1.CloudRunnerState.libraryFolderFull}"
|
tree "${cloud_runner_state_1.CloudRunnerState.libraryFolderFull}"
|
||||||
`);
|
`);
|
||||||
}
|
}
|
||||||
|
cloud_runner_logger_1.default.log(` `);
|
||||||
|
cloud_runner_logger_1.default.log(`LFS Caching`);
|
||||||
|
cloud_runner_logger_1.default.log(`Checking largest LFS file exists (${lfsCacheFolder}/${LFS_ASSETS_HASH}.zip)`);
|
||||||
|
process.chdir(lfsCacheFolder);
|
||||||
|
let latestLFSCacheFile;
|
||||||
|
if (fs_1.default.existsSync(`${LFS_ASSETS_HASH}.zip`)) {
|
||||||
|
cloud_runner_logger_1.default.log(`Match found: using large file hash match ${LFS_ASSETS_HASH}.zip`);
|
||||||
|
latestLFSCacheFile = `${LFS_ASSETS_HASH}.zip`;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
latestLFSCacheFile = yield run_cli_1.RunCli.RunCli(`ls -t "${lfsCacheFolder}" | grep .zip$ | head -1`);
|
||||||
|
}
|
||||||
|
if (fs_1.default.existsSync(latestLFSCacheFile)) {
|
||||||
|
cloud_runner_logger_1.default.log(`LFS cache exists`);
|
||||||
|
fs_1.default.rmdirSync(cloud_runner_state_1.CloudRunnerState.lfsDirectory, { recursive: true });
|
||||||
|
cloud_runner_logger_1.default.log(`LFS cache exists from build $latestLFSCacheFile from $branch`);
|
||||||
yield run_cli_1.RunCli.RunCli(`
|
yield run_cli_1.RunCli.RunCli(`
|
||||||
echo ' '
|
unzip -q "${lfsCacheFolder}/${latestLFSCacheFile}" -d "${cloud_runner_state_1.CloudRunnerState.repoPathFull}/.git"
|
||||||
echo 'Large File Caching'
|
ls -lh "${cloud_runner_state_1.CloudRunnerState.lfsDirectory}"
|
||||||
echo "Checking large file cache exists (${lfsCacheFolder}/${LFS_ASSETS_HASH}.zip)"
|
|
||||||
cd ${lfsCacheFolder}
|
|
||||||
if [ -f "${LFS_ASSETS_HASH}.zip" ]; then
|
|
||||||
echo "Match found: using large file hash match ${LFS_ASSETS_HASH}.zip"
|
|
||||||
latestLFSCacheFile="${LFS_ASSETS_HASH}"
|
|
||||||
else
|
|
||||||
latestLFSCacheFile=$(ls -t "${lfsCacheFolder}" | grep .zip$ | head -1)
|
|
||||||
echo "Match not found: using latest large file cache $latestLFSCacheFile"
|
|
||||||
fi
|
|
||||||
if [ ! -f "$latestLFSCacheFile" ]; then
|
|
||||||
echo "LFS cache exists from build $latestLFSCacheFile from $branch"
|
|
||||||
rm -r "${cloud_runner_state_1.CloudRunnerState.lfsDirectory}"
|
|
||||||
unzip -q "${lfsCacheFolder}/$latestLFSCacheFile" -d "$repoPathFull/.git"
|
|
||||||
echo "git LFS folder, (should not contain $latestLFSCacheFile)"
|
|
||||||
ls -lh "${cloud_runner_state_1.CloudRunnerState.lfsDirectory}/"
|
|
||||||
fi
|
|
||||||
`);
|
`);
|
||||||
|
cloud_runner_logger_1.default.log(`git LFS folder, (should not contain $latestLFSCacheFile)`);
|
||||||
|
}
|
||||||
yield run_cli_1.RunCli.RunCli(`
|
yield run_cli_1.RunCli.RunCli(`
|
||||||
echo ' '
|
echo ' '
|
||||||
echo "LFS cache for $branch"
|
echo "LFS cache for $branch"
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -64,26 +64,27 @@ export class DownloadRepository {
|
||||||
tree "${CloudRunnerState.libraryFolderFull}"
|
tree "${CloudRunnerState.libraryFolderFull}"
|
||||||
`);
|
`);
|
||||||
}
|
}
|
||||||
|
CloudRunnerLogger.log(` `);
|
||||||
|
CloudRunnerLogger.log(`LFS Caching`);
|
||||||
|
CloudRunnerLogger.log(`Checking largest LFS file exists (${lfsCacheFolder}/${LFS_ASSETS_HASH}.zip)`);
|
||||||
|
process.chdir(lfsCacheFolder);
|
||||||
|
let latestLFSCacheFile;
|
||||||
|
if (fs.existsSync(`${LFS_ASSETS_HASH}.zip`)) {
|
||||||
|
CloudRunnerLogger.log(`Match found: using large file hash match ${LFS_ASSETS_HASH}.zip`);
|
||||||
|
latestLFSCacheFile = `${LFS_ASSETS_HASH}.zip`;
|
||||||
|
} else {
|
||||||
|
latestLFSCacheFile = await RunCli.RunCli(`ls -t "${lfsCacheFolder}" | grep .zip$ | head -1`);
|
||||||
|
}
|
||||||
|
if (fs.existsSync(latestLFSCacheFile)) {
|
||||||
|
CloudRunnerLogger.log(`LFS cache exists`);
|
||||||
|
fs.rmdirSync(CloudRunnerState.lfsDirectory, { recursive: true });
|
||||||
|
CloudRunnerLogger.log(`LFS cache exists from build $latestLFSCacheFile from $branch`);
|
||||||
await RunCli.RunCli(`
|
await RunCli.RunCli(`
|
||||||
echo ' '
|
unzip -q "${lfsCacheFolder}/${latestLFSCacheFile}" -d "${CloudRunnerState.repoPathFull}/.git"
|
||||||
echo 'Large File Caching'
|
ls -lh "${CloudRunnerState.lfsDirectory}"
|
||||||
echo "Checking large file cache exists (${lfsCacheFolder}/${LFS_ASSETS_HASH}.zip)"
|
|
||||||
cd ${lfsCacheFolder}
|
|
||||||
if [ -f "${LFS_ASSETS_HASH}.zip" ]; then
|
|
||||||
echo "Match found: using large file hash match ${LFS_ASSETS_HASH}.zip"
|
|
||||||
latestLFSCacheFile="${LFS_ASSETS_HASH}"
|
|
||||||
else
|
|
||||||
latestLFSCacheFile=$(ls -t "${lfsCacheFolder}" | grep .zip$ | head -1)
|
|
||||||
echo "Match not found: using latest large file cache $latestLFSCacheFile"
|
|
||||||
fi
|
|
||||||
if [ ! -f "$latestLFSCacheFile" ]; then
|
|
||||||
echo "LFS cache exists from build $latestLFSCacheFile from $branch"
|
|
||||||
rm -r "${CloudRunnerState.lfsDirectory}"
|
|
||||||
unzip -q "${lfsCacheFolder}/$latestLFSCacheFile" -d "$repoPathFull/.git"
|
|
||||||
echo "git LFS folder, (should not contain $latestLFSCacheFile)"
|
|
||||||
ls -lh "${CloudRunnerState.lfsDirectory}/"
|
|
||||||
fi
|
|
||||||
`);
|
`);
|
||||||
|
CloudRunnerLogger.log(`git LFS folder, (should not contain $latestLFSCacheFile)`);
|
||||||
|
}
|
||||||
await RunCli.RunCli(`
|
await RunCli.RunCli(`
|
||||||
echo ' '
|
echo ' '
|
||||||
echo "LFS cache for $branch"
|
echo "LFS cache for $branch"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue