Skip to content

Commit

Permalink
Remove AWS SDKv2
Browse files Browse the repository at this point in the history
  • Loading branch information
Ic3w0lf committed Aug 8, 2024
1 parent 9c2f82b commit f73c82a
Show file tree
Hide file tree
Showing 4 changed files with 833 additions and 1,491 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
[![Geek Cell GmbH](https://raw.githubusercontent.com/geekcell/.github/main/geekcell-github-banner.png)](https://www.geekcell.io/)

[![Linter](https://github.com/geekcell/github-action-aws-ecs-run-task/actions/workflows/linter.yaml/badge.svg)](https://github.com/geekcell/github-action-aws-ecs-run-task/actions/workflows/linter.yaml)
[![Test](https://github.com/geekcell/github-action-aws-ecs-run-task/actions/workflows/test.yaml/badge.svg)](https://github.com/geekcell/github-action-aws-ecs-run-task/actions/workflows/test.yaml)
[![Check dist/](https://github.com/geekcell/github-action-aws-ecs-run-task/actions/workflows/check-dist.yaml/badge.svg)](https://github.com/geekcell/github-action-aws-ecs-run-task/actions/workflows/check-dist.yaml)

<!-- action-docs-description -->
## Description

Expand Down
15 changes: 13 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56578,6 +56578,9 @@ const main = async () => {
return;
}

// Get CWLogsClient
let CWLogClient = new CloudWatchLogsClient();

// Only create logFilterStream if tailLogs is enabled, and we wait for the task to stop in the pipeline
if (tailLogs) {
core.debug(`Logging enabled. Getting logConfiguration from TaskDefinition.`)
Expand Down Expand Up @@ -56612,7 +56615,6 @@ const main = async () => {

// Start Live Tail
try {
const CWLogClient = new CloudWatchLogsClient();
const response = await CWLogClient.send(new StartLiveTailCommand({
logGroupIdentifiers: [logGroupIdentifier],
logStreamNames: [logStreamName]
Expand Down Expand Up @@ -56645,6 +56647,7 @@ const main = async () => {
}

// Close LogStream and store output
CWLogClient.destroy();
core.setOutput('log-output', logOutput);

// Describe Task to get Exit Code and Exceptions
Expand Down Expand Up @@ -56684,7 +56687,15 @@ async function handleCWResponseAsync(response) {
core.error("CWLiveTailSession error: Unknown event type.");
}
} catch (err) {
core.error(err.message)
// If we close the connection, we will get an error with message 'aborted' which we can ignore as it will
// just show as an error in the logs.
if (err.message === 'aborted') {
core.debug("CWLiveTailSession aborted.");

return;
}

core.error(err.name + ": " + err.message);
}
}

Expand Down
15 changes: 13 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ const main = async () => {
return;
}

// Get CWLogsClient
let CWLogClient = new CloudWatchLogsClient();

// Only create logFilterStream if tailLogs is enabled, and we wait for the task to stop in the pipeline
if (tailLogs) {
core.debug(`Logging enabled. Getting logConfiguration from TaskDefinition.`)
Expand Down Expand Up @@ -164,7 +167,6 @@ const main = async () => {

// Start Live Tail
try {
const CWLogClient = new CloudWatchLogsClient();
const response = await CWLogClient.send(new StartLiveTailCommand({
logGroupIdentifiers: [logGroupIdentifier],
logStreamNames: [logStreamName]
Expand Down Expand Up @@ -197,6 +199,7 @@ const main = async () => {
}

// Close LogStream and store output
CWLogClient.destroy();
core.setOutput('log-output', logOutput);

// Describe Task to get Exit Code and Exceptions
Expand Down Expand Up @@ -236,7 +239,15 @@ async function handleCWResponseAsync(response) {
core.error("CWLiveTailSession error: Unknown event type.");
}
} catch (err) {
core.error(err.message)
// If we close the connection, we will get an error with message 'aborted' which we can ignore as it will
// just show as an error in the logs.
if (err.message === 'aborted') {
core.debug("CWLiveTailSession aborted.");

return;
}

core.error(err.name + ": " + err.message);
}
}

Expand Down
Loading

0 comments on commit f73c82a

Please sign in to comment.