diff --git a/src/main/java/com/amazonaws/codedeploy/AWSCodeDeployPublisher.java b/src/main/java/com/amazonaws/codedeploy/AWSCodeDeployPublisher.java
index e39fe9e..5f7b77d 100644
--- a/src/main/java/com/amazonaws/codedeploy/AWSCodeDeployPublisher.java
+++ b/src/main/java/com/amazonaws/codedeploy/AWSCodeDeployPublisher.java
@@ -107,6 +107,7 @@ public class AWSCodeDeployPublisher extends Publisher implements SimpleBuildStep
private final String awsSecretKey;
private final String credentials;
private final String deploymentMethod;
+ private final String zipNamePrefix;
private final String versionFileName;
private PrintStream logger;
@@ -127,6 +128,7 @@ public AWSCodeDeployPublisher(
Long pollingTimeoutSec,
Long pollingFreqSec,
String credentials,
+ String zipNamePrefix,
String versionFileName,
String deploymentMethod,
String awsAccessKey,
@@ -155,6 +157,7 @@ public AWSCodeDeployPublisher(
this.proxyPort = proxyPort;
this.credentials = credentials;
this.deploymentMethod = deploymentMethod;
+ this.zipNamePrefix = zipNamePrefix;
this.versionFileName = versionFileName;
this.awsAccessKey = awsAccessKey;
this.awsSecretKey = awsSecretKey;
@@ -230,7 +233,14 @@ public void perform(@Nonnull Run,?> build, @Nonnull FilePath workspace, @Nonnu
verifyCodeDeployApplication(aws);
- final String projectName = build.getDisplayName();
+ String projectName = null;
+ logger.println("Zip name prefix: " + this.zipNamePrefix );
+ if (this.zipNamePrefix != null && this.zipNamePrefix.trim().length() > 0) {
+ projectName = build.getEnvironment(listener).expand(zipNamePrefix.trim());
+ } else {
+ projectName = build.getDisplayName();
+ }
+
if (workspace == null) {
throw new IllegalArgumentException("No workspace present for the build.");
}
@@ -317,6 +327,8 @@ private RevisionLocation zipAndUpload(AWSClients aws, String projectName, FilePa
File versionFile;
versionFile = new File(sourceDirectory + "/" + versionFileName);
+ logger.println("Project name: " + projectName + " - Version file path : " + versionFile.getAbsolutePath() + " - Version filename : " + versionFileName);
+
InputStreamReader reader = null;
String version = null;
try {
@@ -332,7 +344,9 @@ private RevisionLocation zipAndUpload(AWSClients aws, String projectName, FilePa
}
if (version != null){
- zipFile = new File("/tmp/" + projectName + "-" + version + ".zip");
+ String tempDir = System.getProperty("java.io.tmpdir");
+
+ zipFile = new File(tempDir + File.separator + projectName + "-" + version + ".zip");
final boolean fileCreated = zipFile.createNewFile();
if (!fileCreated) {
logger.println("File already exists, overwriting: " + zipFile.getPath());
@@ -713,6 +727,10 @@ public String getDeploymentMethod() {
return deploymentMethod;
}
+ public String getZipNamePrefix() {
+ return zipNamePrefix;
+ }
+
public String getVersionFileName() {
return versionFileName;
}
diff --git a/src/main/resources/com/amazonaws/codedeploy/AWSCodeDeployPublisher/config.jelly b/src/main/resources/com/amazonaws/codedeploy/AWSCodeDeployPublisher/config.jelly
index d3ba81d..2b5fe3a 100644
--- a/src/main/resources/com/amazonaws/codedeploy/AWSCodeDeployPublisher/config.jelly
+++ b/src/main/resources/com/amazonaws/codedeploy/AWSCodeDeployPublisher/config.jelly
@@ -39,6 +39,9 @@