Consume kinesis logs while task is RUNNING status

pull/218/head
Frostebite 2021-02-07 15:48:22 +00:00
parent aca1ff1974
commit 6aec635bd4
2 changed files with 27 additions and 16 deletions

File diff suppressed because one or more lines are too long

View File

@ -106,6 +106,16 @@ class AWS {
// watching logs
const kinesis = new SDK.Kinesis();
const getTaskStatus = async () => {
const tasks = await ECS.describeTasks({
cluster: clusterName,
tasks: [task.tasks[0].taskArn],
}).promise();
core.info(`Task status is ${tasks.tasks[0].lastStatus}`);
return tasks.tasks[0].lastStatus;
};
while ((await getTaskStatus()) === 'RUNNING') {
const iterator = await kinesis
.getShardIterator({
ShardIteratorType: 'TRIM_HORIZON',
@ -121,6 +131,7 @@ class AWS {
})
.promise();
core.info(records.Records[0].Data);
}
await ECS.waitFor('tasksStopped', {
cluster: clusterName,