Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for configurable retry-count #510

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ inputs:
force-new-deployment:
description: 'Whether to force a new deployment of the service. Valid value is "true". Will default to not force a new deployment.'
required: false
max-retries:
description: 'Number of times to retry AWS API requests when encountering network or rate-limit errors. Default is 3.'
required: false
outputs:
task-definition-arn:
description: 'The ARN of the registered ECS task definition'
Expand Down
17 changes: 10 additions & 7 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,18 +260,12 @@ async function createCodeDeployDeployment(codedeploy, clusterName, service, task

async function run() {
try {
const ecs = new aws.ECS({
customUserAgent: 'amazon-ecs-deploy-task-definition-for-github-actions'
});
const codedeploy = new aws.CodeDeploy({
customUserAgent: 'amazon-ecs-deploy-task-definition-for-github-actions'
});

// Get inputs
const taskDefinitionFile = core.getInput('task-definition', { required: true });
const service = core.getInput('service', { required: false });
const cluster = core.getInput('cluster', { required: false });
const waitForService = core.getInput('wait-for-service-stability', { required: false });
const maxRetries = core.getInput('max-retries', { required: false }) || 3;
let waitForMinutes = parseInt(core.getInput('wait-for-minutes', { required: false })) || 30;
if (waitForMinutes > MAX_WAIT_MINUTES) {
waitForMinutes = MAX_WAIT_MINUTES;
Expand All @@ -282,6 +276,15 @@ async function run() {
const desiredCount = parseInt((core.getInput('desired-count', {required: false})));


const ecs = new aws.ECS({
Copy link
Contributor

@trivikr trivikr May 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR needs to be rebased to use AWS SDK for JavaScript (v3) which uses maxAttempts

Refer: #529

customUserAgent: 'amazon-ecs-deploy-task-definition-for-github-actions',
maxRetries
});
const codedeploy = new aws.CodeDeploy({
customUserAgent: 'amazon-ecs-deploy-task-definition-for-github-actions',
maxRetries
});

// Register the task definition
core.debug('Registering the task definition');
const taskDefPath = path.isAbsolute(taskDefinitionFile) ?
Expand Down
17 changes: 10 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,18 +254,12 @@ async function createCodeDeployDeployment(codedeploy, clusterName, service, task

async function run() {
try {
const ecs = new aws.ECS({
customUserAgent: 'amazon-ecs-deploy-task-definition-for-github-actions'
});
const codedeploy = new aws.CodeDeploy({
customUserAgent: 'amazon-ecs-deploy-task-definition-for-github-actions'
});

// Get inputs
const taskDefinitionFile = core.getInput('task-definition', { required: true });
const service = core.getInput('service', { required: false });
const cluster = core.getInput('cluster', { required: false });
const waitForService = core.getInput('wait-for-service-stability', { required: false });
const maxRetries = core.getInput('max-retries', { required: false }) || 3;
let waitForMinutes = parseInt(core.getInput('wait-for-minutes', { required: false })) || 30;
if (waitForMinutes > MAX_WAIT_MINUTES) {
waitForMinutes = MAX_WAIT_MINUTES;
Expand All @@ -276,6 +270,15 @@ async function run() {
const desiredCount = parseInt((core.getInput('desired-count', {required: false})));


const ecs = new aws.ECS({
customUserAgent: 'amazon-ecs-deploy-task-definition-for-github-actions',
maxRetries
});
const codedeploy = new aws.CodeDeploy({
customUserAgent: 'amazon-ecs-deploy-task-definition-for-github-actions',
maxRetries
});

// Register the task definition
core.debug('Registering the task definition');
const taskDefPath = path.isAbsolute(taskDefinitionFile) ?
Expand Down