Add support for new aws-github connection

This commit is contained in:
Anders Gustafsson
2023-01-17 09:16:12 +01:00
parent 0a4c3ee6d6
commit b338de406c
@@ -17,7 +17,7 @@ module.exports = {
description: 'Show status for available testservers (s)',
hidden: false,
run: async (toolbox: GluegunMenuToolbox) => {
const { system, strings } = toolbox
const stacks = JSON.parse(strings.trim(await system.run(`aws cloudformation list-stacks`)));
@@ -25,9 +25,10 @@ module.exports = {
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 => {
const sourceStage = pipeline.pipeline.stages.filter(stage => {
return stage.name === 'Source';
})[0].actions[0].configuration.Branch;
});
const branch = sourceStage[0].actions[0].configuration.Branch ?? sourceStage[0].actions[0].configuration.BranchName;
const lastUpdated = pipeline.metadata.updated;
return {
name: item.StackName,
@@ -45,14 +46,14 @@ module.exports = {
updated: '',
}
}
}
return Promise.resolve(null);
}));
const curratedStacks: Stack[] = teststacks.filter(Boolean);
const status = (status: string) => {
const status = (status: string) => {
switch(status) {
case 'NO_STATUS':
return `(${chalk.red.bold('?')})`;
@@ -83,9 +84,9 @@ module.exports = {
const timeSince = (date: number) => {
const now = Date.now();
const seconds = Math.floor((now - date) / 1000);
let interval = seconds / 31536000;
if (interval > 1) {
return Math.floor(interval) + " years";
}