Skip to content

Added the possibility to add a description for the deployment #7

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

Open
wants to merge 2 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/main/java/com/amazonaws/codedeploy/AWSCodeDeployPublisher.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public class AWSCodeDeployPublisher extends Publisher {
private final String s3bucket;
private final String s3prefix;
private final String applicationName;
private final String deploymentDescription;
private final String deploymentGroupName; // TODO allow for deployment to multiple groups
private final String deploymentConfig;
private final Long pollingTimeoutSec;
Expand Down Expand Up @@ -109,6 +110,7 @@ public AWSCodeDeployPublisher(
String s3bucket,
String s3prefix,
String applicationName,
String deploymentDescription,
String deploymentGroupName,
String deploymentConfig,
String region,
Expand All @@ -130,6 +132,7 @@ public AWSCodeDeployPublisher(
this.externalId = externalId;
this.applicationName = applicationName;
this.deploymentGroupName = deploymentGroupName;
this.deploymentDescription = deploymentDescription;
if (deploymentConfig != null && deploymentConfig.length() == 0) {
this.deploymentConfig = null;
} else {
Expand Down Expand Up @@ -356,7 +359,7 @@ private void registerRevision(AWSClients aws, RevisionLocation revisionLocation)
}

private String createDeployment(AWSClients aws, RevisionLocation revisionLocation) throws Exception {

String deploymentDescription = getDeploymentDescriptionFromEnv();
this.logger.println("Creating deployment with revision at " + revisionLocation);

CreateDeploymentResult createDeploymentResult = aws.codedeploy.createDeployment(
Expand All @@ -365,7 +368,7 @@ private String createDeployment(AWSClients aws, RevisionLocation revisionLocatio
.withDeploymentGroupName(getDeploymentGroupNameFromEnv())
.withApplicationName(getApplicationNameFromEnv())
.withRevision(revisionLocation)
.withDescription("Deployment created by Jenkins")
.withDescription(deploymentDescription)
);

return createDeploymentResult.getDeploymentId();
Expand Down Expand Up @@ -590,6 +593,10 @@ public String getApplicationName() {
return applicationName;
}

public String getDeploymentDescription(){
return deploymentDescription;
}

public String getDeploymentGroupName() {
return deploymentGroupName;
}
Expand Down Expand Up @@ -669,7 +676,9 @@ public int getProxyPort() {
public String getApplicationNameFromEnv() {
return Util.replaceMacro(this.applicationName, envVars);
}

public String getDeploymentDescriptionFromEnv(){
return Util.replaceMacro(this.deploymentDescription, envVars);
}
public String getDeploymentGroupNameFromEnv() {
return Util.replaceMacro(this.deploymentGroupName, envVars);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
<f:entry title="Proxy Port" field="proxyPort">
<f:textbox default="" />
</f:entry>
<f:entry title="Deployment Description " field="deploymentDescription">
<f:textbox default="Deployment created by Jenkins" />
</f:entry>

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