@@ -76520,12 +76520,16 @@ const main = async () => {
7652076520 core.setOutput('task-id', taskId);
7652176521 core.info(`Starting Task with ARN: ${taskArn}\n`);
7652276522
76523- // Wait for task to be in running state
76524- core.debug(`Waiting for task to be in running state.`)
76525- await waitUntilTasksRunning({
76526- client: ecs,
76527- maxWaitTime: taskStartMaxWaitTime,
76528- }, {cluster, tasks: [taskArn]});
76523+ try {
76524+ core.debug(`Waiting for task to be in running state. Waiting for ${taskStartMaxWaitTime} seconds.`);
76525+ await waitUntilTasksRunning({
76526+ client: ecs,
76527+ maxWaitTime: taskStartMaxWaitTime,
76528+ }, {cluster, tasks: [taskArn]});
76529+ } catch (error) {
76530+ core.setFailed(`Task did not start successfully. Error: ${error.name}. State: ${error.state}.`);
76531+ return;
76532+ }
7652976533
7653076534 // If taskWaitUntilStopped is false, we can bail out here because we can not tail logs or have any
7653176535 // information on the exitCodes or status of the task
@@ -76587,15 +76591,18 @@ const main = async () => {
7658776591 }
7658876592 }
7658976593
76590- // Wait for Task to finish
76591- core.debug(`Waiting for task to finish.`);
76592- await waitUntilTasksStopped({
76593- client: ecs,
76594- maxWaitTime: taskStoppedMaxWaitTime,
76595- }, {
76596- cluster,
76597- tasks: [taskArn],
76598- });
76594+ try {
76595+ core.debug(`Waiting for task to finish. Waiting for ${taskStoppedMaxWaitTime} seconds.`);
76596+ await waitUntilTasksStopped({
76597+ client: ecs,
76598+ maxWaitTime: taskStoppedMaxWaitTime,
76599+ }, {
76600+ cluster,
76601+ tasks: [taskArn],
76602+ });
76603+ } catch (error) {
76604+ core.setFailed(`Task did not stop successfully. Error: ${error.name}. State: ${error.state}.`);
76605+ }
7659976606
7660076607 // Close LogStream and store output
7660176608 if (logFilterStream !== null) {
0 commit comments