Skip to content

Commit e4e768d

Browse files
authored
Merge pull request #1 from TonyWael/deployment-description
Added the possibility to add a description for the deployment
2 parents e1bebdd + 46b8c44 commit e4e768d

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ public class AWSCodeDeployPublisher extends Publisher {
8282
private final String s3bucket;
8383
private final String s3prefix;
8484
private final String applicationName;
85+
private final String deploymentDescription;
8586
private final String deploymentGroupName; // TODO allow for deployment to multiple groups
8687
private final String deploymentConfig;
8788
private final Long pollingTimeoutSec;
@@ -109,6 +110,7 @@ public AWSCodeDeployPublisher(
109110
String s3bucket,
110111
String s3prefix,
111112
String applicationName,
113+
String deploymentDescription,
112114
String deploymentGroupName,
113115
String deploymentConfig,
114116
String region,
@@ -130,6 +132,7 @@ public AWSCodeDeployPublisher(
130132
this.externalId = externalId;
131133
this.applicationName = applicationName;
132134
this.deploymentGroupName = deploymentGroupName;
135+
this.deploymentDescription = deploymentDescription;
133136
if (deploymentConfig != null && deploymentConfig.length() == 0) {
134137
this.deploymentConfig = null;
135138
} else {
@@ -356,7 +359,7 @@ private void registerRevision(AWSClients aws, RevisionLocation revisionLocation)
356359
}
357360

358361
private String createDeployment(AWSClients aws, RevisionLocation revisionLocation) throws Exception {
359-
362+
String deploymentDescription = getDeploymentDescriptionFromEnv();
360363
this.logger.println("Creating deployment with revision at " + revisionLocation);
361364

362365
CreateDeploymentResult createDeploymentResult = aws.codedeploy.createDeployment(
@@ -365,7 +368,7 @@ private String createDeployment(AWSClients aws, RevisionLocation revisionLocatio
365368
.withDeploymentGroupName(getDeploymentGroupNameFromEnv())
366369
.withApplicationName(getApplicationNameFromEnv())
367370
.withRevision(revisionLocation)
368-
.withDescription("Deployment created by Jenkins")
371+
.withDescription(deploymentDescription)
369372
);
370373

371374
return createDeploymentResult.getDeploymentId();
@@ -590,6 +593,10 @@ public String getApplicationName() {
590593
return applicationName;
591594
}
592595

596+
public String getDeploymentDescription(){
597+
return deploymentDescription;
598+
}
599+
593600
public String getDeploymentGroupName() {
594601
return deploymentGroupName;
595602
}
@@ -669,7 +676,9 @@ public int getProxyPort() {
669676
public String getApplicationNameFromEnv() {
670677
return Util.replaceMacro(this.applicationName, envVars);
671678
}
672-
679+
public String getDeploymentDescriptionFromEnv(){
680+
return Util.replaceMacro(this.deploymentDescription, envVars);
681+
}
673682
public String getDeploymentGroupNameFromEnv() {
674683
return Util.replaceMacro(this.deploymentGroupName, envVars);
675684
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
<f:entry title="Proxy Port" field="proxyPort">
3333
<f:textbox default="" />
3434
</f:entry>
35+
<f:entry title="Deployment Description " field="deploymentDescription">
36+
<f:textbox default="Deployment created by Jenkins" />
37+
</f:entry>
3538

3639
<f:entry title="Appspec.yml per Deployment Group" field="deploymentGroupAppspec">
3740
<f:checkbox field="deploymentGroupAppspec" checked="${instance.getDeploymentGroupAppspec}"/>

0 commit comments

Comments
 (0)