Skip to content

Commit ab57672

Browse files
committed
Merge pull request #35 from jordiclariana/master
Enable the use of environment variables in Application Group Name
2 parents 6ab34c0 + cdd7677 commit ab57672

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public class AWSCodeDeployPublisher extends Publisher {
8181
private final String s3bucket;
8282
private final String s3prefix;
8383
private final String applicationName;
84-
private final String deploymentGroupName; // TODO allow for deployment to multiple groups
84+
private String deploymentGroupName; // TODO allow for deployment to multiple groups
8585
private final String deploymentConfig;
8686
private final Long pollingTimeoutSec;
8787
private final Long pollingFreqSec;
@@ -209,10 +209,13 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis
209209

210210
try {
211211

212+
Map<String, String> envVars = build.getEnvironment(listener);
213+
this.deploymentGroupName = Util.replaceMacro(this.deploymentGroupName, envVars);
214+
212215
verifyCodeDeployApplication(aws);
213216

214217
String projectName = build.getProject().getName();
215-
RevisionLocation revisionLocation = zipAndUpload(aws, projectName, getSourceDirectory(build.getWorkspace()), build.getEnvironment(listener));
218+
RevisionLocation revisionLocation = zipAndUpload(aws, projectName, getSourceDirectory(build.getWorkspace()), envVars);
216219

217220
registerRevision(aws, revisionLocation);
218221
String deploymentId = createDeployment(aws, revisionLocation);

src/main/resources/com/amazonaws/codedeploy/AWSCodeDeployPublisher/help-applicationName.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
The name of the AWS CodeDeploy application you wish to deploy to. This plugin assumes that you've
33
already created the application and deployment group. If you haven't already, work through the <a
44
href="http://alpha-docs-aws.amazon.com/codedeploy/latest/userguide/how-to-create-application.html">How
5-
to create an Application with AWS CodeDeploy</a> documentation.
5+
to create an Application with AWS CodeDeploy</a> documentation. You can use environment variables
6+
in this field.
67
</div>

0 commit comments

Comments
 (0)