Skip to content

Commit 63bbc34

Browse files
committed
update dist
1 parent 8d80e1c commit 63bbc34

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

dist/index.js

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
const path = __nccwpck_require__(1017);
88
const core = __nccwpck_require__(2186);
99
const { CodeDeploy, waitUntilDeploymentSuccessful } = __nccwpck_require__(6692);
10-
const { ECS, waitUntilServicesStable } = __nccwpck_require__(8209);
10+
const { ECS, waitUntilServicesStable, waitUntilTasksStopped } = __nccwpck_require__(8209);
1111
const yaml = __nccwpck_require__(4083);
1212
const fs = __nccwpck_require__(7147);
1313
const crypto = __nccwpck_require__(6113);
@@ -55,18 +55,18 @@ async function runTask(ecs, clusterName, taskDefArn, waitForMinutes) {
5555
containerOverrides: containerOverrides
5656
},
5757
launchType: launchType,
58-
networkConfiguration: awsvpcConfiguration === {} ? {} : { awsvpcConfiguration: awsvpcConfiguration }
59-
}).promise();
58+
networkConfiguration: Object.keys(awsvpcConfiguration).length === 0 ? {} : { awsvpcConfiguration: awsvpcConfiguration }
59+
});
6060

6161
core.debug(`Run task response ${JSON.stringify(runTaskResponse)}`)
6262

6363
const taskArns = runTaskResponse.tasks.map(task => task.taskArn);
6464
core.setOutput('run-task-arn', taskArns);
6565

66-
taskArns.map(taskArn => {
67-
let taskId = taskArn.split('/').pop();
68-
core.info(`Task running: https://console.aws.amazon.com/ecs/home?region=${aws.config.region}#/clusters/${clusterName}/tasks`)
69-
});
66+
const region = await ecs.config.region();
67+
const consoleHostname = region.startsWith('cn') ? 'console.amazonaws.cn' : 'console.aws.amazon.com';
68+
69+
core.info(`Task running: https://${consoleHostname}/ecs/home?region=${region}#/clusters/${clusterName}/tasks`);
7070

7171
if (runTaskResponse.failures && runTaskResponse.failures.length > 0) {
7272
const failure = runTaskResponse.failures[0];
@@ -90,14 +90,14 @@ async function waitForTasksStopped(ecs, clusterName, taskArns, waitForMinutes) {
9090

9191
core.info(`Waiting for tasks to stop. Will wait for ${waitForMinutes} minutes`);
9292

93-
const waitTaskResponse = await ecs.waitFor('tasksStopped', {
93+
const waitTaskResponse = await waitUntilTasksStopped({
94+
client: ecs,
95+
minDelay: WAIT_DEFAULT_DELAY_SEC,
96+
maxWaitTime: waitForMinutes * 60,
97+
}, {
9498
cluster: clusterName,
9599
tasks: taskArns,
96-
$waiter: {
97-
delay: WAIT_DEFAULT_DELAY_SEC,
98-
maxAttempts: (waitForMinutes * 60) / WAIT_DEFAULT_DELAY_SEC
99-
}
100-
}).promise();
100+
});
101101

102102
core.debug(`Run task response ${JSON.stringify(waitTaskResponse)}`);
103103
core.info('All tasks have stopped.');
@@ -108,7 +108,7 @@ async function tasksExitCode(ecs, clusterName, taskArns) {
108108
const describeResponse = await ecs.describeTasks({
109109
cluster: clusterName,
110110
tasks: taskArns
111-
}).promise();
111+
});
112112

113113
const containers = [].concat(...describeResponse.tasks.map(task => task.containers))
114114
const exitCodes = containers.map(container => container.exitCode)
@@ -330,9 +330,11 @@ async function createCodeDeployDeployment(codedeploy, clusterName, service, task
330330
}
331331
}
332332
};
333+
333334
// If it hasn't been set then we don't even want to pass it to the api call to maintain previous behaviour.
334335
if (codeDeployDescription) {
335-
deploymentParams.description = codeDeployDescription
336+
// CodeDeploy Deployment Descriptions have a max length of 512 characters, so truncate if necessary
337+
deploymentParams.description = (codeDeployDescription.length <= 512) ? codeDeployDescription : `${codeDeployDescription.substring(0,511)}…`;
336338
}
337339
if (codeDeployConfig) {
338340
deploymentParams.deploymentConfigName = codeDeployConfig

0 commit comments

Comments
 (0)