cleanup
parent
378c58b267
commit
cca4e12d15
|
|
@ -284,7 +284,7 @@ class AWS {
|
||||||
ParameterKey: 'GithubToken',
|
ParameterKey: 'GithubToken',
|
||||||
ParameterValue: buildParameters.githubToken,
|
ParameterValue: buildParameters.githubToken,
|
||||||
},
|
},
|
||||||
]);
|
], buildParameters.platform);
|
||||||
core.info('Starting part 2/4 (build unity project)');
|
core.info('Starting part 2/4 (build unity project)');
|
||||||
yield this.run(buildUid, buildParameters.awsStackName, baseImage.toString(), ['/bin/sh'], [
|
yield this.run(buildUid, buildParameters.awsStackName, baseImage.toString(), ['/bin/sh'], [
|
||||||
'-c',
|
'-c',
|
||||||
|
|
@ -376,7 +376,7 @@ class AWS {
|
||||||
ParameterKey: 'AndroidKeyAliasPass',
|
ParameterKey: 'AndroidKeyAliasPass',
|
||||||
ParameterValue: buildParameters.androidKeyaliasPass ? buildParameters.androidKeyaliasPass : '0',
|
ParameterValue: buildParameters.androidKeyaliasPass ? buildParameters.androidKeyaliasPass : '0',
|
||||||
},
|
},
|
||||||
]);
|
], buildParameters.platform);
|
||||||
core.info('Starting part 3/4 (zip unity build and Library for caching)');
|
core.info('Starting part 3/4 (zip unity build and Library for caching)');
|
||||||
// Cleanup
|
// Cleanup
|
||||||
yield this.run(buildUid, buildParameters.awsStackName, 'alpine', ['/bin/sh'], [
|
yield this.run(buildUid, buildParameters.awsStackName, 'alpine', ['/bin/sh'], [
|
||||||
|
|
@ -400,7 +400,7 @@ class AWS {
|
||||||
ParameterKey: 'GithubToken',
|
ParameterKey: 'GithubToken',
|
||||||
ParameterValue: buildParameters.githubToken,
|
ParameterValue: buildParameters.githubToken,
|
||||||
},
|
},
|
||||||
]);
|
], buildParameters.platform);
|
||||||
core.info('Starting part 4/4 (upload build to s3)');
|
core.info('Starting part 4/4 (upload build to s3)');
|
||||||
yield this.run(buildUid, buildParameters.awsStackName, 'amazon/aws-cli', ['/bin/sh'], [
|
yield this.run(buildUid, buildParameters.awsStackName, 'amazon/aws-cli', ['/bin/sh'], [
|
||||||
'-c',
|
'-c',
|
||||||
|
|
@ -431,7 +431,7 @@ class AWS {
|
||||||
ParameterKey: 'AWSSecretAccessKey',
|
ParameterKey: 'AWSSecretAccessKey',
|
||||||
ParameterValue: process.env.AWS_SECRET_ACCESS_KEY,
|
ParameterValue: process.env.AWS_SECRET_ACCESS_KEY,
|
||||||
},
|
},
|
||||||
]);
|
], buildParameters.platform);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
core.setFailed(error);
|
core.setFailed(error);
|
||||||
|
|
@ -439,20 +439,20 @@ class AWS {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
static run(buildUid, stackName, image, entrypoint, commands, mountdir, workingdir, environment, secrets) {
|
static run(buildUid, stackName, image, entrypoint, commands, mountdir, workingdir, environment, secrets, platform) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const ECS = new SDK.ECS();
|
const ECS = new SDK.ECS();
|
||||||
const CF = new SDK.CloudFormation();
|
const CF = new SDK.CloudFormation();
|
||||||
const taskDef = yield this.setupCloudFormations(CF, buildUid, stackName, image, entrypoint, commands, mountdir, workingdir, secrets);
|
const taskDef = yield this.setupCloudFormations(CF, buildUid, stackName, image, entrypoint, commands, mountdir, workingdir, secrets, platform);
|
||||||
yield this.runTask(taskDef, ECS, CF, environment, buildUid);
|
yield this.runTask(taskDef, ECS, CF, environment, buildUid);
|
||||||
yield this.cleanupResources(CF, taskDef);
|
yield this.cleanupResources(CF, taskDef);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
static setupCloudFormations(CF, buildUid, stackName, image, entrypoint, commands, mountdir, workingdir, secrets) {
|
static setupCloudFormations(CF, buildUid, stackName, image, entrypoint, commands, mountdir, workingdir, secrets, platform) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const imageStackName = image.replace(/[^\da-z]/gi, '');
|
const imageStackName = image.replace(/[^\da-z]/gi, '');
|
||||||
const buildUidStackName = buildUid.replace(/[^\da-z]/gi, '');
|
const buildUidStackName = buildUid.replace(/[^\da-z]/gi, '');
|
||||||
const taskDefStackName = `${stackName}-${imageStackName}-${buildUidStackName}-build`;
|
const taskDefStackName = `${stackName}-${platform}-${buildUidStackName}-build`;
|
||||||
const taskDefCloudFormation = fs.readFileSync(`${__dirname}/task-def-formation.yml`, 'utf8');
|
const taskDefCloudFormation = fs.readFileSync(`${__dirname}/task-def-formation.yml`, 'utf8');
|
||||||
yield CF.createStack({
|
yield CF.createStack({
|
||||||
StackName: taskDefStackName,
|
StackName: taskDefStackName,
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -3,6 +3,7 @@ import { nanoid } from 'nanoid';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as zlib from 'zlib';
|
import * as zlib from 'zlib';
|
||||||
|
import { BuildParameters } from '.';
|
||||||
|
|
||||||
class AWS {
|
class AWS {
|
||||||
static async runBuildJob(buildParameters, baseImage) {
|
static async runBuildJob(buildParameters, baseImage) {
|
||||||
|
|
@ -77,6 +78,7 @@ class AWS {
|
||||||
ParameterValue: buildParameters.githubToken,
|
ParameterValue: buildParameters.githubToken,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
buildParameters.platform,
|
||||||
);
|
);
|
||||||
|
|
||||||
core.info('Starting part 2/4 (build unity project)');
|
core.info('Starting part 2/4 (build unity project)');
|
||||||
|
|
@ -180,6 +182,7 @@ class AWS {
|
||||||
ParameterValue: buildParameters.androidKeyaliasPass ? buildParameters.androidKeyaliasPass : '0',
|
ParameterValue: buildParameters.androidKeyaliasPass ? buildParameters.androidKeyaliasPass : '0',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
buildParameters.platform,
|
||||||
);
|
);
|
||||||
core.info('Starting part 3/4 (zip unity build and Library for caching)');
|
core.info('Starting part 3/4 (zip unity build and Library for caching)');
|
||||||
// Cleanup
|
// Cleanup
|
||||||
|
|
@ -214,6 +217,7 @@ class AWS {
|
||||||
ParameterValue: buildParameters.githubToken,
|
ParameterValue: buildParameters.githubToken,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
buildParameters.platform,
|
||||||
);
|
);
|
||||||
|
|
||||||
core.info('Starting part 4/4 (upload build to s3)');
|
core.info('Starting part 4/4 (upload build to s3)');
|
||||||
|
|
@ -256,6 +260,7 @@ class AWS {
|
||||||
ParameterValue: process.env.AWS_SECRET_ACCESS_KEY,
|
ParameterValue: process.env.AWS_SECRET_ACCESS_KEY,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
buildParameters.platform,
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error);
|
core.setFailed(error);
|
||||||
|
|
@ -273,6 +278,7 @@ class AWS {
|
||||||
workingdir,
|
workingdir,
|
||||||
environment,
|
environment,
|
||||||
secrets,
|
secrets,
|
||||||
|
platform,
|
||||||
) {
|
) {
|
||||||
const ECS = new SDK.ECS();
|
const ECS = new SDK.ECS();
|
||||||
const CF = new SDK.CloudFormation();
|
const CF = new SDK.CloudFormation();
|
||||||
|
|
@ -287,6 +293,7 @@ class AWS {
|
||||||
mountdir,
|
mountdir,
|
||||||
workingdir,
|
workingdir,
|
||||||
secrets,
|
secrets,
|
||||||
|
platform,
|
||||||
);
|
);
|
||||||
|
|
||||||
await this.runTask(taskDef, ECS, CF, environment, buildUid);
|
await this.runTask(taskDef, ECS, CF, environment, buildUid);
|
||||||
|
|
@ -304,10 +311,11 @@ class AWS {
|
||||||
mountdir,
|
mountdir,
|
||||||
workingdir,
|
workingdir,
|
||||||
secrets,
|
secrets,
|
||||||
|
platform,
|
||||||
) {
|
) {
|
||||||
const imageStackName = image.replace(/[^\da-z]/gi, '');
|
const imageStackName = image.replace(/[^\da-z]/gi, '');
|
||||||
const buildUidStackName = buildUid.replace(/[^\da-z]/gi, '');
|
const buildUidStackName = buildUid.replace(/[^\da-z]/gi, '');
|
||||||
const taskDefStackName = `${stackName}-${imageStackName}-${buildUidStackName}-build`;
|
const taskDefStackName = `${stackName}-${platform}-${buildUidStackName}-build`;
|
||||||
const taskDefCloudFormation = fs.readFileSync(`${__dirname}/task-def-formation.yml`, 'utf8');
|
const taskDefCloudFormation = fs.readFileSync(`${__dirname}/task-def-formation.yml`, 'utf8');
|
||||||
await CF.createStack({
|
await CF.createStack({
|
||||||
StackName: taskDefStackName,
|
StackName: taskDefStackName,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue