cleanup & retained mode test for k8s and aws

pull/437/head
Frostebite 2022-11-03 17:28:52 +00:00
parent 1e34c6f5d6
commit ac53014e71
4 changed files with 9 additions and 3 deletions

5
dist/index.js vendored
View File

@ -1607,7 +1607,9 @@ class AWSTaskRunner {
} }
const { output, shouldCleanup } = yield this.streamLogsUntilTaskStops(cluster, taskArn, streamName); const { output, shouldCleanup } = yield this.streamLogsUntilTaskStops(cluster, taskArn, streamName);
const taskData = yield AWSTaskRunner.describeTasks(cluster, taskArn); const taskData = yield AWSTaskRunner.describeTasks(cluster, taskArn);
const exitCode = (_q = taskData.containers) === null || _q === void 0 ? void 0 : _q[0].exitCode; const containerState = (_q = taskData.containers) === null || _q === void 0 ? void 0 : _q[0];
const exitCode = (containerState === null || containerState === void 0 ? void 0 : containerState.exitCode) || undefined;
cloud_runner_logger_1.default.log(`Container State: ${JSON.stringify(containerState, undefined, 4)}`);
const wasSuccessful = exitCode === 0 || (exitCode === undefined && taskData.lastStatus === 'RUNNING'); const wasSuccessful = exitCode === 0 || (exitCode === undefined && taskData.lastStatus === 'RUNNING');
if (wasSuccessful) { if (wasSuccessful) {
cloud_runner_logger_1.default.log(`Cloud runner job has finished successfully`); cloud_runner_logger_1.default.log(`Cloud runner job has finished successfully`);
@ -2464,6 +2466,7 @@ class AWSBuildEnvironment {
return output; return output;
} }
catch (error) { catch (error) {
cloud_runner_logger_1.default.log(`error running task ${error}`);
yield this.cleanupResources(CF, taskDef); yield this.cleanupResources(CF, taskDef);
throw error; throw error;
} }

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -66,7 +66,9 @@ class AWSTaskRunner {
} }
const { output, shouldCleanup } = await this.streamLogsUntilTaskStops(cluster, taskArn, streamName); const { output, shouldCleanup } = await this.streamLogsUntilTaskStops(cluster, taskArn, streamName);
const taskData = await AWSTaskRunner.describeTasks(cluster, taskArn); const taskData = await AWSTaskRunner.describeTasks(cluster, taskArn);
const exitCode = taskData.containers?.[0].exitCode; const containerState = taskData.containers?.[0];
const exitCode = containerState?.exitCode || undefined;
CloudRunnerLogger.log(`Container State: ${JSON.stringify(containerState, undefined, 4)}`);
const wasSuccessful = exitCode === 0 || (exitCode === undefined && taskData.lastStatus === 'RUNNING'); const wasSuccessful = exitCode === 0 || (exitCode === undefined && taskData.lastStatus === 'RUNNING');
if (wasSuccessful) { if (wasSuccessful) {
CloudRunnerLogger.log(`Cloud runner job has finished successfully`); CloudRunnerLogger.log(`Cloud runner job has finished successfully`);

View File

@ -138,6 +138,7 @@ class AWSBuildEnvironment implements ProviderInterface {
return output; return output;
} catch (error) { } catch (error) {
CloudRunnerLogger.log(`error running task ${error}`);
await this.cleanupResources(CF, taskDef); await this.cleanupResources(CF, taskDef);
throw error; throw error;
} }