Refmoving deploy to steam and upload to s3 as remote builder step
parent
c80b47473b
commit
adc14cfd72
|
|
@ -921,12 +921,21 @@ class AWSBuildEnvironment {
|
|||
const ECS = new SDK.ECS();
|
||||
const CF = new SDK.CloudFormation();
|
||||
const entrypoint = ['/bin/sh'];
|
||||
const t0 = Date.now();
|
||||
const taskDef = yield this.setupCloudFormations(CF, buildId, image, entrypoint, commands, mountdir, workingdir, secrets);
|
||||
let t2;
|
||||
try {
|
||||
const t1 = Date.now();
|
||||
core.info(`Setup job time: ${Math.floor((t0 - t1) / 1000)}`);
|
||||
yield aws_build_runner_1.default.runTask(taskDef, ECS, CF, environment, buildId, commands);
|
||||
t2 = Date.now();
|
||||
core.info(`Run job time: ${Math.floor((t1 - t2) / 1000)}`);
|
||||
}
|
||||
finally {
|
||||
yield this.cleanupResources(CF, taskDef);
|
||||
const t3 = Date.now();
|
||||
if (t2 !== undefined)
|
||||
core.info(`Cleanup job time: ${Math.floor((t2 - t3) / 1000)}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -1428,7 +1437,7 @@ class Kubernetes {
|
|||
defaultSecretsArray) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
this.pvcName = `unity-builder-pvc-${buildGuid}`;
|
||||
this.pvcName = `unity-builder-pvc`;
|
||||
this.cleanupCronJobName = `unity-builder-cronjob-${buildGuid}`;
|
||||
this.serviceAccountName = `service-account-${buildGuid}`;
|
||||
yield kubernetes_storage_1.default.createPersistentVolumeClaim(buildParameters, this.pvcName, this.kubeClient, this.namespace);
|
||||
|
|
@ -2231,6 +2240,7 @@ class RemoteBuilder {
|
|||
yield RemoteBuilder.BuildStep(baseImage);
|
||||
const t3 = Date.now();
|
||||
core.info(`Build time: ${Math.floor((t3 - t2) / 1000)}`);
|
||||
yield RemoteBuilder.CompressionStep();
|
||||
core.info(`Post build steps ${this.buildParams.postBuildSteps}`);
|
||||
this.buildParams.postBuildSteps = yaml_1.default.parse(this.buildParams.postBuildSteps);
|
||||
core.info(`Post build steps ${JSON.stringify(this.buildParams.postBuildSteps, undefined, 4)}`);
|
||||
|
|
@ -2250,10 +2260,6 @@ class RemoteBuilder {
|
|||
},
|
||||
], [...this.defaultSecrets, ...stepSecrets]);
|
||||
}
|
||||
yield RemoteBuilder.CompressionStep();
|
||||
yield RemoteBuilder.UploadArtifacts();
|
||||
if (this.SteamDeploy)
|
||||
yield RemoteBuilder.DeployToSteam();
|
||||
yield this.RemoteBuilderProviderPlatform.cleanupSharedBuildResources(this.buildGuid, this.buildParams, this.branchName, this.defaultSecrets);
|
||||
}
|
||||
catch (error) {
|
||||
|
|
@ -2371,41 +2377,6 @@ class RemoteBuilder {
|
|||
core.info('compression step complete');
|
||||
});
|
||||
}
|
||||
static UploadArtifacts() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
core.info('Starting step 4/4 upload build to s3');
|
||||
yield this.RemoteBuilderProviderPlatform.runBuildTask(this.buildGuid, 'amazon/aws-cli', [
|
||||
`
|
||||
aws s3 cp ${this.buildGuid}/build-${this.buildGuid}.zip "s3://${this.buildParams.awsBaseStackName}-storage/"
|
||||
# no need to upload Library cache for now
|
||||
# aws s3 cp "/${buildVolumeFolder}/${cacheFolder}/$branch/lib-${this.buildGuid}.zip" "s3://${this.buildParams.awsBaseStackName}-storage/"
|
||||
${this.SteamDeploy ? '#' : ''} rm -r ${this.buildGuid}
|
||||
`,
|
||||
], `/${buildVolumeFolder}`, `/${buildVolumeFolder}/`, RemoteBuilder.readUploadArtifactEnvironmentVariables(), RemoteBuilder.readUploadArtifactsSecrets());
|
||||
});
|
||||
}
|
||||
static DeployToSteam() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
core.info('Starting steam deployment');
|
||||
yield this.RemoteBuilderProviderPlatform.runBuildTask(this.buildGuid, 'cm2network/steamcmd:root', [
|
||||
`
|
||||
ls
|
||||
ls /
|
||||
cp -r /${buildVolumeFolder}/${this.buildGuid}/steam/action/entrypoint.sh /entrypoint.sh;
|
||||
cp -r /${buildVolumeFolder}/${this.buildGuid}/steam/action/steps/ /steps;
|
||||
chmod -R +x /entrypoint.sh;
|
||||
chmod -R +x /steps;
|
||||
/entrypoint.sh;
|
||||
rm -r /${buildVolumeFolder}/${this.buildGuid}
|
||||
`,
|
||||
], `/${buildVolumeFolder}`, `/${buildVolumeFolder}/${this.buildGuid}/steam/action/`, [
|
||||
{
|
||||
name: 'GITHUB_SHA',
|
||||
value: process.env.GITHUB_SHA || '',
|
||||
},
|
||||
], RemoteBuilder.readDeployToSteamSecrets());
|
||||
});
|
||||
}
|
||||
static setupBuildPlatform() {
|
||||
switch (this.buildParams.remoteBuildCluster) {
|
||||
case 'aws':
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -50,7 +50,7 @@ class AWSBuildEnvironment implements RemoteBuilderProviderInterface {
|
|||
const ECS = new SDK.ECS();
|
||||
const CF = new SDK.CloudFormation();
|
||||
const entrypoint = ['/bin/sh'];
|
||||
|
||||
const t0 = Date.now();
|
||||
const taskDef = await this.setupCloudFormations(
|
||||
CF,
|
||||
buildId,
|
||||
|
|
@ -61,10 +61,18 @@ class AWSBuildEnvironment implements RemoteBuilderProviderInterface {
|
|||
workingdir,
|
||||
secrets,
|
||||
);
|
||||
|
||||
let t2;
|
||||
try {
|
||||
const t1 = Date.now();
|
||||
core.info(`Setup job time: ${Math.floor((t0 - t1) / 1000)}`);
|
||||
await AWSBuildRunner.runTask(taskDef, ECS, CF, environment, buildId, commands);
|
||||
t2 = Date.now();
|
||||
core.info(`Run job time: ${Math.floor((t1 - t2) / 1000)}`);
|
||||
} finally {
|
||||
await this.cleanupResources(CF, taskDef);
|
||||
const t3 = Date.now();
|
||||
if (t2 !== undefined) core.info(`Cleanup job time: ${Math.floor((t2 - t3) / 1000)}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class Kubernetes implements RemoteBuilderProviderInterface {
|
|||
defaultSecretsArray: { ParameterKey: string; EnvironmentVariable: string; ParameterValue: string }[],
|
||||
) {
|
||||
try {
|
||||
this.pvcName = `unity-builder-pvc-${buildGuid}`;
|
||||
this.pvcName = `unity-builder-pvc`;
|
||||
this.cleanupCronJobName = `unity-builder-cronjob-${buildGuid}`;
|
||||
this.serviceAccountName = `service-account-${buildGuid}`;
|
||||
await KubernetesStorage.createPersistentVolumeClaim(
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ class RemoteBuilder {
|
|||
await RemoteBuilder.BuildStep(baseImage);
|
||||
const t3 = Date.now();
|
||||
core.info(`Build time: ${Math.floor((t3 - t2) / 1000)}`);
|
||||
await RemoteBuilder.CompressionStep();
|
||||
core.info(`Post build steps ${this.buildParams.postBuildSteps}`);
|
||||
this.buildParams.postBuildSteps = YAML.parse(this.buildParams.postBuildSteps);
|
||||
core.info(`Post build steps ${JSON.stringify(this.buildParams.postBuildSteps, undefined, 4)}`);
|
||||
|
|
@ -84,9 +85,6 @@ class RemoteBuilder {
|
|||
[...this.defaultSecrets, ...stepSecrets],
|
||||
);
|
||||
}
|
||||
await RemoteBuilder.CompressionStep();
|
||||
await RemoteBuilder.UploadArtifacts();
|
||||
if (this.SteamDeploy) await RemoteBuilder.DeployToSteam();
|
||||
await this.RemoteBuilderProviderPlatform.cleanupSharedBuildResources(
|
||||
this.buildGuid,
|
||||
this.buildParams,
|
||||
|
|
@ -233,57 +231,6 @@ class RemoteBuilder {
|
|||
core.info('compression step complete');
|
||||
}
|
||||
|
||||
private static async UploadArtifacts() {
|
||||
core.info('Starting step 4/4 upload build to s3');
|
||||
await this.RemoteBuilderProviderPlatform.runBuildTask(
|
||||
this.buildGuid,
|
||||
'amazon/aws-cli',
|
||||
[
|
||||
`
|
||||
aws s3 cp ${this.buildGuid}/build-${this.buildGuid}.zip "s3://${this.buildParams.awsBaseStackName}-storage/"
|
||||
# no need to upload Library cache for now
|
||||
# aws s3 cp "/${buildVolumeFolder}/${cacheFolder}/$branch/lib-${this.buildGuid}.zip" "s3://${
|
||||
this.buildParams.awsBaseStackName
|
||||
}-storage/"
|
||||
${this.SteamDeploy ? '#' : ''} rm -r ${this.buildGuid}
|
||||
`,
|
||||
],
|
||||
`/${buildVolumeFolder}`,
|
||||
`/${buildVolumeFolder}/`,
|
||||
RemoteBuilder.readUploadArtifactEnvironmentVariables(),
|
||||
RemoteBuilder.readUploadArtifactsSecrets(),
|
||||
);
|
||||
}
|
||||
|
||||
private static async DeployToSteam() {
|
||||
core.info('Starting steam deployment');
|
||||
await this.RemoteBuilderProviderPlatform.runBuildTask(
|
||||
this.buildGuid,
|
||||
'cm2network/steamcmd:root',
|
||||
[
|
||||
`
|
||||
ls
|
||||
ls /
|
||||
cp -r /${buildVolumeFolder}/${this.buildGuid}/steam/action/entrypoint.sh /entrypoint.sh;
|
||||
cp -r /${buildVolumeFolder}/${this.buildGuid}/steam/action/steps/ /steps;
|
||||
chmod -R +x /entrypoint.sh;
|
||||
chmod -R +x /steps;
|
||||
/entrypoint.sh;
|
||||
rm -r /${buildVolumeFolder}/${this.buildGuid}
|
||||
`,
|
||||
],
|
||||
`/${buildVolumeFolder}`,
|
||||
`/${buildVolumeFolder}/${this.buildGuid}/steam/action/`,
|
||||
[
|
||||
{
|
||||
name: 'GITHUB_SHA',
|
||||
value: process.env.GITHUB_SHA || '',
|
||||
},
|
||||
],
|
||||
RemoteBuilder.readDeployToSteamSecrets(),
|
||||
);
|
||||
}
|
||||
|
||||
private static setupBuildPlatform() {
|
||||
switch (this.buildParams.remoteBuildCluster) {
|
||||
case 'aws':
|
||||
|
|
|
|||
Loading…
Reference in New Issue