cleanup
parent
a2257b05b6
commit
a966a36ee1
|
|
@ -2126,6 +2126,12 @@ class RemoteBuilder {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
yield this.RemoteBuilderProviderPlatform.setupSharedBuildResources(buildUid, buildParameters, branchName, defaultSecretsArray);
|
yield this.RemoteBuilderProviderPlatform.setupSharedBuildResources(buildUid, buildParameters, branchName, defaultSecretsArray);
|
||||||
|
this.buildPathFull = `/${buildVolumeFolder}/${buildUid}`;
|
||||||
|
this.builderPathFull = `${this.buildPathFull}/builder`;
|
||||||
|
this.steamPathFull = `${this.buildPathFull}/steam`;
|
||||||
|
this.repoPathFull = `${this.buildPathFull}/${repositoryFolder}`;
|
||||||
|
this.projectPathFull = `${this.repoPathFull}/${buildParameters.projectPath}`;
|
||||||
|
this.libraryFolderFull = `${this.projectPathFull}/Library`;
|
||||||
yield RemoteBuilder.SetupStep(`setup${buildUid}`, buildParameters, branchName, defaultSecretsArray);
|
yield RemoteBuilder.SetupStep(`setup${buildUid}`, buildParameters, branchName, defaultSecretsArray);
|
||||||
yield RemoteBuilder.BuildStep(`build${buildUid}`, buildParameters, baseImage, defaultSecretsArray);
|
yield RemoteBuilder.BuildStep(`build${buildUid}`, buildParameters, baseImage, defaultSecretsArray);
|
||||||
yield RemoteBuilder.CompressionStep(`compress${buildUid}`, buildParameters, branchName, defaultSecretsArray);
|
yield RemoteBuilder.CompressionStep(`compress${buildUid}`, buildParameters, branchName, defaultSecretsArray);
|
||||||
|
|
@ -2146,21 +2152,14 @@ class RemoteBuilder {
|
||||||
static SetupStep(buildUid, buildParameters, branchName, defaultSecretsArray) {
|
static SetupStep(buildUid, buildParameters, branchName, defaultSecretsArray) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
core.info('Starting step 1/4 clone and restore cache)');
|
core.info('Starting step 1/4 clone and restore cache)');
|
||||||
const cacheFolderFull = `/${buildVolumeFolder}/${cacheFolder}`;
|
const lfsDirectory = `${this.repoPathFull}/.git/lfs`;
|
||||||
const buildPathFull = `/${buildVolumeFolder}/${buildUid}`;
|
const testLFSFile = `${this.repoPathFull}/test-project/Assets/LFS_Test_File.jpg`;
|
||||||
const builderPathFull = `${buildPathFull}/builder`;
|
|
||||||
const steamPathFull = `${buildPathFull}/steam`;
|
|
||||||
const repoPathFull = `${buildPathFull}/${repositoryFolder}`;
|
|
||||||
const projectPathFull = `${repoPathFull}/${buildParameters.projectPath}`;
|
|
||||||
const libraryFolderFull = `${projectPathFull}/Library`;
|
|
||||||
const lfsDirectory = `${repoPathFull}/.git/lfs`;
|
|
||||||
const testLFSFile = `${repoPathFull}/test-project/Assets/LFS_Test_File.jpg`;
|
|
||||||
const repo = `https://${buildParameters.githubToken}@github.com/game-ci/unity-builder.git`;
|
const repo = `https://${buildParameters.githubToken}@github.com/game-ci/unity-builder.git`;
|
||||||
const repo2 = `https://${buildParameters.githubToken}@github.com/game-ci/steam-deploy.git`;
|
const repo2 = `https://${buildParameters.githubToken}@github.com/game-ci/steam-deploy.git`;
|
||||||
const repo3 = `https://${buildParameters.githubToken}@github.com/${process.env.GITHUB_REPOSITORY}.git`;
|
const repo3 = `https://${buildParameters.githubToken}@github.com/${process.env.GITHUB_REPOSITORY}.git`;
|
||||||
const purgeRemoteCache = process.env.PURGE_REMOTE_BUILDER_CACHE === undefined;
|
const purgeRemoteCache = process.env.PURGE_REMOTE_BUILDER_CACHE === undefined;
|
||||||
const initializeSourceRepoForCaching = `${builderPathFull}/dist/remote-builder/cloneNoLFS.sh ${repoPathFull} ${repo3} $GITHUB_SHA ${testLFSFile}`;
|
const initializeSourceRepoForCaching = `${this.builderPathFull}/dist/remote-builder/cloneNoLFS.sh ${this.repoPathFull} ${repo3} $GITHUB_SHA ${testLFSFile}`;
|
||||||
const handleCaching = `${builderPathFull}/dist/remote-builder/handleCaching.sh ${cacheFolderFull} ${branchName} ${libraryFolderFull} ${lfsDirectory} ${purgeRemoteCache}`;
|
const handleCaching = `${this.builderPathFull}/dist/remote-builder/handleCaching.sh ${this.cacheFolderFull} ${branchName} ${this.libraryFolderFull} ${lfsDirectory} ${purgeRemoteCache}`;
|
||||||
yield this.RemoteBuilderProviderPlatform.runBuildTask(buildUid, 'alpine/git', [
|
yield this.RemoteBuilderProviderPlatform.runBuildTask(buildUid, 'alpine/git', [
|
||||||
` apk update -q
|
` apk update -q
|
||||||
apk add unzip -q
|
apk add unzip -q
|
||||||
|
|
@ -2168,16 +2167,16 @@ class RemoteBuilder {
|
||||||
apk add jq -q
|
apk add jq -q
|
||||||
apk add tree -q
|
apk add tree -q
|
||||||
#
|
#
|
||||||
mkdir ${buildPathFull}
|
mkdir ${this.buildPathFull}
|
||||||
mkdir ${builderPathFull}
|
mkdir ${this.builderPathFull}
|
||||||
mkdir ${repoPathFull}
|
mkdir ${this.repoPathFull}
|
||||||
mkdir ${steamPathFull}
|
mkdir ${this.steamPathFull}
|
||||||
#
|
#
|
||||||
echo ' '
|
echo ' '
|
||||||
echo 'Cloning utility repositories for remote builder'
|
echo 'Cloning utility repositories for remote builder'
|
||||||
git clone -q --branch "remote-builder/unified-providers" ${repo} ${builderPathFull}
|
git clone -q --branch "remote-builder/unified-providers" ${repo} ${this.builderPathFull}
|
||||||
echo 'Cloned ${repo}'
|
echo 'Cloned ${repo}'
|
||||||
git clone -q ${repo2} ${steamPathFull}
|
git clone -q ${repo2} ${this.steamPathFull}
|
||||||
echo 'Cloned ${repo2}'
|
echo 'Cloned ${repo2}'
|
||||||
#
|
#
|
||||||
echo ' '
|
echo ' '
|
||||||
|
|
@ -2188,12 +2187,12 @@ class RemoteBuilder {
|
||||||
echo 'Checking cache for the Unity project Library and git LFS files'
|
echo 'Checking cache for the Unity project Library and git LFS files'
|
||||||
${handleCaching}
|
${handleCaching}
|
||||||
echo 'Caching complete'
|
echo 'Caching complete'
|
||||||
cd ${repoPathFull}
|
cd ${this.repoPathFull}
|
||||||
git lfs pull
|
git lfs pull
|
||||||
#
|
#
|
||||||
echo 'buildVolumeReport.txt and buildVolumeReport.txt saved to repository workspace directory'
|
echo 'buildVolumeReport.txt and buildVolumeReport.txt saved to repository workspace directory'
|
||||||
tree -L 3 ${buildPathFull} > ${repoPathFull}/buildVolumeReport.txt
|
tree -L 3 ${this.buildPathFull} > ${this.repoPathFull}/buildVolumeReport.txt
|
||||||
ls -lh /${buildVolumeFolder} > ${repoPathFull}/buildVolumeReport.txt
|
ls -lh /${buildVolumeFolder} > ${this.repoPathFull}/buildVolumeReport.txt
|
||||||
#
|
#
|
||||||
`,
|
`,
|
||||||
], `/${buildVolumeFolder}`, `/${buildVolumeFolder}/`, [
|
], `/${buildVolumeFolder}`, `/${buildVolumeFolder}/`, [
|
||||||
|
|
@ -2322,9 +2321,9 @@ class RemoteBuilder {
|
||||||
// Cleanup
|
// Cleanup
|
||||||
yield this.RemoteBuilderProviderPlatform.runBuildTask(buildUid, 'alpine', [
|
yield this.RemoteBuilderProviderPlatform.runBuildTask(buildUid, 'alpine', [
|
||||||
`
|
`
|
||||||
apk update
|
apk update -q
|
||||||
apk add zip
|
apk add zip -q
|
||||||
cd Library
|
cd ${this.libraryFolderFull}
|
||||||
zip -r lib-${buildUid}.zip .*
|
zip -r lib-${buildUid}.zip .*
|
||||||
mv lib-${buildUid}.zip /${buildVolumeFolder}/${cacheFolder}/${branchName}/lib/lib-${buildUid}.zip
|
mv lib-${buildUid}.zip /${buildVolumeFolder}/${cacheFolder}/${branchName}/lib/lib-${buildUid}.zip
|
||||||
cd ../../
|
cd ../../
|
||||||
|
|
@ -2433,6 +2432,7 @@ class RemoteBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RemoteBuilder.SteamDeploy = false;
|
RemoteBuilder.SteamDeploy = false;
|
||||||
|
RemoteBuilder.cacheFolderFull = `/${buildVolumeFolder}/${cacheFolder}`;
|
||||||
exports.default = RemoteBuilder;
|
exports.default = RemoteBuilder;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -24,7 +24,6 @@ if [ -d "$libraryFolderFull" ]; then
|
||||||
echo "Git must ignore the Library folder"
|
echo "Git must ignore the Library folder"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
echo "Checking cache"
|
echo "Checking cache"
|
||||||
|
|
||||||
# Restore library cache
|
# Restore library cache
|
||||||
|
|
@ -51,4 +50,3 @@ fi
|
||||||
if [ "$purgeRemoteBuilderCache" == "true" ]; then
|
if [ "$purgeRemoteBuilderCache" == "true" ]; then
|
||||||
rm -r "$cacheFolderFull"
|
rm -r "$cacheFolderFull"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,14 @@ const cacheFolder = 'cache';
|
||||||
|
|
||||||
class RemoteBuilder {
|
class RemoteBuilder {
|
||||||
static SteamDeploy: boolean = false;
|
static SteamDeploy: boolean = false;
|
||||||
|
|
||||||
|
private static cacheFolderFull: string = `/${buildVolumeFolder}/${cacheFolder}`;
|
||||||
|
private static buildPathFull: string;
|
||||||
|
private static builderPathFull: string;
|
||||||
|
private static steamPathFull: string;
|
||||||
|
private static repoPathFull: string;
|
||||||
|
private static projectPathFull: string;
|
||||||
|
private static libraryFolderFull: string;
|
||||||
static RemoteBuilderProviderPlatform: RemoteBuilderProviderInterface;
|
static RemoteBuilderProviderPlatform: RemoteBuilderProviderInterface;
|
||||||
static async build(buildParameters: BuildParameters, baseImage) {
|
static async build(buildParameters: BuildParameters, baseImage) {
|
||||||
const runNumber = process.env.GITHUB_RUN_NUMBER;
|
const runNumber = process.env.GITHUB_RUN_NUMBER;
|
||||||
|
|
@ -54,6 +62,14 @@ class RemoteBuilder {
|
||||||
branchName,
|
branchName,
|
||||||
defaultSecretsArray,
|
defaultSecretsArray,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
this.buildPathFull = `/${buildVolumeFolder}/${buildUid}`;
|
||||||
|
this.builderPathFull = `${this.buildPathFull}/builder`;
|
||||||
|
this.steamPathFull = `${this.buildPathFull}/steam`;
|
||||||
|
this.repoPathFull = `${this.buildPathFull}/${repositoryFolder}`;
|
||||||
|
this.projectPathFull = `${this.repoPathFull}/${buildParameters.projectPath}`;
|
||||||
|
this.libraryFolderFull = `${this.projectPathFull}/Library`;
|
||||||
|
|
||||||
await RemoteBuilder.SetupStep(`setup${buildUid}`, buildParameters, branchName, defaultSecretsArray);
|
await RemoteBuilder.SetupStep(`setup${buildUid}`, buildParameters, branchName, defaultSecretsArray);
|
||||||
await RemoteBuilder.BuildStep(`build${buildUid}`, buildParameters, baseImage, defaultSecretsArray);
|
await RemoteBuilder.BuildStep(`build${buildUid}`, buildParameters, baseImage, defaultSecretsArray);
|
||||||
await RemoteBuilder.CompressionStep(`compress${buildUid}`, buildParameters, branchName, defaultSecretsArray);
|
await RemoteBuilder.CompressionStep(`compress${buildUid}`, buildParameters, branchName, defaultSecretsArray);
|
||||||
|
|
@ -87,24 +103,17 @@ class RemoteBuilder {
|
||||||
defaultSecretsArray: RemoteBuilderSecret[],
|
defaultSecretsArray: RemoteBuilderSecret[],
|
||||||
) {
|
) {
|
||||||
core.info('Starting step 1/4 clone and restore cache)');
|
core.info('Starting step 1/4 clone and restore cache)');
|
||||||
const cacheFolderFull = `/${buildVolumeFolder}/${cacheFolder}`;
|
|
||||||
const buildPathFull = `/${buildVolumeFolder}/${buildUid}`;
|
|
||||||
const builderPathFull = `${buildPathFull}/builder`;
|
|
||||||
const steamPathFull = `${buildPathFull}/steam`;
|
|
||||||
const repoPathFull = `${buildPathFull}/${repositoryFolder}`;
|
|
||||||
const projectPathFull = `${repoPathFull}/${buildParameters.projectPath}`;
|
|
||||||
const libraryFolderFull = `${projectPathFull}/Library`;
|
|
||||||
|
|
||||||
const lfsDirectory = `${repoPathFull}/.git/lfs`;
|
const lfsDirectory = `${this.repoPathFull}/.git/lfs`;
|
||||||
const testLFSFile = `${repoPathFull}/test-project/Assets/LFS_Test_File.jpg`;
|
const testLFSFile = `${this.repoPathFull}/test-project/Assets/LFS_Test_File.jpg`;
|
||||||
|
|
||||||
const repo = `https://${buildParameters.githubToken}@github.com/game-ci/unity-builder.git`;
|
const repo = `https://${buildParameters.githubToken}@github.com/game-ci/unity-builder.git`;
|
||||||
const repo2 = `https://${buildParameters.githubToken}@github.com/game-ci/steam-deploy.git`;
|
const repo2 = `https://${buildParameters.githubToken}@github.com/game-ci/steam-deploy.git`;
|
||||||
const repo3 = `https://${buildParameters.githubToken}@github.com/${process.env.GITHUB_REPOSITORY}.git`;
|
const repo3 = `https://${buildParameters.githubToken}@github.com/${process.env.GITHUB_REPOSITORY}.git`;
|
||||||
|
|
||||||
const purgeRemoteCache = process.env.PURGE_REMOTE_BUILDER_CACHE === undefined;
|
const purgeRemoteCache = process.env.PURGE_REMOTE_BUILDER_CACHE === undefined;
|
||||||
const initializeSourceRepoForCaching = `${builderPathFull}/dist/remote-builder/cloneNoLFS.sh ${repoPathFull} ${repo3} $GITHUB_SHA ${testLFSFile}`;
|
const initializeSourceRepoForCaching = `${this.builderPathFull}/dist/remote-builder/cloneNoLFS.sh ${this.repoPathFull} ${repo3} $GITHUB_SHA ${testLFSFile}`;
|
||||||
const handleCaching = `${builderPathFull}/dist/remote-builder/handleCaching.sh ${cacheFolderFull} ${branchName} ${libraryFolderFull} ${lfsDirectory} ${purgeRemoteCache}`;
|
const handleCaching = `${this.builderPathFull}/dist/remote-builder/handleCaching.sh ${this.cacheFolderFull} ${branchName} ${this.libraryFolderFull} ${lfsDirectory} ${purgeRemoteCache}`;
|
||||||
await this.RemoteBuilderProviderPlatform.runBuildTask(
|
await this.RemoteBuilderProviderPlatform.runBuildTask(
|
||||||
buildUid,
|
buildUid,
|
||||||
'alpine/git',
|
'alpine/git',
|
||||||
|
|
@ -115,16 +124,16 @@ class RemoteBuilder {
|
||||||
apk add jq -q
|
apk add jq -q
|
||||||
apk add tree -q
|
apk add tree -q
|
||||||
#
|
#
|
||||||
mkdir ${buildPathFull}
|
mkdir ${this.buildPathFull}
|
||||||
mkdir ${builderPathFull}
|
mkdir ${this.builderPathFull}
|
||||||
mkdir ${repoPathFull}
|
mkdir ${this.repoPathFull}
|
||||||
mkdir ${steamPathFull}
|
mkdir ${this.steamPathFull}
|
||||||
#
|
#
|
||||||
echo ' '
|
echo ' '
|
||||||
echo 'Cloning utility repositories for remote builder'
|
echo 'Cloning utility repositories for remote builder'
|
||||||
git clone -q --branch "remote-builder/unified-providers" ${repo} ${builderPathFull}
|
git clone -q --branch "remote-builder/unified-providers" ${repo} ${this.builderPathFull}
|
||||||
echo 'Cloned ${repo}'
|
echo 'Cloned ${repo}'
|
||||||
git clone -q ${repo2} ${steamPathFull}
|
git clone -q ${repo2} ${this.steamPathFull}
|
||||||
echo 'Cloned ${repo2}'
|
echo 'Cloned ${repo2}'
|
||||||
#
|
#
|
||||||
echo ' '
|
echo ' '
|
||||||
|
|
@ -135,12 +144,12 @@ class RemoteBuilder {
|
||||||
echo 'Checking cache for the Unity project Library and git LFS files'
|
echo 'Checking cache for the Unity project Library and git LFS files'
|
||||||
${handleCaching}
|
${handleCaching}
|
||||||
echo 'Caching complete'
|
echo 'Caching complete'
|
||||||
cd ${repoPathFull}
|
cd ${this.repoPathFull}
|
||||||
git lfs pull
|
git lfs pull
|
||||||
#
|
#
|
||||||
echo 'buildVolumeReport.txt and buildVolumeReport.txt saved to repository workspace directory'
|
echo 'buildVolumeReport.txt and buildVolumeReport.txt saved to repository workspace directory'
|
||||||
tree -L 3 ${buildPathFull} > ${repoPathFull}/buildVolumeReport.txt
|
tree -L 3 ${this.buildPathFull} > ${this.repoPathFull}/buildVolumeReport.txt
|
||||||
ls -lh /${buildVolumeFolder} > ${repoPathFull}/buildVolumeReport.txt
|
ls -lh /${buildVolumeFolder} > ${this.repoPathFull}/buildVolumeReport.txt
|
||||||
#
|
#
|
||||||
`,
|
`,
|
||||||
],
|
],
|
||||||
|
|
@ -301,9 +310,9 @@ class RemoteBuilder {
|
||||||
'alpine',
|
'alpine',
|
||||||
[
|
[
|
||||||
`
|
`
|
||||||
apk update
|
apk update -q
|
||||||
apk add zip
|
apk add zip -q
|
||||||
cd Library
|
cd ${this.libraryFolderFull}
|
||||||
zip -r lib-${buildUid}.zip .*
|
zip -r lib-${buildUid}.zip .*
|
||||||
mv lib-${buildUid}.zip /${buildVolumeFolder}/${cacheFolder}/${branchName}/lib/lib-${buildUid}.zip
|
mv lib-${buildUid}.zip /${buildVolumeFolder}/${cacheFolder}/${branchName}/lib/lib-${buildUid}.zip
|
||||||
cd ../../
|
cd ../../
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue