Skip to content

Commit

Permalink
Merge pull request #55 from railsware/update-dependencies
Browse files Browse the repository at this point in the history
Update AWS SDK
  • Loading branch information
JSFernandes authored Nov 27, 2023
2 parents 9b3c4f6 + 0e078eb commit 1ee9365
Show file tree
Hide file tree
Showing 18 changed files with 1,009 additions and 236 deletions.
2 changes: 1 addition & 1 deletion fetch-task-definition/dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion fetch-task-definition/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"@actions/core": "^1.9.1"
},
"devDependencies": {
"@vercel/ncc": "~>0.23.0"
"@vercel/ncc": "~>0.38.1"
},
"scripts": {
"prepublish": "node_modules/.bin/ncc build index.js -m -o dist",
Expand Down
2 changes: 1 addition & 1 deletion github-ref-to-env/dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion github-ref-to-env/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"@actions/core": "^1.9.1"
},
"devDependencies": {
"@vercel/ncc": "~>0.23.0"
"@vercel/ncc": "~>0.38.1"
},
"scripts": {
"prepublish": "node_modules/.bin/ncc build index.js -m -o dist",
Expand Down
17 changes: 16 additions & 1 deletion read-from-ssm-param-store/dist/index.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions read-from-ssm-param-store/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"private": true,
"dependencies": {
"@actions/core": "^1.9.1",
"aws-sdk": "^2.814.0"
"@aws-sdk/client-ssm": "^3.178.0"
},
"devDependencies": {
"@vercel/ncc": "~>0.23.0"
"@vercel/ncc": "~>0.38.1"
},
"scripts": {
"prepublish": "node_modules/.bin/ncc build index.js -m -o dist",
Expand Down
6 changes: 3 additions & 3 deletions read-from-ssm-param-store/readFromParamStore.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const AWS = require("aws-sdk");
const { SSM } = require('@aws-sdk/client-ssm');

const SECURE_MARKER = 'SECURE';

async function readFromParamStore (path, region) {
const client = new AWS.SSM({
const client = new SSM({
region: region
});

Expand Down Expand Up @@ -39,7 +39,7 @@ async function readAllParams(client, path, nextToken) {
Recursive: true,
WithDecryption: false,
NextToken: nextToken
}).promise()
})

if (data.NextToken) {
return data.Parameters.concat(await readAllParams(client, path, data.NextToken));
Expand Down
17 changes: 16 additions & 1 deletion register-ecs-task-definition/dist/index.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions register-ecs-task-definition/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const core = require("@actions/core");
const AWS = require("aws-sdk");
const { ECS } = require('@aws-sdk/client-ecs');
const fs = require('fs');
const path = require('path');

async function run() {
try {
const ecs = new AWS.ECS();
const ecs = new ECS();
const taskDefinitionPath = core.getInput('task-definition', { required: true });

const fullPath = path.isAbsolute(taskDefinitionPath) ?
Expand All @@ -14,7 +14,7 @@ async function run() {
const taskDefinition = JSON.parse(fs.readFileSync(fullPath, 'utf8'));

let response;
response = await ecs.registerTaskDefinition(taskDefinition).promise();
response = await ecs.registerTaskDefinition(taskDefinition);
core.setOutput('task_definition_arn', response.taskDefinition.taskDefinitionArn);
} catch (error) {
core.setFailed("Failed to register task definition in ECS: " + error.message);
Expand Down
4 changes: 2 additions & 2 deletions register-ecs-task-definition/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"private": true,
"dependencies": {
"@actions/core": "^1.9.1",
"aws-sdk": "^2.814.0"
"@aws-sdk/client-ecs": "^3.6.0"
},
"devDependencies": {
"@vercel/ncc": "~>0.23.0"
"@vercel/ncc": "~>0.38.1"
},
"scripts": {
"prepublish": "node_modules/.bin/ncc build index.js -m -o dist",
Expand Down
4 changes: 1 addition & 3 deletions run-ecs-task/__tests__/runEcsTask.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ const runEcsTask = require('../runEcsTask')

describe('runEcsTask', () => {
const buildMock = (data) => (
jest.fn().mockReturnValue({
promise: () => Promise.resolve(data)
})
jest.fn().mockReturnValue(data)
)
const buildEcsMock = ({
describeServices = buildMock({
Expand Down
17 changes: 16 additions & 1 deletion run-ecs-task/dist/index.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions run-ecs-task/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const core = require("@actions/core");
const AWS = require("aws-sdk");
const { ECS } = require("@aws-sdk/client-ecs");
const runEcsTask = require("./runEcsTask")

async function run() {
Expand All @@ -12,7 +12,7 @@ async function run() {
const waitForCompletion = core.getInput("wait-for-completion", { required: false });
const showRawOutput = core.getInput("show-raw-output", { required: false });

const ecs = new AWS.ECS();
const ecs = new ECS();

await runEcsTask({
ecs,
Expand Down
5 changes: 3 additions & 2 deletions run-ecs-task/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
"private": true,
"dependencies": {
"@actions/core": "^1.9.1",
"aws-sdk": "^2.814.0"
"@aws-sdk/client-cloudwatch-logs": "^3.454.0",
"@aws-sdk/client-ecs": "^3.6.0"
},
"devDependencies": {
"@vercel/ncc": "~>0.23.0"
"@vercel/ncc": "~>0.38.1"
},
"scripts": {
"prepublish": "node_modules/.bin/ncc build index.js -m -o dist",
Expand Down
6 changes: 3 additions & 3 deletions run-ecs-task/readTaskLogs.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
const AWS = require("aws-sdk");
const { CloudWatchLogs } = require('@aws-sdk/client-cloudwatch-logs');

async function readTaskLogs(logConfig, containerName, taskId) {
let nextToken = null
if (logConfig.logDriver !== 'awslogs') {
throw new Error(`Unsupported log driver ${logConfig.logDriver}. Only 'awslogs' is supported`)
}

const cloudWatchLogs = new AWS.CloudWatchLogs()
const cloudWatchLogs = new CloudWatchLogs()

const params = {
logGroupName: logConfig.options['awslogs-group'],
Expand All @@ -20,7 +20,7 @@ async function readTaskLogs(logConfig, containerName, taskId) {
const {events, nextForwardToken} = await cloudWatchLogs.getLogEvents({
...params,
nextToken: nextToken
}).promise();
});
if (events.length === 0) {
break;
}
Expand Down
3 changes: 0 additions & 3 deletions run-ecs-task/runEcsTask.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ async function runEcsTask({ ecs, cluster, serviceName, definedContainerName, com
core.debug("Describing ecs services");
const servicesResponse = await ecs
.describeServices({ cluster, services: [serviceName] })
.promise();

if (!servicesResponse.services || servicesResponse.services.length === 0) {
throw new Error("no such service");
Expand All @@ -19,7 +18,6 @@ async function runEcsTask({ ecs, cluster, serviceName, definedContainerName, com
.describeTaskDefinition({
taskDefinition: givenTaskDefinition || service.taskDefinition,
})
.promise();

const containerName = (() => {
if (definedContainerName) {
Expand Down Expand Up @@ -55,7 +53,6 @@ async function runEcsTask({ ecs, cluster, serviceName, definedContainerName, com
},
networkConfiguration
})
.promise();

const taskArn = taskResponse.tasks[0].taskArn;
const taskArnParts = taskArn.split(":");
Expand Down
1 change: 0 additions & 1 deletion run-ecs-task/waitTaskToComplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ async function waitTaskToComplete(ecs, cluster, taskID) {
.describeTasks({
cluster: cluster, tasks: [taskID]
})
.promise();

task = tasks[0]
} while (task.lastStatus !== 'STOPPED')
Expand Down
Loading

0 comments on commit 1ee9365

Please sign in to comment.