fixed status for newly created stacks
This commit is contained in:
@@ -22,6 +22,7 @@ module.exports = {
|
||||
const stacks = JSON.parse(strings.trim(await system.run(`aws cloudformation list-stacks`)));
|
||||
const teststacks: Stack[] = await Promise.all(stacks.StackSummaries.map(async (item) => {
|
||||
if (item.StackName.indexOf('photowall-test-') > -1 && ['CREATE_COMPLETE', 'UPDATE_COMPLETE', 'UPDATE_IN_PROGRESS', 'UPDATE_FAILED', 'CREATE_FAILED', 'CREATE_IN_PROGRESS'].includes(item.StackStatus)) {
|
||||
try {
|
||||
const pipeline = JSON.parse(strings.trim(await system.run(`aws codepipeline get-pipeline --name ${item.StackName}Pipeline`)));
|
||||
const branch = pipeline.pipeline.stages.filter(stage => {
|
||||
return stage.name === 'Source';
|
||||
@@ -34,6 +35,16 @@ module.exports = {
|
||||
branch: branch,
|
||||
updated: lastUpdated,
|
||||
}
|
||||
} catch (e) {
|
||||
return {
|
||||
name: item.StackName,
|
||||
status: 'NO_STATUS',
|
||||
drift_status: '',
|
||||
branch: '',
|
||||
updated: '',
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return Promise.resolve(null);
|
||||
}));
|
||||
@@ -42,6 +53,8 @@ module.exports = {
|
||||
|
||||
const status = (status: string) => {
|
||||
switch(status) {
|
||||
case 'NO_STATUS':
|
||||
return ` (❓) `;
|
||||
case 'UPDATE_FAILED':
|
||||
case 'CREATE_FAILED':
|
||||
return ` (💔) `;
|
||||
|
||||
Reference in New Issue
Block a user