Revert "logging"

This reverts commit a7be23ee91.
pull/289/head
Frostebite 2021-09-09 01:37:59 +01:00
parent a7be23ee91
commit 2df97e0b08
3 changed files with 43 additions and 45 deletions

37
dist/index.js vendored
View File

@ -733,24 +733,6 @@ class AWSBuildRunner {
const taskArn = ((_o = task.tasks) === null || _o === void 0 ? void 0 : _o[0].taskArn) || '';
try {
yield ECS.waitFor('tasksRunning', { tasks: [taskArn], cluster }).promise();
core.info(`Cloud runner job is running`);
yield this.streamLogsUntilTaskStops(ECS, CF, taskDef, cluster, taskArn, streamName);
yield ECS.waitFor('tasksStopped', { cluster, tasks: [taskArn] }).promise();
const exitCode = (_q = (_p = (yield ECS.describeTasks({
tasks: [taskArn],
cluster,
}).promise()).tasks) === null || _p === void 0 ? void 0 : _p[0].containers) === null || _q === void 0 ? void 0 : _q[0].exitCode;
core.info(`Cloud runner job exit code ${exitCode}`);
if (exitCode !== 0) {
core.error(`job failed with exit code ${exitCode} ${JSON.stringify(yield ECS.describeTasks({
tasks: [taskArn],
cluster,
}).promise(), undefined, 4)}`);
throw new Error(`job failed with exit code ${exitCode}`);
}
else {
core.info(`Cloud runner job has finished successfully`);
}
}
catch (error_) {
const error = error_;
@ -759,10 +741,27 @@ class AWSBuildRunner {
tasks: [taskArn],
cluster,
}).promise();
core.info(`Cloud runner job has ended ${(_s = (_r = describeTasks.tasks) === null || _r === void 0 ? void 0 : _r[0].containers) === null || _s === void 0 ? void 0 : _s[0].lastStatus}`);
core.info(`Cloud runner job has ended ${(_q = (_p = describeTasks.tasks) === null || _p === void 0 ? void 0 : _p[0].containers) === null || _q === void 0 ? void 0 : _q[0].lastStatus}`);
core.setFailed(error);
core.error(error);
}
core.info(`Cloud runner job is running`);
yield this.streamLogsUntilTaskStops(ECS, CF, taskDef, cluster, taskArn, streamName);
yield ECS.waitFor('tasksStopped', { cluster, tasks: [taskArn] }).promise();
const exitCode = (_s = (_r = (yield ECS.describeTasks({
tasks: [taskArn],
cluster,
}).promise()).tasks) === null || _r === void 0 ? void 0 : _r[0].containers) === null || _s === void 0 ? void 0 : _s[0].exitCode;
if (exitCode !== 0) {
core.error(`job failed with exit code ${exitCode} ${JSON.stringify(yield ECS.describeTasks({
tasks: [taskArn],
cluster,
}).promise(), undefined, 4)}`);
throw new Error(`job failed with exit code ${exitCode}`);
}
else {
core.info(`Cloud runner job has finished successfully`);
}
});
}
static streamLogsUntilTaskStops(ECS, CF, taskDef, clusterName, taskArn, kinesisStreamName) {

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -53,31 +53,6 @@ class AWSBuildRunner {
try {
await ECS.waitFor('tasksRunning', { tasks: [taskArn], cluster }).promise();
core.info(`Cloud runner job is running`);
await this.streamLogsUntilTaskStops(ECS, CF, taskDef, cluster, taskArn, streamName);
await ECS.waitFor('tasksStopped', { cluster, tasks: [taskArn] }).promise();
const exitCode = (
await ECS.describeTasks({
tasks: [taskArn],
cluster,
}).promise()
).tasks?.[0].containers?.[0].exitCode;
core.info(`Cloud runner job exit code ${exitCode}`);
if (exitCode !== 0) {
core.error(
`job failed with exit code ${exitCode} ${JSON.stringify(
await ECS.describeTasks({
tasks: [taskArn],
cluster,
}).promise(),
undefined,
4,
)}`,
);
throw new Error(`job failed with exit code ${exitCode}`);
} else {
core.info(`Cloud runner job has finished successfully`);
}
} catch (error_) {
const error = error_ as Error;
await new Promise((resolve) => setTimeout(resolve, 3000));
@ -90,6 +65,30 @@ class AWSBuildRunner {
core.setFailed(error);
core.error(error);
}
core.info(`Cloud runner job is running`);
await this.streamLogsUntilTaskStops(ECS, CF, taskDef, cluster, taskArn, streamName);
await ECS.waitFor('tasksStopped', { cluster, tasks: [taskArn] }).promise();
const exitCode = (
await ECS.describeTasks({
tasks: [taskArn],
cluster,
}).promise()
).tasks?.[0].containers?.[0].exitCode;
if (exitCode !== 0) {
core.error(
`job failed with exit code ${exitCode} ${JSON.stringify(
await ECS.describeTasks({
tasks: [taskArn],
cluster,
}).promise(),
undefined,
4,
)}`,
);
throw new Error(`job failed with exit code ${exitCode}`);
} else {
core.info(`Cloud runner job has finished successfully`);
}
}
static async streamLogsUntilTaskStops(