pull/235/head
mdugdale 2021-04-03 01:32:25 +01:00
parent 26fc8ef82d
commit a3cf12c7c4
4 changed files with 28 additions and 26 deletions

10
dist/index.js vendored
View File

@ -225,7 +225,7 @@ class AWS {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
try { try {
const buildUid = nanoid_1.nanoid(); const buildUid = nanoid_1.nanoid();
core.info("starting part 1/4 (clone from github and restore cache)"); core.info('starting part 1/4 (clone from github and restore cache)');
yield this.run(buildUid, buildParameters.awsStackName, 'alpine/git', ['/bin/sh'], [ yield this.run(buildUid, buildParameters.awsStackName, 'alpine/git', ['/bin/sh'], [
'-c', '-c',
`apk update; `apk update;
@ -270,7 +270,7 @@ class AWS {
ParameterValue: buildParameters.githubToken, ParameterValue: buildParameters.githubToken,
}, },
]); ]);
core.info("starting part 2/4 (build)"); core.info('starting part 2/4 (build)');
yield this.run(buildUid, buildParameters.awsStackName, baseImage.toString(), ['/bin/sh'], [ yield this.run(buildUid, buildParameters.awsStackName, baseImage.toString(), ['/bin/sh'], [
'-c', '-c',
` `
@ -362,7 +362,7 @@ class AWS {
ParameterValue: buildParameters.androidKeyaliasPass ? buildParameters.androidKeyaliasPass : '0', ParameterValue: buildParameters.androidKeyaliasPass ? buildParameters.androidKeyaliasPass : '0',
}, },
]); ]);
core.info("starting part 3/4 (zip and publish latest Library to cache)"); core.info('starting part 3/4 (zip and publish latest Library to cache)');
// Cleanup // Cleanup
yield this.run(buildUid, buildParameters.awsStackName, 'alpine', ['/bin/sh'], [ yield this.run(buildUid, buildParameters.awsStackName, 'alpine', ['/bin/sh'], [
'-c', '-c',
@ -384,7 +384,7 @@ class AWS {
ParameterValue: buildParameters.githubToken, ParameterValue: buildParameters.githubToken,
}, },
]); ]);
core.info("starting part 4/4 (upload to s3)"); core.info('starting part 4/4 (upload 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',
` `
@ -530,7 +530,7 @@ class AWS {
const streamName = ((_m = (_l = taskDef.taskDefResources.StackResources) === null || _l === void 0 ? void 0 : _l.find((x) => x.LogicalResourceId === 'KinesisStream')) === null || _m === void 0 ? void 0 : _m.PhysicalResourceId) || ''; const streamName = ((_m = (_l = taskDef.taskDefResources.StackResources) === null || _l === void 0 ? void 0 : _l.find((x) => x.LogicalResourceId === 'KinesisStream')) === null || _m === void 0 ? void 0 : _m.PhysicalResourceId) || '';
const task = yield ECS.runTask({ const task = yield ECS.runTask({
cluster: clusterName, cluster: clusterName,
taskDefinition: taskDefinition, taskDefinition,
platformVersion: '1.4.0', platformVersion: '1.4.0',
overrides: { overrides: {
containerOverrides: [ containerOverrides: [

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,3 @@
/* eslint-disable unicorn/prevent-abbreviations */
// Import these named export into your test file: // Import these named export into your test file:
export const mockProjectPath = jest.fn().mockResolvedValue('mockProjectPath'); export const mockProjectPath = jest.fn().mockResolvedValue('mockProjectPath');
export const mockIsDirtyAllowed = jest.fn().mockResolvedValue(false); export const mockIsDirtyAllowed = jest.fn().mockResolvedValue(false);

View File

@ -9,7 +9,7 @@ class AWS {
try { try {
const buildUid = nanoid(); const buildUid = nanoid();
core.info("starting part 1/4 (clone from github and restore cache)"); core.info('starting part 1/4 (clone from github and restore cache)');
await this.run( await this.run(
buildUid, buildUid,
buildParameters.awsStackName, buildParameters.awsStackName,
@ -65,7 +65,7 @@ class AWS {
], ],
); );
core.info("starting part 2/4 (build)"); core.info('starting part 2/4 (build)');
await this.run( await this.run(
buildUid, buildUid,
buildParameters.awsStackName, buildParameters.awsStackName,
@ -167,7 +167,7 @@ class AWS {
}, },
], ],
); );
core.info("starting part 3/4 (zip and publish latest Library to cache)"); core.info('starting part 3/4 (zip and publish latest Library to cache)');
// Cleanup // Cleanup
await this.run( await this.run(
buildUid, buildUid,
@ -200,7 +200,7 @@ class AWS {
], ],
); );
core.info("starting part 4/4 (upload to s3)"); core.info('starting part 4/4 (upload to s3)');
await this.run( await this.run(
buildUid, buildUid,
buildParameters.awsStackName, buildParameters.awsStackName,
@ -382,13 +382,17 @@ class AWS {
static async runTask(taskDef, ECS, CF, environment, buildUid) { static async runTask(taskDef, ECS, CF, environment, buildUid) {
const clusterName = const clusterName =
taskDef.baseResources.StackResources?.find((x) => x.LogicalResourceId === 'ECSCluster')?.PhysicalResourceId || ''; taskDef.baseResources.StackResources?.find((x) => x.LogicalResourceId === 'ECSCluster')?.PhysicalResourceId || '';
const taskDefinition = taskDef.taskDefResources.StackResources?.find((x) => x.LogicalResourceId === 'TaskDefinition') const taskDefinition =
taskDef.taskDefResources.StackResources?.find((x) => x.LogicalResourceId === 'TaskDefinition')
?.PhysicalResourceId || ''; ?.PhysicalResourceId || '';
const SubnetOne = taskDef.baseResources.StackResources?.find((x) => x.LogicalResourceId === 'PublicSubnetOne') const SubnetOne =
taskDef.baseResources.StackResources?.find((x) => x.LogicalResourceId === 'PublicSubnetOne')
?.PhysicalResourceId || ''; ?.PhysicalResourceId || '';
const SubnetTwo = taskDef.baseResources.StackResources?.find((x) => x.LogicalResourceId === 'PublicSubnetTwo') const SubnetTwo =
taskDef.baseResources.StackResources?.find((x) => x.LogicalResourceId === 'PublicSubnetTwo')
?.PhysicalResourceId || ''; ?.PhysicalResourceId || '';
const ContainerSecurityGroup = taskDef.baseResources.StackResources?.find((x) => x.LogicalResourceId === 'ContainerSecurityGroup') const ContainerSecurityGroup =
taskDef.baseResources.StackResources?.find((x) => x.LogicalResourceId === 'ContainerSecurityGroup')
?.PhysicalResourceId || ''; ?.PhysicalResourceId || '';
const streamName = const streamName =
taskDef.taskDefResources.StackResources?.find((x) => x.LogicalResourceId === 'KinesisStream') taskDef.taskDefResources.StackResources?.find((x) => x.LogicalResourceId === 'KinesisStream')
@ -396,7 +400,7 @@ class AWS {
const task = await ECS.runTask({ const task = await ECS.runTask({
cluster: clusterName, cluster: clusterName,
taskDefinition: taskDefinition, taskDefinition,
platformVersion: '1.4.0', platformVersion: '1.4.0',
overrides: { overrides: {
containerOverrides: [ containerOverrides: [