typescript aws

pull/235/head
mdugdale 2021-03-28 21:32:52 +01:00
parent dc5f69cda8
commit 00b5a67b1a
3 changed files with 8 additions and 6 deletions

5
dist/index.js vendored
View File

@ -404,7 +404,6 @@ class AWS {
const taskDefStackName = `${stackName}-taskDef-${image}-${buildUid}`
.toString()
.replace(/[^\da-z]/gi, '');
const taskDefStackNameTTL = taskDefStackName + "-ttl";
const taskDefCloudFormation = fs.readFileSync(`${__dirname}/task-def-formation.yml`, 'utf8');
yield CF.createStack({
StackName: taskDefStackName,
@ -441,6 +440,7 @@ class AWS {
].concat(secrets),
}).promise();
core.info("Creating build cluster...");
const taskDefStackNameTTL = taskDefStackName + "-ttl";
const ttlCloudFormation = fs.readFileSync(`${__dirname}/cloudformation-stack-ttl.yml`, 'utf8');
yield CF.createStack({
StackName: taskDefStackNameTTL,
@ -464,10 +464,11 @@ class AWS {
catch (error) {
core.error(error);
}
core.info("Cloud formation stack created");
const taskDefResources = yield CF.describeStackResources({
StackName: taskDefStackName,
}).promise();
const baseResources = yield CF.describeStackResources({ StackName: taskDefStackName }).promise();
const baseResources = yield CF.describeStackResources({ StackName: stackName }).promise();
const clusterName = ((_b = (_a = baseResources.StackResources) === null || _a === void 0 ? void 0 : _a.find((x) => x.LogicalResourceId === 'ECSCluster')) === null || _b === void 0 ? void 0 : _b.PhysicalResourceId) || "";
const task = yield ECS.runTask({
cluster: clusterName,

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -212,14 +212,13 @@ class AWS {
}
}
static async run(buildUid, stackName, image, entrypoint, commands, mountdir, workingdir, environment, secrets) {
static async run(buildUid:string, stackName:string, image:string, entrypoint, commands, mountdir, workingdir, environment, secrets) {
const ECS = new SDK.ECS();
const CF = new SDK.CloudFormation();
const taskDefStackName = `${stackName}-taskDef-${image}-${buildUid}`
.toString()
.replace(/[^\da-z]/gi, '');
const taskDefStackNameTTL = taskDefStackName+"-ttl";
const taskDefCloudFormation = fs.readFileSync(`${__dirname}/task-def-formation.yml`, 'utf8');
await CF.createStack({
StackName: taskDefStackName,
@ -257,6 +256,7 @@ class AWS {
}).promise();
core.info("Creating build cluster...");
const taskDefStackNameTTL = taskDefStackName+"-ttl";
const ttlCloudFormation = fs.readFileSync(`${__dirname}/cloudformation-stack-ttl.yml`, 'utf8');
await CF.createStack({
StackName: taskDefStackNameTTL,
@ -280,13 +280,14 @@ class AWS {
}catch(error){
core.error(error);
}
core.info("Cloud formation stack created");
const taskDefResources = await CF.describeStackResources({
StackName: taskDefStackName,
}).promise();
const baseResources = await CF.describeStackResources({ StackName: taskDefStackName }).promise();
const baseResources = await CF.describeStackResources({ StackName: stackName }).promise();
const clusterName = baseResources.StackResources?.find(
(x) => x.LogicalResourceId === 'ECSCluster',