Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 97ede50

Browse files
authored
Fix handling of concurrent deployments (#24)
It seems AWS changed the error message emitted when another deployment is already active. Fixes #22.
1 parent 0e6395e commit 97ede50

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

‎create-deployment.js‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,16 @@ exports.createDeployment = async function(applicationName, fullRepositoryName, b
138138
break;
139139
} catch (e) {
140140
if (e.code == 'DeploymentLimitExceededException') {
141-
var [, otherDeployment] = e.message.toString().match(/isalreadydeployingdeployment\'(d-\w+)\'/);
141+
let message = e.message.toString();
142+
let found = message.match(/(?:isalreadydeploying|alreadyhasanactiveDeployment)\'(d-\w+)\'/);
143+
144+
if (!found) {
145+
console.log(`🐞 Unexpected exception message: ${message}`);
146+
core.setFailed('Aborting');
147+
throw e;
148+
}
149+
150+
let [, otherDeployment] = found;
142151
console.log(`😶 Waiting for another pending deployment ${otherDeployment}`);
143152
try {
144153
await codeDeploy.waitFor('deploymentSuccessful', {deploymentId: otherDeployment}).promise();

‎dist/index.js‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,16 @@ exports.createDeployment = async function(applicationName, fullRepositoryName, b
154154
break;
155155
} catch (e) {
156156
if (e.code == 'DeploymentLimitExceededException') {
157-
var [, otherDeployment] = e.message.toString().match(/is already deploying deployment \'(d-\w+)\'/);
157+
let message = e.message.toString();
158+
let found = message.match(/(?:is already deploying|already has an active Deployment) \'(d-\w+)\'/);
159+
160+
if (!found) {
161+
console.log(`🐞 Unexpected exception message: ${message}`);
162+
core.setFailed('Aborting');
163+
throw e;
164+
}
165+
166+
let [, otherDeployment] = found;
158167
console.log(`😶 Waiting for another pending deployment ${otherDeployment}`);
159168
try {
160169
await codeDeploy.waitFor('deploymentSuccessful', {deploymentId: otherDeployment}).promise();

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /