Add support for new aws-github connection
This commit is contained in:
@@ -17,7 +17,7 @@ module.exports = {
|
|||||||
description: 'Show status for available testservers (s)',
|
description: 'Show status for available testservers (s)',
|
||||||
hidden: false,
|
hidden: false,
|
||||||
run: async (toolbox: GluegunMenuToolbox) => {
|
run: async (toolbox: GluegunMenuToolbox) => {
|
||||||
|
|
||||||
const { system, strings } = toolbox
|
const { system, strings } = toolbox
|
||||||
|
|
||||||
const stacks = JSON.parse(strings.trim(await system.run(`aws cloudformation list-stacks`)));
|
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)) {
|
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 {
|
try {
|
||||||
const pipeline = JSON.parse(strings.trim(await system.run(`aws codepipeline get-pipeline --name ${item.StackName}Pipeline`)));
|
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';
|
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;
|
const lastUpdated = pipeline.metadata.updated;
|
||||||
return {
|
return {
|
||||||
name: item.StackName,
|
name: item.StackName,
|
||||||
@@ -45,14 +46,14 @@ module.exports = {
|
|||||||
updated: '',
|
updated: '',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return Promise.resolve(null);
|
return Promise.resolve(null);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const curratedStacks: Stack[] = teststacks.filter(Boolean);
|
const curratedStacks: Stack[] = teststacks.filter(Boolean);
|
||||||
|
|
||||||
const status = (status: string) => {
|
const status = (status: string) => {
|
||||||
switch(status) {
|
switch(status) {
|
||||||
case 'NO_STATUS':
|
case 'NO_STATUS':
|
||||||
return `(${chalk.red.bold('?')})`;
|
return `(${chalk.red.bold('?')})`;
|
||||||
@@ -83,9 +84,9 @@ module.exports = {
|
|||||||
const timeSince = (date: number) => {
|
const timeSince = (date: number) => {
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
const seconds = Math.floor((now - date) / 1000);
|
const seconds = Math.floor((now - date) / 1000);
|
||||||
|
|
||||||
let interval = seconds / 31536000;
|
let interval = seconds / 31536000;
|
||||||
|
|
||||||
if (interval > 1) {
|
if (interval > 1) {
|
||||||
return Math.floor(interval) + " years";
|
return Math.floor(interval) + " years";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user