Skip to content

Commit

Permalink
chore(release): 1.0.7-alpha.1 [skip ci]
Browse files Browse the repository at this point in the history
## [1.0.7-alpha.1](v1.0.6...v1.0.7-alpha.1) (2021-08-26)

### Bug Fixes

* release 1.0.7 ([d39d37a](d39d37a))
  • Loading branch information
semantic-release-bot committed Aug 26, 2021
1 parent bcf0385 commit 01f35cf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## [1.0.7-alpha.1](https://github.com/scribd/amazon-ecs-service-action/compare/v1.0.6...v1.0.7-alpha.1) (2021-08-26)


### Bug Fixes

* release 1.0.7 ([d39d37a](https://github.com/scribd/amazon-ecs-service-action/commit/d39d37ac73e36bb85ed929a8d2306b2316479ae8))

## [1.0.6](https://github.com/scribd/amazon-ecs-service-action/compare/v1.0.5...v1.0.6) (2021-08-26)


Expand Down
18 changes: 12 additions & 6 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ async function doWaitUntilServiceInactive(client, parameters) {
*/
async function waitUntilTasksRunningIfCalledFor(client, parameters) {
if (parameters.waitUntilTasksRunning) {
core.info('...Waiting up to one hour for tasks to enter a RUNNING state...');
const result = await waitUntilTasksRunning({client, maxWaitTime: 3600}, describeInput(parameters));
core.info('...Waiting for tasks to enter a RUNNING state (for 2 minutes)...');
const result = await waitUntilTasksRunning(client, describeInput(parameters));
if (result.state === 'SUCCESS') {
core.info('...tasks are RUNNING...');
} else {
Expand Down Expand Up @@ -346,7 +346,9 @@ function isUpdateShapeValid(currentService, updateParams) {
async function updateService(client, parameters) {
const command = new UpdateServiceCommand(updateInput(parameters));
const response = await client.send(command);

await waitUntilTasksRunningIfCalledFor(client, parameters);

const found = findServiceInResponse(response, parameters.spec.serviceName);
core.info(`Updated ${parameters.spec.serviceName}.`);
return found;
Expand Down Expand Up @@ -463,9 +465,11 @@ async function describeService(client, parameters) {
async function createService(client, parameters) {
const command = new CreateServiceCommand(createInput(parameters));
const response = await client.send(command);

await waitUntilTasksRunningIfCalledFor(client, parameters);

const found = findServiceInResponse(response, parameters.spec.serviceName);
core.info(`Created ${parameters.spec.serviceName}.`);
core.info(`...created ${parameters.spec.serviceName}.`);
return found;
}

Expand All @@ -486,11 +490,13 @@ async function createService(client, parameters) {
*/
async function handlefindCreateOrUpdateServiceErrors(client, parameters, err) {
if (err.name === 'NotFoundException') {
core.info(`Unable to find ${parameters.spec.serviceName}. Creating newly.`);
core.info(`Unable to find ${parameters.spec.serviceName}. Creating newly...`);
return await createService(client, parameters);
} else if (err.name === 'Draining') {
core.info(`Service ${parameters.spec.serviceName} is draining. Creating newly after waiting up to an hour for it to enter an INACTIVE state...`);
await doWaitUntilServiceInactive({client, maxWaitTime: 3600}, parameters);

await doWaitUntilServiceInactive(client, parameters);

core.info('...service is now INACTIVE...');
return await createService(client, parameters);
} else {
Expand Down Expand Up @@ -520,7 +526,7 @@ async function findCreateOrUpdateService(client, parameters) {
throw new NeedsReplacement(`The Service needs to be replaced, as the following changes cannot be made: ${JSON.stringify(_.at(updateParams, additionalKeys))}.`);
}
} else {
core.info(`Found ${parameters.spec.serviceName}. No further action needed.`);
core.info(`${parameters.spec.serviceName} looks good. No further action needed.`);
return found;
}
}
Expand Down

0 comments on commit 01f35cf

Please sign in to comment.