pull/289/head
Frostebite 2021-08-15 13:46:18 +00:00 committed by GitHub
parent 8918f23f05
commit 7fbd0c1297
4 changed files with 30 additions and 20 deletions

19
dist/index.js vendored
View File

@ -2179,10 +2179,10 @@ class RemoteBuilder {
this.repoPathFull = `${this.buildPathFull}/${repositoryFolder}`; this.repoPathFull = `${this.buildPathFull}/${repositoryFolder}`;
this.projectPathFull = `${this.repoPathFull}/${this.buildParams.projectPath}`; this.projectPathFull = `${this.repoPathFull}/${this.buildParams.projectPath}`;
this.libraryFolderFull = `${this.projectPathFull}/Library`; this.libraryFolderFull = `${this.projectPathFull}/Library`;
yield RemoteBuilder.SetupStep(this.branchName); yield RemoteBuilder.SetupStep();
yield RemoteBuilder.BuildStep(baseImage); yield RemoteBuilder.BuildStep(baseImage);
yield RemoteBuilder.CompressionStep(); yield RemoteBuilder.CompressionStep();
yield RemoteBuilder.UploadArtifacts(this.branchName); yield RemoteBuilder.UploadArtifacts();
if (this.SteamDeploy) { if (this.SteamDeploy) {
yield RemoteBuilder.DeployToSteam(); yield RemoteBuilder.DeployToSteam();
} }
@ -2194,7 +2194,7 @@ class RemoteBuilder {
} }
}); });
} }
static SetupStep(branchName) { static SetupStep() {
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 lfsDirectory = `${this.repoPathFull}/.git/lfs`; const lfsDirectory = `${this.repoPathFull}/.git/lfs`;
@ -2204,7 +2204,7 @@ class RemoteBuilder {
const repo3 = `https://${this.buildParams.githubToken}@github.com/${process.env.GITHUB_REPOSITORY}.git`; const repo3 = `https://${this.buildParams.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 = `${this.builderPathFull}/dist/remote-builder/cloneNoLFS.sh "${this.repoPathFull}" "${repo3}" "$GITHUB_SHA" "${testLFSFile}"`; const initializeSourceRepoForCaching = `${this.builderPathFull}/dist/remote-builder/cloneNoLFS.sh "${this.repoPathFull}" "${repo3}" "$GITHUB_SHA" "${testLFSFile}"`;
const handleCaching = `${this.builderPathFull}/dist/remote-builder/handleCaching.sh "${cacheFolderFull}" "${branchName}" "${this.libraryFolderFull}" "${lfsDirectory}" "${purgeRemoteCache}"`; const handleCaching = `${this.builderPathFull}/dist/remote-builder/handleCaching.sh "${cacheFolderFull}" ${this.libraryFolderFull}" "${lfsDirectory}" "${purgeRemoteCache}"`;
yield this.RemoteBuilderProviderPlatform.runBuildTask(this.buildId, 'alpine/git', [ yield this.RemoteBuilderProviderPlatform.runBuildTask(this.buildId, 'alpine/git', [
` printenv ` printenv
# #
@ -2263,6 +2263,7 @@ class RemoteBuilder {
chmod -R +x "/entrypoint.sh" chmod -R +x "/entrypoint.sh"
chmod -R +x "/steps" chmod -R +x "/steps"
/entrypoint.sh /entrypoint.sh
ls -lh
`, `,
], `/${buildVolumeFolder}`, `/${this.repoPathFull}`, RemoteBuilder.readBuildEnvironmentVariables(), buildSecrets); ], `/${buildVolumeFolder}`, `/${this.repoPathFull}`, RemoteBuilder.readBuildEnvironmentVariables(), buildSecrets);
}); });
@ -2277,7 +2278,6 @@ class RemoteBuilder {
apk add zip -q apk add zip -q
apk add tree -q apk add tree -q
cd "${this.libraryFolderFull}" cd "${this.libraryFolderFull}"
tree
zip -r "lib-${this.buildId}.zip" "${this.libraryFolderFull}" zip -r "lib-${this.buildId}.zip" "${this.libraryFolderFull}"
mv "lib-${this.buildId}.zip" "${cacheFolderFull}/lib" mv "lib-${this.buildId}.zip" "${cacheFolderFull}/lib"
cd "${this.projectPathFull}" cd "${this.projectPathFull}"
@ -2294,14 +2294,14 @@ class RemoteBuilder {
core.info('compression step complete'); core.info('compression step complete');
}); });
} }
static UploadArtifacts(branchName) { static UploadArtifacts() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
core.info('Starting step 4/4 upload build to s3'); core.info('Starting step 4/4 upload build to s3');
yield this.RemoteBuilderProviderPlatform.runBuildTask(this.buildId, 'amazon/aws-cli', [ yield this.RemoteBuilderProviderPlatform.runBuildTask(this.buildId, 'amazon/aws-cli', [
` `
aws s3 cp ${this.buildId}/build-${this.buildId}.zip s3://game-ci-storage/ aws s3 cp ${this.buildId}/build-${this.buildId}.zip s3://game-ci-storage/
# no need to upload Library cache for now # no need to upload Library cache for now
# aws s3 cp /${buildVolumeFolder}/${cacheFolder}/${branchName}/lib-${this.buildId}.zip s3://game-ci-storage/ # aws s3 cp "/${buildVolumeFolder}/${cacheFolder}/$branch/lib-${this.buildId}.zip" "s3://game-ci-storage/"
${this.SteamDeploy ? '#' : ''} rm -r ${this.buildId} ${this.SteamDeploy ? '#' : ''} rm -r ${this.buildId}
`, `,
], `/${buildVolumeFolder}`, `/${buildVolumeFolder}/`, RemoteBuilder.readUploadArtifactEnvironmentVariables(), RemoteBuilder.readUploadArtifactsSecrets()); ], `/${buildVolumeFolder}`, `/${buildVolumeFolder}/`, RemoteBuilder.readUploadArtifactEnvironmentVariables(), RemoteBuilder.readUploadArtifactsSecrets());
@ -2365,6 +2365,11 @@ class RemoteBuilder {
EnvironmentVariable: 'GITHUB_TOKEN', EnvironmentVariable: 'GITHUB_TOKEN',
ParameterValue: this.buildParams.githubToken, ParameterValue: this.buildParams.githubToken,
}, },
{
ParameterKey: 'branch',
EnvironmentVariable: 'branch',
ParameterValue: this.branchName,
},
]; ];
} }
static readBuildSecrets(buildSecrets) { static readBuildSecrets(buildSecrets) {

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -1,11 +1,10 @@
#!/bin/sh #!/bin/sh
cacheFolderFull=$1 cacheFolderFull=$1
branch=$2 libraryFolderFull=$2
libraryFolderFull=$3 gitLFSDestinationFolder=$3
gitLFSDestinationFolder=$4 purgeRemoteBuilderCache=$4
purgeRemoteBuilderCache=$5 LFS_ASSETS_HASH=$5
LFS_ASSETS_HASH=$6
cacheFolderWithBranch="$cacheFolderFull/$branch" cacheFolderWithBranch="$cacheFolderFull/$branch"
lfsCacheFolder="$cacheFolderFull/$branch/lfs" lfsCacheFolder="$cacheFolderFull/$branch/lfs"
@ -66,6 +65,7 @@ du -sch "$cacheFolderFull"
echo ' ' echo ' '
ls ls
cd
git lfs pull git lfs pull
echo 'pulled latest LFS files' echo 'pulled latest LFS files'
zip -q -r "$LFS_ASSETS_HASH.zip" "$gitLFSDestinationFolder" zip -q -r "$LFS_ASSETS_HASH.zip" "$gitLFSDestinationFolder"

View File

@ -56,10 +56,10 @@ class RemoteBuilder {
this.projectPathFull = `${this.repoPathFull}/${this.buildParams.projectPath}`; this.projectPathFull = `${this.repoPathFull}/${this.buildParams.projectPath}`;
this.libraryFolderFull = `${this.projectPathFull}/Library`; this.libraryFolderFull = `${this.projectPathFull}/Library`;
await RemoteBuilder.SetupStep(this.branchName); await RemoteBuilder.SetupStep();
await RemoteBuilder.BuildStep(baseImage); await RemoteBuilder.BuildStep(baseImage);
await RemoteBuilder.CompressionStep(); await RemoteBuilder.CompressionStep();
await RemoteBuilder.UploadArtifacts(this.branchName); await RemoteBuilder.UploadArtifacts();
if (this.SteamDeploy) { if (this.SteamDeploy) {
await RemoteBuilder.DeployToSteam(); await RemoteBuilder.DeployToSteam();
} }
@ -75,7 +75,7 @@ class RemoteBuilder {
} }
} }
private static async SetupStep(branchName: string | undefined) { private static async SetupStep() {
core.info('Starting step 1/4 clone and restore cache)'); core.info('Starting step 1/4 clone and restore cache)');
const lfsDirectory = `${this.repoPathFull}/.git/lfs`; const lfsDirectory = `${this.repoPathFull}/.git/lfs`;
@ -87,7 +87,7 @@ class RemoteBuilder {
const purgeRemoteCache = process.env.PURGE_REMOTE_BUILDER_CACHE !== undefined; const purgeRemoteCache = process.env.PURGE_REMOTE_BUILDER_CACHE !== undefined;
const initializeSourceRepoForCaching = `${this.builderPathFull}/dist/remote-builder/cloneNoLFS.sh "${this.repoPathFull}" "${repo3}" "$GITHUB_SHA" "${testLFSFile}"`; const initializeSourceRepoForCaching = `${this.builderPathFull}/dist/remote-builder/cloneNoLFS.sh "${this.repoPathFull}" "${repo3}" "$GITHUB_SHA" "${testLFSFile}"`;
const handleCaching = `${this.builderPathFull}/dist/remote-builder/handleCaching.sh "${cacheFolderFull}" "${branchName}" "${this.libraryFolderFull}" "${lfsDirectory}" "${purgeRemoteCache}"`; const handleCaching = `${this.builderPathFull}/dist/remote-builder/handleCaching.sh "${cacheFolderFull}" ${this.libraryFolderFull}" "${lfsDirectory}" "${purgeRemoteCache}"`;
await this.RemoteBuilderProviderPlatform.runBuildTask( await this.RemoteBuilderProviderPlatform.runBuildTask(
this.buildId, this.buildId,
'alpine/git', 'alpine/git',
@ -156,6 +156,7 @@ class RemoteBuilder {
chmod -R +x "/entrypoint.sh" chmod -R +x "/entrypoint.sh"
chmod -R +x "/steps" chmod -R +x "/steps"
/entrypoint.sh /entrypoint.sh
ls -lh
`, `,
], ],
`/${buildVolumeFolder}`, `/${buildVolumeFolder}`,
@ -177,7 +178,6 @@ class RemoteBuilder {
apk add zip -q apk add zip -q
apk add tree -q apk add tree -q
cd "${this.libraryFolderFull}" cd "${this.libraryFolderFull}"
tree
zip -r "lib-${this.buildId}.zip" "${this.libraryFolderFull}" zip -r "lib-${this.buildId}.zip" "${this.libraryFolderFull}"
mv "lib-${this.buildId}.zip" "${cacheFolderFull}/lib" mv "lib-${this.buildId}.zip" "${cacheFolderFull}/lib"
cd "${this.projectPathFull}" cd "${this.projectPathFull}"
@ -199,7 +199,7 @@ class RemoteBuilder {
core.info('compression step complete'); core.info('compression step complete');
} }
private static async UploadArtifacts(branchName: string | undefined) { private static async UploadArtifacts() {
core.info('Starting step 4/4 upload build to s3'); core.info('Starting step 4/4 upload build to s3');
await this.RemoteBuilderProviderPlatform.runBuildTask( await this.RemoteBuilderProviderPlatform.runBuildTask(
this.buildId, this.buildId,
@ -208,7 +208,7 @@ class RemoteBuilder {
` `
aws s3 cp ${this.buildId}/build-${this.buildId}.zip s3://game-ci-storage/ aws s3 cp ${this.buildId}/build-${this.buildId}.zip s3://game-ci-storage/
# no need to upload Library cache for now # no need to upload Library cache for now
# aws s3 cp /${buildVolumeFolder}/${cacheFolder}/${branchName}/lib-${this.buildId}.zip s3://game-ci-storage/ # aws s3 cp "/${buildVolumeFolder}/${cacheFolder}/$branch/lib-${this.buildId}.zip" "s3://game-ci-storage/"
${this.SteamDeploy ? '#' : ''} rm -r ${this.buildId} ${this.SteamDeploy ? '#' : ''} rm -r ${this.buildId}
`, `,
], ],
@ -289,6 +289,11 @@ class RemoteBuilder {
EnvironmentVariable: 'GITHUB_TOKEN', EnvironmentVariable: 'GITHUB_TOKEN',
ParameterValue: this.buildParams.githubToken, ParameterValue: this.buildParams.githubToken,
}, },
{
ParameterKey: 'branch',
EnvironmentVariable: 'branch',
ParameterValue: this.branchName,
},
]; ];
} }