This commit is contained in:
frostebite
2026-01-24 20:32:36 +00:00
parent 5c9bac600a
commit 53dacd92e1
3 changed files with 41 additions and 9 deletions

25
dist/index.js generated vendored
View File

@@ -1609,17 +1609,34 @@ class AWSBaseStack {
Parameters: parameters,
Capabilities: ['CAPABILITY_IAM'],
};
const stacks = await CF.send(new client_cloudformation_1.ListStacksCommand({ StackStatusFilter: ['UPDATE_COMPLETE', 'CREATE_COMPLETE', 'ROLLBACK_COMPLETE'] }));
const stacks = await CF.send(new client_cloudformation_1.ListStacksCommand({
StackStatusFilter: ['CREATE_IN_PROGRESS', 'UPDATE_IN_PROGRESS', 'UPDATE_COMPLETE', 'CREATE_COMPLETE', 'ROLLBACK_COMPLETE'],
}));
const stackNames = stacks.StackSummaries?.map((x) => x.StackName) || [];
const stackExists = stackNames.includes(baseStackName) || false;
const stackExists = stackNames.includes(baseStackName);
const describeStack = async () => {
return await CF.send(new client_cloudformation_1.DescribeStacksCommand(describeStackInput));
};
try {
if (!stackExists) {
cloud_runner_logger_1.default.log(`${baseStackName} stack does not exist (${JSON.stringify(stackNames)})`);
await CF.send(new client_cloudformation_1.CreateStackCommand(createStackInput));
cloud_runner_logger_1.default.log(`created stack (version: ${parametersHash})`);
let created = false;
try {
await CF.send(new client_cloudformation_1.CreateStackCommand(createStackInput));
created = true;
}
catch (error) {
const message = `${error?.name ?? ''} ${error?.message ?? ''}`;
if (message.includes('AlreadyExistsException')) {
cloud_runner_logger_1.default.log(`Base stack already exists, continuing with describe`);
}
else {
throw error;
}
}
if (created) {
cloud_runner_logger_1.default.log(`created stack (version: ${parametersHash})`);
}
}
const CFState = await describeStack();
let stack = CFState.Stacks?.[0];

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@@ -58,18 +58,33 @@ export class AWSBaseStack {
};
const stacks = await CF.send(
new ListStacksCommand({ StackStatusFilter: ['UPDATE_COMPLETE', 'CREATE_COMPLETE', 'ROLLBACK_COMPLETE'] }),
new ListStacksCommand({
StackStatusFilter: ['CREATE_IN_PROGRESS', 'UPDATE_IN_PROGRESS', 'UPDATE_COMPLETE', 'CREATE_COMPLETE', 'ROLLBACK_COMPLETE'],
}),
);
const stackNames = stacks.StackSummaries?.map((x) => x.StackName) || [];
const stackExists: Boolean = stackNames.includes(baseStackName) || false;
const stackExists: boolean = stackNames.includes(baseStackName);
const describeStack = async () => {
return await CF.send(new DescribeStacksCommand(describeStackInput));
};
try {
if (!stackExists) {
CloudRunnerLogger.log(`${baseStackName} stack does not exist (${JSON.stringify(stackNames)})`);
await CF.send(new CreateStackCommand(createStackInput));
CloudRunnerLogger.log(`created stack (version: ${parametersHash})`);
let created = false;
try {
await CF.send(new CreateStackCommand(createStackInput));
created = true;
} catch (error: any) {
const message = `${error?.name ?? ''} ${error?.message ?? ''}`;
if (message.includes('AlreadyExistsException')) {
CloudRunnerLogger.log(`Base stack already exists, continuing with describe`);
} else {
throw error;
}
}
if (created) {
CloudRunnerLogger.log(`created stack (version: ${parametersHash})`);
}
}
const CFState = await describeStack();
let stack = CFState.Stacks?.[0];