locking test improvements
parent
31669663bc
commit
33091c84ac
|
@ -1731,26 +1731,20 @@ class AWSTaskRunner {
|
|||
yield new Promise((resolve) => resolve(10000));
|
||||
const taskData = yield AWSTaskRunner.describeTasks(cluster, taskArn);
|
||||
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;
|
||||
const exitCode = containerState === null || containerState === void 0 ? void 0 : containerState.exitCode;
|
||||
cloud_runner_logger_1.default.log(`Container State: ${JSON.stringify(containerState, undefined, 4)}`);
|
||||
if (exitCode === undefined) {
|
||||
cloud_runner_logger_1.default.logWarning(`No exitcode for container`);
|
||||
cloud_runner_logger_1.default.logWarning(`Undefined exitcode for container`);
|
||||
}
|
||||
const wasSuccessful = exitCode === 0 || (exitCode === undefined && taskData.lastStatus === 'RUNNING');
|
||||
const wasSuccessful = exitCode === 0;
|
||||
if (wasSuccessful) {
|
||||
cloud_runner_logger_1.default.log(`Cloud runner job has finished successfully`);
|
||||
return { output, shouldCleanup };
|
||||
}
|
||||
else {
|
||||
if (taskData.stoppedReason === 'Essential container in task exited' && exitCode === 1) {
|
||||
throw new Error('Container exited with code 1');
|
||||
}
|
||||
const message = `Cloud runner job exit code ${exitCode}`;
|
||||
taskData.overrides = undefined;
|
||||
taskData.attachments = undefined;
|
||||
cloud_runner_logger_1.default.log(`${message} ${JSON.stringify(taskData, undefined, 4)}`);
|
||||
throw new Error(message);
|
||||
}
|
||||
throw new Error(`K8s task failed`);
|
||||
});
|
||||
}
|
||||
static waitUntilTaskRunning(taskArn, cluster) {
|
||||
|
@ -2767,6 +2761,9 @@ class AWSBuildEnvironment {
|
|||
yield CF.waitFor('stackDeleteComplete', {
|
||||
StackName: taskDef.taskDefStackName,
|
||||
}).promise();
|
||||
yield CF.waitFor('stackDeleteComplete', {
|
||||
StackName: `${taskDef.taskDefStackName}-cleanup`,
|
||||
}).promise();
|
||||
cloud_runner_logger_1.default.log(`Deleted Stack: ${taskDef.taskDefStackName}`);
|
||||
cloud_runner_logger_1.default.log('Cleanup complete');
|
||||
});
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -75,26 +75,23 @@ class AWSTaskRunner {
|
|||
await new Promise((resolve) => resolve(10000));
|
||||
const taskData = await AWSTaskRunner.describeTasks(cluster, taskArn);
|
||||
const containerState = taskData.containers?.[0];
|
||||
const exitCode = containerState?.exitCode || undefined;
|
||||
const exitCode = containerState?.exitCode;
|
||||
CloudRunnerLogger.log(`Container State: ${JSON.stringify(containerState, undefined, 4)}`);
|
||||
if (exitCode === undefined) {
|
||||
CloudRunnerLogger.logWarning(`No exitcode for container`);
|
||||
CloudRunnerLogger.logWarning(`Undefined exitcode for container`);
|
||||
}
|
||||
const wasSuccessful = exitCode === 0 || (exitCode === undefined && taskData.lastStatus === 'RUNNING');
|
||||
const wasSuccessful = exitCode === 0;
|
||||
if (wasSuccessful) {
|
||||
CloudRunnerLogger.log(`Cloud runner job has finished successfully`);
|
||||
|
||||
return { output, shouldCleanup };
|
||||
} else {
|
||||
}
|
||||
|
||||
if (taskData.stoppedReason === 'Essential container in task exited' && exitCode === 1) {
|
||||
throw new Error('Container exited with code 1');
|
||||
}
|
||||
const message = `Cloud runner job exit code ${exitCode}`;
|
||||
taskData.overrides = undefined;
|
||||
taskData.attachments = undefined;
|
||||
CloudRunnerLogger.log(`${message} ${JSON.stringify(taskData, undefined, 4)}`);
|
||||
throw new Error(message);
|
||||
}
|
||||
|
||||
throw new Error(`K8s task failed`);
|
||||
}
|
||||
|
||||
private static async waitUntilTaskRunning(taskArn: string, cluster: string) {
|
||||
|
|
|
@ -143,6 +143,9 @@ class AWSBuildEnvironment implements ProviderInterface {
|
|||
await CF.waitFor('stackDeleteComplete', {
|
||||
StackName: taskDef.taskDefStackName,
|
||||
}).promise();
|
||||
await CF.waitFor('stackDeleteComplete', {
|
||||
StackName: `${taskDef.taskDefStackName}-cleanup`,
|
||||
}).promise();
|
||||
CloudRunnerLogger.log(`Deleted Stack: ${taskDef.taskDefStackName}`);
|
||||
CloudRunnerLogger.log('Cleanup complete');
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue