Skip to content

Commit 416d904

Browse files
committed
Fix Wait parameters and passing in blank Deployment Config.
1 parent 4f60906 commit 416d904

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

src/main/java/com/amazonaws/codedeploy/AWSCodeDeployPublisher.java

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@
7373
* credentials to be configured for each project.
7474
*/
7575
public class AWSCodeDeployPublisher extends Publisher {
76-
public static final String POLLING_TIMEOUT_KEY = "pollingTimeoutSec";
77-
public static final String POLLING_FREQ_KEY = "pollingFreqSec";
7876
public static final long DEFAULT_TIMEOUT_SECONDS = 900;
7977
public static final long DEFAULT_POLLING_FREQUENCY_SECONDS = 15;
8078
public static final String ROLE_SESSION_NAME = "jenkins-codedeploy-plugin";
@@ -112,7 +110,9 @@ public AWSCodeDeployPublisher(
112110
String deploymentGroupName,
113111
String deploymentConfig,
114112
String region,
115-
JSONObject waitForCompletion,
113+
Boolean waitForCompletion,
114+
Long pollingTimeoutSec,
115+
Long pollingFreqSec,
116116
String credentials,
117117
String awsAccessKey,
118118
String awsSecretKey,
@@ -127,7 +127,11 @@ public AWSCodeDeployPublisher(
127127
this.externalId = externalId;
128128
this.applicationName = applicationName;
129129
this.deploymentGroupName = deploymentGroupName;
130-
this.deploymentConfig = deploymentConfig;
130+
if (deploymentConfig != null && deploymentConfig.length() == 0) {
131+
this.deploymentConfig = null;
132+
} else {
133+
this.deploymentConfig = deploymentConfig;
134+
}
131135
this.region = region;
132136
this.includes = includes;
133137
this.excludes = excludes;
@@ -139,19 +143,17 @@ public AWSCodeDeployPublisher(
139143
this.awsSecretKey = awsSecretKey;
140144
this.iamRoleArn = iamRoleArn;
141145

142-
if (waitForCompletion != null) {
143-
this.waitForCompletion = true;
144-
145-
if (waitForCompletion.containsKey(POLLING_TIMEOUT_KEY)) {
146-
this.pollingTimeoutSec = waitForCompletion.getLong(POLLING_TIMEOUT_KEY);
147-
} else {
146+
if (waitForCompletion != null && waitForCompletion) {
147+
this.waitForCompletion = waitForCompletion;
148+
if (pollingTimeoutSec == null) {
148149
this.pollingTimeoutSec = DEFAULT_TIMEOUT_SECONDS;
149-
}
150-
151-
if (waitForCompletion.containsKey(POLLING_FREQ_KEY)) {
152-
this.pollingFreqSec = waitForCompletion.getLong(POLLING_FREQ_KEY);
153150
} else {
151+
this.pollingTimeoutSec = pollingTimeoutSec;
152+
}
153+
if (pollingFreqSec == null) {
154154
this.pollingFreqSec = DEFAULT_POLLING_FREQUENCY_SECONDS;
155+
} else {
156+
this.pollingFreqSec = pollingFreqSec;
155157
}
156158
} else {
157159
this.waitForCompletion = false;

src/main/resources/com/amazonaws/codedeploy/AWSCodeDeployPublisher/config.jelly

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@
3333
<f:textbox default="" />
3434
</f:entry>
3535

36-
<f:optionalBlock title="Wait for deployment to finish?" field="waitForCompletion" checked="${instance.getWaitForCompletion()}">
37-
<f:entry title="Polling Timeout (s)" field="pollingTimeout">
36+
<f:optionalBlock title="Wait for deployment to finish?" field="waitForCompletion" checked="${instance.getWaitForCompletion()}" inline="true">
37+
<f:entry title="Polling Timeout (s)" field="pollingTimeoutSec">
3838
<f:textbox default="300"/>
3939
</f:entry>
40-
<f:entry title="Polling Frequency (s)" field="pollingFreq">
40+
<f:entry title="Polling Frequency (s)" field="pollingFreqSec">
4141
<f:textbox default="15"/>
4242
</f:entry>
4343
</f:optionalBlock>

0 commit comments

Comments
 (0)