typescript aws
parent
dc5f69cda8
commit
00b5a67b1a
|
|
@ -404,7 +404,6 @@ class AWS {
|
||||||
const taskDefStackName = `${stackName}-taskDef-${image}-${buildUid}`
|
const taskDefStackName = `${stackName}-taskDef-${image}-${buildUid}`
|
||||||
.toString()
|
.toString()
|
||||||
.replace(/[^\da-z]/gi, '');
|
.replace(/[^\da-z]/gi, '');
|
||||||
const taskDefStackNameTTL = taskDefStackName + "-ttl";
|
|
||||||
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,
|
||||||
|
|
@ -441,6 +440,7 @@ class AWS {
|
||||||
].concat(secrets),
|
].concat(secrets),
|
||||||
}).promise();
|
}).promise();
|
||||||
core.info("Creating build cluster...");
|
core.info("Creating build cluster...");
|
||||||
|
const taskDefStackNameTTL = taskDefStackName + "-ttl";
|
||||||
const ttlCloudFormation = fs.readFileSync(`${__dirname}/cloudformation-stack-ttl.yml`, 'utf8');
|
const ttlCloudFormation = fs.readFileSync(`${__dirname}/cloudformation-stack-ttl.yml`, 'utf8');
|
||||||
yield CF.createStack({
|
yield CF.createStack({
|
||||||
StackName: taskDefStackNameTTL,
|
StackName: taskDefStackNameTTL,
|
||||||
|
|
@ -464,10 +464,11 @@ class AWS {
|
||||||
catch (error) {
|
catch (error) {
|
||||||
core.error(error);
|
core.error(error);
|
||||||
}
|
}
|
||||||
|
core.info("Cloud formation stack created");
|
||||||
const taskDefResources = yield CF.describeStackResources({
|
const taskDefResources = yield CF.describeStackResources({
|
||||||
StackName: taskDefStackName,
|
StackName: taskDefStackName,
|
||||||
}).promise();
|
}).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 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({
|
const task = yield ECS.runTask({
|
||||||
cluster: clusterName,
|
cluster: clusterName,
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -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 ECS = new SDK.ECS();
|
||||||
const CF = new SDK.CloudFormation();
|
const CF = new SDK.CloudFormation();
|
||||||
|
|
||||||
const taskDefStackName = `${stackName}-taskDef-${image}-${buildUid}`
|
const taskDefStackName = `${stackName}-taskDef-${image}-${buildUid}`
|
||||||
.toString()
|
.toString()
|
||||||
.replace(/[^\da-z]/gi, '');
|
.replace(/[^\da-z]/gi, '');
|
||||||
const taskDefStackNameTTL = taskDefStackName+"-ttl";
|
|
||||||
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,
|
||||||
|
|
@ -257,6 +256,7 @@ class AWS {
|
||||||
}).promise();
|
}).promise();
|
||||||
core.info("Creating build cluster...");
|
core.info("Creating build cluster...");
|
||||||
|
|
||||||
|
const taskDefStackNameTTL = taskDefStackName+"-ttl";
|
||||||
const ttlCloudFormation = fs.readFileSync(`${__dirname}/cloudformation-stack-ttl.yml`, 'utf8');
|
const ttlCloudFormation = fs.readFileSync(`${__dirname}/cloudformation-stack-ttl.yml`, 'utf8');
|
||||||
await CF.createStack({
|
await CF.createStack({
|
||||||
StackName: taskDefStackNameTTL,
|
StackName: taskDefStackNameTTL,
|
||||||
|
|
@ -280,13 +280,14 @@ class AWS {
|
||||||
}catch(error){
|
}catch(error){
|
||||||
core.error(error);
|
core.error(error);
|
||||||
}
|
}
|
||||||
|
core.info("Cloud formation stack created");
|
||||||
|
|
||||||
const taskDefResources = await CF.describeStackResources({
|
const taskDefResources = await CF.describeStackResources({
|
||||||
StackName: taskDefStackName,
|
StackName: taskDefStackName,
|
||||||
}).promise();
|
}).promise();
|
||||||
|
|
||||||
|
|
||||||
const baseResources = await CF.describeStackResources({ StackName: taskDefStackName }).promise();
|
const baseResources = await CF.describeStackResources({ StackName: stackName }).promise();
|
||||||
|
|
||||||
const clusterName = baseResources.StackResources?.find(
|
const clusterName = baseResources.StackResources?.find(
|
||||||
(x) => x.LogicalResourceId === 'ECSCluster',
|
(x) => x.LogicalResourceId === 'ECSCluster',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue