Refactoring, remote builder k8s and aws nearly aligned
parent
6dbb6e8ccb
commit
31c6bed1b4
|
|
@ -1284,6 +1284,8 @@ class Kubernetes {
|
||||||
}
|
}
|
||||||
runBuild(buildId, stackName, image, commands, mountdir, workingdir, environment, secrets) {
|
runBuild(buildId, stackName, image, commands, mountdir, workingdir, environment, secrets) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
try {
|
||||||
|
this.setUniqueBuildId();
|
||||||
const defaultSecretsArray = [
|
const defaultSecretsArray = [
|
||||||
{
|
{
|
||||||
ParameterKey: 'GithubToken',
|
ParameterKey: 'GithubToken',
|
||||||
|
|
@ -1312,16 +1314,26 @@ class Kubernetes {
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
defaultSecretsArray.push(...secrets);
|
defaultSecretsArray.push(...secrets);
|
||||||
try {
|
|
||||||
// setup
|
// setup
|
||||||
yield this.createSecret(defaultSecretsArray);
|
yield this.createSecret(defaultSecretsArray);
|
||||||
yield kubernetes_storage_1.default.createPersistentVolumeClaim(this.buildParameters, this.pvcName, this.kubeClient, this.namespace);
|
yield kubernetes_storage_1.default.createPersistentVolumeClaim(this.buildParameters, this.pvcName, this.kubeClient, this.namespace);
|
||||||
// run
|
//run
|
||||||
yield this.runJobInKubernetesPod(commands, image);
|
const jobSpec = this.getJobSpec(commands, image);
|
||||||
|
core.info('Creating build job');
|
||||||
|
yield this.kubeClientBatch.createNamespacedJob(this.namespace, jobSpec);
|
||||||
|
core.info('Job created');
|
||||||
|
yield kubernetes_storage_1.default.watchUntilPVCNotPending(this.kubeClient, this.pvcName, this.namespace);
|
||||||
|
core.info('PVC Bound');
|
||||||
|
this.setPodNameAndContainerName(yield this.findPod());
|
||||||
|
core.info('Watching pod until running');
|
||||||
|
yield this.watchUntilPodRunning();
|
||||||
|
core.info('Pod running, streaming logs');
|
||||||
|
yield this.streamLogs();
|
||||||
yield this.cleanup();
|
yield this.cleanup();
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
core.error(JSON.stringify(error.response, undefined, 4));
|
core.info('Running job failed');
|
||||||
|
yield this.cleanup();
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -1564,11 +1576,13 @@ class Kubernetes {
|
||||||
}
|
}
|
||||||
runCloneJob() {
|
runCloneJob() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
yield this.runJobInKubernetesPod([
|
yield this.runBuild(this.buildCorrelationId, '', 'alpine/git', [
|
||||||
'/bin/ash',
|
'/bin/ash',
|
||||||
'-c',
|
'-c',
|
||||||
`apk update;
|
`apk update;
|
||||||
|
apk add unzip;
|
||||||
apk add git-lfs;
|
apk add git-lfs;
|
||||||
|
apk add jq;
|
||||||
ls /credentials/
|
ls /credentials/
|
||||||
export GITHUB_TOKEN=$(cat /credentials/GITHUB_TOKEN);
|
export GITHUB_TOKEN=$(cat /credentials/GITHUB_TOKEN);
|
||||||
cd /data;
|
cd /data;
|
||||||
|
|
@ -1578,12 +1592,12 @@ class Kubernetes {
|
||||||
git checkout $GITHUB_SHA;
|
git checkout $GITHUB_SHA;
|
||||||
ls
|
ls
|
||||||
echo "end"`,
|
echo "end"`,
|
||||||
], 'alpine/git');
|
], '', '', [], []);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
runBuildJob() {
|
runBuildJob() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
yield this.runJobInKubernetesPod([
|
yield this.runBuild(this.buildCorrelationId, '', this.baseImage.toString(), [
|
||||||
'bin/bash',
|
'bin/bash',
|
||||||
'-c',
|
'-c',
|
||||||
`ls
|
`ls
|
||||||
|
|
@ -1598,7 +1612,7 @@ class Kubernetes {
|
||||||
chmod -R +x /steps
|
chmod -R +x /steps
|
||||||
/entrypoint.sh
|
/entrypoint.sh
|
||||||
`,
|
`,
|
||||||
], this.baseImage.toString());
|
], '', '', [], []);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
getPodStatusPhase() {
|
getPodStatusPhase() {
|
||||||
|
|
@ -1845,9 +1859,9 @@ const aws_build_platform_1 = __importDefault(__webpack_require__(70187));
|
||||||
const core = __importStar(__webpack_require__(42186));
|
const core = __importStar(__webpack_require__(42186));
|
||||||
const remote_builder_namespace_1 = __importDefault(__webpack_require__(96003));
|
const remote_builder_namespace_1 = __importDefault(__webpack_require__(96003));
|
||||||
const kubernetes_build_platform_1 = __importDefault(__webpack_require__(81730));
|
const kubernetes_build_platform_1 = __importDefault(__webpack_require__(81730));
|
||||||
const repositoryDirectoryName = 'repo';
|
const repositoryFolder = 'repo';
|
||||||
const efsDirectoryName = 'data';
|
const buildVolumeFolder = 'data';
|
||||||
const cacheDirectoryName = 'cache';
|
const cacheFolder = 'cache';
|
||||||
class RemoteBuilder {
|
class RemoteBuilder {
|
||||||
static build(buildParameters, baseImage) {
|
static build(buildParameters, baseImage) {
|
||||||
var _a;
|
var _a;
|
||||||
|
|
@ -1901,17 +1915,17 @@ class RemoteBuilder {
|
||||||
apk add git-lfs;
|
apk add git-lfs;
|
||||||
apk add jq;
|
apk add jq;
|
||||||
# Get source repo for project to be built and game-ci repo for utilties
|
# Get source repo for project to be built and game-ci repo for utilties
|
||||||
git clone https://${buildParameters.githubToken}@github.com/${process.env.GITHUB_REPOSITORY}.git ${buildUid}/${repositoryDirectoryName} -q
|
git clone https://${buildParameters.githubToken}@github.com/${process.env.GITHUB_REPOSITORY}.git ${buildUid}/${repositoryFolder} -q
|
||||||
git clone https://${buildParameters.githubToken}@github.com/game-ci/unity-builder.git ${buildUid}/builder -q
|
git clone https://${buildParameters.githubToken}@github.com/game-ci/unity-builder.git ${buildUid}/builder -q
|
||||||
git clone https://${buildParameters.githubToken}@github.com/game-ci/steam-deploy.git ${buildUid}/steam -q
|
git clone https://${buildParameters.githubToken}@github.com/game-ci/steam-deploy.git ${buildUid}/steam -q
|
||||||
cd /${efsDirectoryName}/${buildUid}/${repositoryDirectoryName}/
|
cd /${buildVolumeFolder}/${buildUid}/${repositoryFolder}/
|
||||||
git checkout $GITHUB_SHA
|
git checkout $GITHUB_SHA
|
||||||
cd /${efsDirectoryName}/
|
cd /${buildVolumeFolder}/
|
||||||
# Look for usable cache
|
# Look for usable cache
|
||||||
if [ ! -d ${cacheDirectoryName} ]; then
|
if [ ! -d ${cacheFolder} ]; then
|
||||||
mkdir ${cacheDirectoryName}
|
mkdir ${cacheFolder}
|
||||||
fi
|
fi
|
||||||
cd ${cacheDirectoryName}
|
cd ${cacheFolder}
|
||||||
if [ ! -d "${branchName}" ]; then
|
if [ ! -d "${branchName}" ]; then
|
||||||
mkdir "${branchName}"
|
mkdir "${branchName}"
|
||||||
fi
|
fi
|
||||||
|
|
@ -1920,8 +1934,8 @@ class RemoteBuilder {
|
||||||
echo "Cached Libraries for ${branchName} from previous builds:"
|
echo "Cached Libraries for ${branchName} from previous builds:"
|
||||||
ls
|
ls
|
||||||
echo ''
|
echo ''
|
||||||
ls "/${efsDirectoryName}/${buildUid}/${repositoryDirectoryName}/${buildParameters.projectPath}"
|
ls "/${buildVolumeFolder}/${buildUid}/${repositoryFolder}/${buildParameters.projectPath}"
|
||||||
libDir="/${efsDirectoryName}/${buildUid}/${repositoryDirectoryName}/${buildParameters.projectPath}/Library"
|
libDir="/${buildVolumeFolder}/${buildUid}/${repositoryFolder}/${buildParameters.projectPath}/Library"
|
||||||
if [ -d "$libDir" ]; then
|
if [ -d "$libDir" ]; then
|
||||||
rm -r "$libDir"
|
rm -r "$libDir"
|
||||||
echo "Setup .gitignore to ignore Library folder and remove it from builds"
|
echo "Setup .gitignore to ignore Library folder and remove it from builds"
|
||||||
|
|
@ -1942,16 +1956,16 @@ class RemoteBuilder {
|
||||||
# Print out important directories
|
# Print out important directories
|
||||||
echo ''
|
echo ''
|
||||||
echo 'Repo:'
|
echo 'Repo:'
|
||||||
ls /${efsDirectoryName}/${buildUid}/${repositoryDirectoryName}/
|
ls /${buildVolumeFolder}/${buildUid}/${repositoryFolder}/
|
||||||
echo ''
|
echo ''
|
||||||
echo 'Project:'
|
echo 'Project:'
|
||||||
ls /${efsDirectoryName}/${buildUid}/${repositoryDirectoryName}/${buildParameters.projectPath}
|
ls /${buildVolumeFolder}/${buildUid}/${repositoryFolder}/${buildParameters.projectPath}
|
||||||
echo ''
|
echo ''
|
||||||
echo 'Library:'
|
echo 'Library:'
|
||||||
ls /${efsDirectoryName}/${buildUid}/${repositoryDirectoryName}/${buildParameters.projectPath}/Library/
|
ls /${buildVolumeFolder}/${buildUid}/${repositoryFolder}/${buildParameters.projectPath}/Library/
|
||||||
echo ''
|
echo ''
|
||||||
`,
|
`,
|
||||||
], `/${efsDirectoryName}`, `/${efsDirectoryName}/`, [
|
], `/${buildVolumeFolder}`, `/${buildVolumeFolder}/`, [
|
||||||
{
|
{
|
||||||
name: 'GITHUB_SHA',
|
name: 'GITHUB_SHA',
|
||||||
value: process.env.GITHUB_SHA || '',
|
value: process.env.GITHUB_SHA || '',
|
||||||
|
|
@ -2009,14 +2023,14 @@ class RemoteBuilder {
|
||||||
yield this.RemoteBuilderProviderPlatform.runBuild(buildUid, buildParameters.awsStackName, baseImage.toString(), [
|
yield this.RemoteBuilderProviderPlatform.runBuild(buildUid, buildParameters.awsStackName, baseImage.toString(), [
|
||||||
'-c',
|
'-c',
|
||||||
`
|
`
|
||||||
cp -r /${efsDirectoryName}/${buildUid}/builder/dist/default-build-script/ /UnityBuilderAction;
|
cp -r /${buildVolumeFolder}/${buildUid}/builder/dist/default-build-script/ /UnityBuilderAction;
|
||||||
cp -r /${efsDirectoryName}/${buildUid}/builder/dist/entrypoint.sh /entrypoint.sh;
|
cp -r /${buildVolumeFolder}/${buildUid}/builder/dist/entrypoint.sh /entrypoint.sh;
|
||||||
cp -r /${efsDirectoryName}/${buildUid}/builder/dist/steps/ /steps;
|
cp -r /${buildVolumeFolder}/${buildUid}/builder/dist/steps/ /steps;
|
||||||
chmod -R +x /entrypoint.sh;
|
chmod -R +x /entrypoint.sh;
|
||||||
chmod -R +x /steps;
|
chmod -R +x /steps;
|
||||||
/entrypoint.sh;
|
/entrypoint.sh;
|
||||||
`,
|
`,
|
||||||
], `/${efsDirectoryName}`, `/${efsDirectoryName}/${buildUid}/${repositoryDirectoryName}/`, [
|
], `/${buildVolumeFolder}`, `/${buildVolumeFolder}/${buildUid}/${repositoryFolder}/`, [
|
||||||
{
|
{
|
||||||
name: 'ContainerMemory',
|
name: 'ContainerMemory',
|
||||||
value: buildParameters.remoteBuildMemory,
|
value: buildParameters.remoteBuildMemory,
|
||||||
|
|
@ -2027,7 +2041,7 @@ class RemoteBuilder {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'GITHUB_WORKSPACE',
|
name: 'GITHUB_WORKSPACE',
|
||||||
value: `/${efsDirectoryName}/${buildUid}/${repositoryDirectoryName}/`,
|
value: `/${buildVolumeFolder}/${buildUid}/${repositoryFolder}/`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'PROJECT_PATH',
|
name: 'PROJECT_PATH',
|
||||||
|
|
@ -2083,15 +2097,15 @@ class RemoteBuilder {
|
||||||
apk add zip
|
apk add zip
|
||||||
cd Library
|
cd Library
|
||||||
zip -r lib-${buildUid}.zip .*
|
zip -r lib-${buildUid}.zip .*
|
||||||
mv lib-${buildUid}.zip /${efsDirectoryName}/${cacheDirectoryName}/${branchName}/lib-${buildUid}.zip
|
mv lib-${buildUid}.zip /${buildVolumeFolder}/${cacheFolder}/${branchName}/lib-${buildUid}.zip
|
||||||
cd ../../
|
cd ../../
|
||||||
ls
|
ls
|
||||||
echo ' '
|
echo ' '
|
||||||
ls ${buildParameters.buildPath}
|
ls ${buildParameters.buildPath}
|
||||||
zip -r build-${buildUid}.zip ${buildParameters.buildPath}/*
|
zip -r build-${buildUid}.zip ${buildParameters.buildPath}/*
|
||||||
mv build-${buildUid}.zip /${efsDirectoryName}/${buildUid}/build-${buildUid}.zip
|
mv build-${buildUid}.zip /${buildVolumeFolder}/${buildUid}/build-${buildUid}.zip
|
||||||
`,
|
`,
|
||||||
], `/${efsDirectoryName}`, `/${efsDirectoryName}/${buildUid}/${repositoryDirectoryName}/${buildParameters.projectPath}`, [
|
], `/${buildVolumeFolder}`, `/${buildVolumeFolder}/${buildUid}/${repositoryFolder}/${buildParameters.projectPath}`, [
|
||||||
{
|
{
|
||||||
name: 'GITHUB_SHA',
|
name: 'GITHUB_SHA',
|
||||||
value: process.env.GITHUB_SHA || '',
|
value: process.env.GITHUB_SHA || '',
|
||||||
|
|
@ -2108,10 +2122,10 @@ class RemoteBuilder {
|
||||||
`
|
`
|
||||||
aws s3 cp ${buildUid}/build-${buildUid}.zip s3://game-ci-storage/
|
aws s3 cp ${buildUid}/build-${buildUid}.zip s3://game-ci-storage/
|
||||||
# no need to upload Library cache for now
|
# no need to upload Library cache for now
|
||||||
# aws s3 cp /${efsDirectoryName}/${cacheDirectoryName}/${branchName}/lib-${buildUid}.zip s3://game-ci-storage/
|
# aws s3 cp /${buildVolumeFolder}/${cacheFolder}/${branchName}/lib-${buildUid}.zip s3://game-ci-storage/
|
||||||
${this.SteamDeploy ? '#' : ''} rm -r ${buildUid}
|
${this.SteamDeploy ? '#' : ''} rm -r ${buildUid}
|
||||||
`,
|
`,
|
||||||
], `/${efsDirectoryName}`, `/${efsDirectoryName}/`, [
|
], `/${buildVolumeFolder}`, `/${buildVolumeFolder}/`, [
|
||||||
{
|
{
|
||||||
name: 'GITHUB_SHA',
|
name: 'GITHUB_SHA',
|
||||||
value: process.env.GITHUB_SHA || '',
|
value: process.env.GITHUB_SHA || '',
|
||||||
|
|
@ -2143,14 +2157,14 @@ class RemoteBuilder {
|
||||||
`
|
`
|
||||||
ls
|
ls
|
||||||
ls /
|
ls /
|
||||||
cp -r /${efsDirectoryName}/${buildUid}/steam/action/entrypoint.sh /entrypoint.sh;
|
cp -r /${buildVolumeFolder}/${buildUid}/steam/action/entrypoint.sh /entrypoint.sh;
|
||||||
cp -r /${efsDirectoryName}/${buildUid}/steam/action/steps/ /steps;
|
cp -r /${buildVolumeFolder}/${buildUid}/steam/action/steps/ /steps;
|
||||||
chmod -R +x /entrypoint.sh;
|
chmod -R +x /entrypoint.sh;
|
||||||
chmod -R +x /steps;
|
chmod -R +x /steps;
|
||||||
/entrypoint.sh;
|
/entrypoint.sh;
|
||||||
rm -r /${efsDirectoryName}/${buildUid}
|
rm -r /${buildVolumeFolder}/${buildUid}
|
||||||
`,
|
`,
|
||||||
], `/${efsDirectoryName}`, `/${efsDirectoryName}/${buildUid}/steam/action/`, [
|
], `/${buildVolumeFolder}`, `/${buildVolumeFolder}/${buildUid}/steam/action/`, [
|
||||||
{
|
{
|
||||||
name: 'GITHUB_SHA',
|
name: 'GITHUB_SHA',
|
||||||
value: process.env.GITHUB_SHA || '',
|
value: process.env.GITHUB_SHA || '',
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -53,6 +53,8 @@ class Kubernetes implements RemoteBuilderProviderInterface {
|
||||||
environment: RemoteBuilderEnvironmentVariable[],
|
environment: RemoteBuilderEnvironmentVariable[],
|
||||||
secrets: RemoteBuilderSecret[],
|
secrets: RemoteBuilderSecret[],
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
try {
|
||||||
|
this.setUniqueBuildId();
|
||||||
const defaultSecretsArray: RemoteBuilderSecret[] = [
|
const defaultSecretsArray: RemoteBuilderSecret[] = [
|
||||||
{
|
{
|
||||||
ParameterKey: 'GithubToken',
|
ParameterKey: 'GithubToken',
|
||||||
|
|
@ -81,7 +83,6 @@ class Kubernetes implements RemoteBuilderProviderInterface {
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
defaultSecretsArray.push(...secrets);
|
defaultSecretsArray.push(...secrets);
|
||||||
try {
|
|
||||||
// setup
|
// setup
|
||||||
await this.createSecret(defaultSecretsArray);
|
await this.createSecret(defaultSecretsArray);
|
||||||
await KubernetesStorage.createPersistentVolumeClaim(
|
await KubernetesStorage.createPersistentVolumeClaim(
|
||||||
|
|
@ -91,12 +92,22 @@ class Kubernetes implements RemoteBuilderProviderInterface {
|
||||||
this.namespace,
|
this.namespace,
|
||||||
);
|
);
|
||||||
|
|
||||||
// run
|
//run
|
||||||
await this.runJobInKubernetesPod(commands, image);
|
const jobSpec = this.getJobSpec(commands, image);
|
||||||
|
core.info('Creating build job');
|
||||||
|
await this.kubeClientBatch.createNamespacedJob(this.namespace, jobSpec);
|
||||||
|
core.info('Job created');
|
||||||
|
await KubernetesStorage.watchUntilPVCNotPending(this.kubeClient, this.pvcName, this.namespace);
|
||||||
|
core.info('PVC Bound');
|
||||||
|
this.setPodNameAndContainerName(await this.findPod());
|
||||||
|
core.info('Watching pod until running');
|
||||||
|
await this.watchUntilPodRunning();
|
||||||
|
core.info('Pod running, streaming logs');
|
||||||
|
await this.streamLogs();
|
||||||
await this.cleanup();
|
await this.cleanup();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.error(JSON.stringify(error.response, undefined, 4));
|
core.info('Running job failed');
|
||||||
|
await this.cleanup();
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -344,12 +355,17 @@ class Kubernetes implements RemoteBuilderProviderInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
async runCloneJob() {
|
async runCloneJob() {
|
||||||
await this.runJobInKubernetesPod(
|
await this.runBuild(
|
||||||
|
this.buildCorrelationId,
|
||||||
|
'',
|
||||||
|
'alpine/git',
|
||||||
[
|
[
|
||||||
'/bin/ash',
|
'/bin/ash',
|
||||||
'-c',
|
'-c',
|
||||||
`apk update;
|
`apk update;
|
||||||
|
apk add unzip;
|
||||||
apk add git-lfs;
|
apk add git-lfs;
|
||||||
|
apk add jq;
|
||||||
ls /credentials/
|
ls /credentials/
|
||||||
export GITHUB_TOKEN=$(cat /credentials/GITHUB_TOKEN);
|
export GITHUB_TOKEN=$(cat /credentials/GITHUB_TOKEN);
|
||||||
cd /data;
|
cd /data;
|
||||||
|
|
@ -360,12 +376,18 @@ class Kubernetes implements RemoteBuilderProviderInterface {
|
||||||
ls
|
ls
|
||||||
echo "end"`,
|
echo "end"`,
|
||||||
],
|
],
|
||||||
'alpine/git',
|
'',
|
||||||
|
'',
|
||||||
|
[],
|
||||||
|
[],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async runBuildJob() {
|
async runBuildJob() {
|
||||||
await this.runJobInKubernetesPod(
|
await this.runBuild(
|
||||||
|
this.buildCorrelationId,
|
||||||
|
'',
|
||||||
|
this.baseImage.toString(),
|
||||||
[
|
[
|
||||||
'bin/bash',
|
'bin/bash',
|
||||||
'-c',
|
'-c',
|
||||||
|
|
@ -382,7 +404,10 @@ class Kubernetes implements RemoteBuilderProviderInterface {
|
||||||
/entrypoint.sh
|
/entrypoint.sh
|
||||||
`,
|
`,
|
||||||
],
|
],
|
||||||
this.baseImage.toString(),
|
'',
|
||||||
|
'',
|
||||||
|
[],
|
||||||
|
[],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,9 @@ import RemoteBuilderNamespace from './remote-builder-namespace';
|
||||||
import RemoteBuilderSecret from './remote-builder-secret';
|
import RemoteBuilderSecret from './remote-builder-secret';
|
||||||
import { RemoteBuilderProviderInterface } from './remote-builder-provider-interface';
|
import { RemoteBuilderProviderInterface } from './remote-builder-provider-interface';
|
||||||
import Kubernetes from './kubernetes-build-platform';
|
import Kubernetes from './kubernetes-build-platform';
|
||||||
const repositoryDirectoryName = 'repo';
|
const repositoryFolder = 'repo';
|
||||||
const efsDirectoryName = 'data';
|
const buildVolumeFolder = 'data';
|
||||||
const cacheDirectoryName = 'cache';
|
const cacheFolder = 'cache';
|
||||||
|
|
||||||
class RemoteBuilder {
|
class RemoteBuilder {
|
||||||
static SteamDeploy: boolean = false;
|
static SteamDeploy: boolean = false;
|
||||||
|
|
@ -78,17 +78,17 @@ class RemoteBuilder {
|
||||||
# Get source repo for project to be built and game-ci repo for utilties
|
# Get source repo for project to be built and game-ci repo for utilties
|
||||||
git clone https://${buildParameters.githubToken}@github.com/${
|
git clone https://${buildParameters.githubToken}@github.com/${
|
||||||
process.env.GITHUB_REPOSITORY
|
process.env.GITHUB_REPOSITORY
|
||||||
}.git ${buildUid}/${repositoryDirectoryName} -q
|
}.git ${buildUid}/${repositoryFolder} -q
|
||||||
git clone https://${buildParameters.githubToken}@github.com/game-ci/unity-builder.git ${buildUid}/builder -q
|
git clone https://${buildParameters.githubToken}@github.com/game-ci/unity-builder.git ${buildUid}/builder -q
|
||||||
git clone https://${buildParameters.githubToken}@github.com/game-ci/steam-deploy.git ${buildUid}/steam -q
|
git clone https://${buildParameters.githubToken}@github.com/game-ci/steam-deploy.git ${buildUid}/steam -q
|
||||||
cd /${efsDirectoryName}/${buildUid}/${repositoryDirectoryName}/
|
cd /${buildVolumeFolder}/${buildUid}/${repositoryFolder}/
|
||||||
git checkout $GITHUB_SHA
|
git checkout $GITHUB_SHA
|
||||||
cd /${efsDirectoryName}/
|
cd /${buildVolumeFolder}/
|
||||||
# Look for usable cache
|
# Look for usable cache
|
||||||
if [ ! -d ${cacheDirectoryName} ]; then
|
if [ ! -d ${cacheFolder} ]; then
|
||||||
mkdir ${cacheDirectoryName}
|
mkdir ${cacheFolder}
|
||||||
fi
|
fi
|
||||||
cd ${cacheDirectoryName}
|
cd ${cacheFolder}
|
||||||
if [ ! -d "${branchName}" ]; then
|
if [ ! -d "${branchName}" ]; then
|
||||||
mkdir "${branchName}"
|
mkdir "${branchName}"
|
||||||
fi
|
fi
|
||||||
|
|
@ -97,8 +97,8 @@ class RemoteBuilder {
|
||||||
echo "Cached Libraries for ${branchName} from previous builds:"
|
echo "Cached Libraries for ${branchName} from previous builds:"
|
||||||
ls
|
ls
|
||||||
echo ''
|
echo ''
|
||||||
ls "/${efsDirectoryName}/${buildUid}/${repositoryDirectoryName}/${buildParameters.projectPath}"
|
ls "/${buildVolumeFolder}/${buildUid}/${repositoryFolder}/${buildParameters.projectPath}"
|
||||||
libDir="/${efsDirectoryName}/${buildUid}/${repositoryDirectoryName}/${buildParameters.projectPath}/Library"
|
libDir="/${buildVolumeFolder}/${buildUid}/${repositoryFolder}/${buildParameters.projectPath}/Library"
|
||||||
if [ -d "$libDir" ]; then
|
if [ -d "$libDir" ]; then
|
||||||
rm -r "$libDir"
|
rm -r "$libDir"
|
||||||
echo "Setup .gitignore to ignore Library folder and remove it from builds"
|
echo "Setup .gitignore to ignore Library folder and remove it from builds"
|
||||||
|
|
@ -119,18 +119,18 @@ class RemoteBuilder {
|
||||||
# Print out important directories
|
# Print out important directories
|
||||||
echo ''
|
echo ''
|
||||||
echo 'Repo:'
|
echo 'Repo:'
|
||||||
ls /${efsDirectoryName}/${buildUid}/${repositoryDirectoryName}/
|
ls /${buildVolumeFolder}/${buildUid}/${repositoryFolder}/
|
||||||
echo ''
|
echo ''
|
||||||
echo 'Project:'
|
echo 'Project:'
|
||||||
ls /${efsDirectoryName}/${buildUid}/${repositoryDirectoryName}/${buildParameters.projectPath}
|
ls /${buildVolumeFolder}/${buildUid}/${repositoryFolder}/${buildParameters.projectPath}
|
||||||
echo ''
|
echo ''
|
||||||
echo 'Library:'
|
echo 'Library:'
|
||||||
ls /${efsDirectoryName}/${buildUid}/${repositoryDirectoryName}/${buildParameters.projectPath}/Library/
|
ls /${buildVolumeFolder}/${buildUid}/${repositoryFolder}/${buildParameters.projectPath}/Library/
|
||||||
echo ''
|
echo ''
|
||||||
`,
|
`,
|
||||||
],
|
],
|
||||||
`/${efsDirectoryName}`,
|
`/${buildVolumeFolder}`,
|
||||||
`/${efsDirectoryName}/`,
|
`/${buildVolumeFolder}/`,
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
name: 'GITHUB_SHA',
|
name: 'GITHUB_SHA',
|
||||||
|
|
@ -207,16 +207,16 @@ class RemoteBuilder {
|
||||||
[
|
[
|
||||||
'-c',
|
'-c',
|
||||||
`
|
`
|
||||||
cp -r /${efsDirectoryName}/${buildUid}/builder/dist/default-build-script/ /UnityBuilderAction;
|
cp -r /${buildVolumeFolder}/${buildUid}/builder/dist/default-build-script/ /UnityBuilderAction;
|
||||||
cp -r /${efsDirectoryName}/${buildUid}/builder/dist/entrypoint.sh /entrypoint.sh;
|
cp -r /${buildVolumeFolder}/${buildUid}/builder/dist/entrypoint.sh /entrypoint.sh;
|
||||||
cp -r /${efsDirectoryName}/${buildUid}/builder/dist/steps/ /steps;
|
cp -r /${buildVolumeFolder}/${buildUid}/builder/dist/steps/ /steps;
|
||||||
chmod -R +x /entrypoint.sh;
|
chmod -R +x /entrypoint.sh;
|
||||||
chmod -R +x /steps;
|
chmod -R +x /steps;
|
||||||
/entrypoint.sh;
|
/entrypoint.sh;
|
||||||
`,
|
`,
|
||||||
],
|
],
|
||||||
`/${efsDirectoryName}`,
|
`/${buildVolumeFolder}`,
|
||||||
`/${efsDirectoryName}/${buildUid}/${repositoryDirectoryName}/`,
|
`/${buildVolumeFolder}/${buildUid}/${repositoryFolder}/`,
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
name: 'ContainerMemory',
|
name: 'ContainerMemory',
|
||||||
|
|
@ -228,7 +228,7 @@ class RemoteBuilder {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'GITHUB_WORKSPACE',
|
name: 'GITHUB_WORKSPACE',
|
||||||
value: `/${efsDirectoryName}/${buildUid}/${repositoryDirectoryName}/`,
|
value: `/${buildVolumeFolder}/${buildUid}/${repositoryFolder}/`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'PROJECT_PATH',
|
name: 'PROJECT_PATH',
|
||||||
|
|
@ -294,17 +294,17 @@ class RemoteBuilder {
|
||||||
apk add zip
|
apk add zip
|
||||||
cd Library
|
cd Library
|
||||||
zip -r lib-${buildUid}.zip .*
|
zip -r lib-${buildUid}.zip .*
|
||||||
mv lib-${buildUid}.zip /${efsDirectoryName}/${cacheDirectoryName}/${branchName}/lib-${buildUid}.zip
|
mv lib-${buildUid}.zip /${buildVolumeFolder}/${cacheFolder}/${branchName}/lib-${buildUid}.zip
|
||||||
cd ../../
|
cd ../../
|
||||||
ls
|
ls
|
||||||
echo ' '
|
echo ' '
|
||||||
ls ${buildParameters.buildPath}
|
ls ${buildParameters.buildPath}
|
||||||
zip -r build-${buildUid}.zip ${buildParameters.buildPath}/*
|
zip -r build-${buildUid}.zip ${buildParameters.buildPath}/*
|
||||||
mv build-${buildUid}.zip /${efsDirectoryName}/${buildUid}/build-${buildUid}.zip
|
mv build-${buildUid}.zip /${buildVolumeFolder}/${buildUid}/build-${buildUid}.zip
|
||||||
`,
|
`,
|
||||||
],
|
],
|
||||||
`/${efsDirectoryName}`,
|
`/${buildVolumeFolder}`,
|
||||||
`/${efsDirectoryName}/${buildUid}/${repositoryDirectoryName}/${buildParameters.projectPath}`,
|
`/${buildVolumeFolder}/${buildUid}/${repositoryFolder}/${buildParameters.projectPath}`,
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
name: 'GITHUB_SHA',
|
name: 'GITHUB_SHA',
|
||||||
|
|
@ -332,12 +332,12 @@ class RemoteBuilder {
|
||||||
`
|
`
|
||||||
aws s3 cp ${buildUid}/build-${buildUid}.zip s3://game-ci-storage/
|
aws s3 cp ${buildUid}/build-${buildUid}.zip s3://game-ci-storage/
|
||||||
# no need to upload Library cache for now
|
# no need to upload Library cache for now
|
||||||
# aws s3 cp /${efsDirectoryName}/${cacheDirectoryName}/${branchName}/lib-${buildUid}.zip s3://game-ci-storage/
|
# aws s3 cp /${buildVolumeFolder}/${cacheFolder}/${branchName}/lib-${buildUid}.zip s3://game-ci-storage/
|
||||||
${this.SteamDeploy ? '#' : ''} rm -r ${buildUid}
|
${this.SteamDeploy ? '#' : ''} rm -r ${buildUid}
|
||||||
`,
|
`,
|
||||||
],
|
],
|
||||||
`/${efsDirectoryName}`,
|
`/${buildVolumeFolder}`,
|
||||||
`/${efsDirectoryName}/`,
|
`/${buildVolumeFolder}/`,
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
name: 'GITHUB_SHA',
|
name: 'GITHUB_SHA',
|
||||||
|
|
@ -379,16 +379,16 @@ class RemoteBuilder {
|
||||||
`
|
`
|
||||||
ls
|
ls
|
||||||
ls /
|
ls /
|
||||||
cp -r /${efsDirectoryName}/${buildUid}/steam/action/entrypoint.sh /entrypoint.sh;
|
cp -r /${buildVolumeFolder}/${buildUid}/steam/action/entrypoint.sh /entrypoint.sh;
|
||||||
cp -r /${efsDirectoryName}/${buildUid}/steam/action/steps/ /steps;
|
cp -r /${buildVolumeFolder}/${buildUid}/steam/action/steps/ /steps;
|
||||||
chmod -R +x /entrypoint.sh;
|
chmod -R +x /entrypoint.sh;
|
||||||
chmod -R +x /steps;
|
chmod -R +x /steps;
|
||||||
/entrypoint.sh;
|
/entrypoint.sh;
|
||||||
rm -r /${efsDirectoryName}/${buildUid}
|
rm -r /${buildVolumeFolder}/${buildUid}
|
||||||
`,
|
`,
|
||||||
],
|
],
|
||||||
`/${efsDirectoryName}`,
|
`/${buildVolumeFolder}`,
|
||||||
`/${efsDirectoryName}/${buildUid}/steam/action/`,
|
`/${buildVolumeFolder}/${buildUid}/steam/action/`,
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
name: 'GITHUB_SHA',
|
name: 'GITHUB_SHA',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue