2021-10-04 23:23:49 +00:00
|
|
|
import CloudRunnerLogger from '../services/cloud-runner-logger';
|
2021-10-04 23:09:04 +00:00
|
|
|
import * as SDK from 'aws-sdk';
|
|
|
|
|
import * as core from '@actions/core';
|
|
|
|
|
|
|
|
|
|
export class AWSError {
|
2021-12-29 14:38:46 +00:00
|
|
|
static async handleStackCreationFailure(error: any, CF: SDK.CloudFormation, taskDefStackName: string) {
|
2021-10-04 23:09:04 +00:00
|
|
|
CloudRunnerLogger.log('aws error: ');
|
2021-12-20 23:08:22 +00:00
|
|
|
core.error(JSON.stringify(error, undefined, 4));
|
2021-10-04 23:09:04 +00:00
|
|
|
CloudRunnerLogger.log('Getting events and resources for task stack');
|
2021-12-30 22:31:04 +00:00
|
|
|
const events = (await CF.describeStackEvents({ StackName: taskDefStackName }).promise()).StackEvents?.map((x) => {
|
|
|
|
|
x.ResourceStatus, x.ResourceStatusReason, x.ResourceProperties;
|
|
|
|
|
});
|
2021-10-04 23:09:04 +00:00
|
|
|
CloudRunnerLogger.log(JSON.stringify(events, undefined, 4));
|
|
|
|
|
}
|
|
|
|
|
}
|