diff --git a/pom.xml b/pom.xml
index 6234a67..c3a7eea 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
codedeploy
- 1.17-SNAPSHOT
+ 1.17-CONTENT
hpi
com.amazonaws
AWS CodeDeploy Plugin for Jenkins
@@ -52,9 +52,9 @@
- org.jenkins-ci.plugins
+ com.amazonaws
aws-java-sdk
- 1.11.119
+ 1.11.203
diff --git a/src/main/java/com/amazonaws/codedeploy/AWSClients.java b/src/main/java/com/amazonaws/codedeploy/AWSClients.java
index 376c3c1..88c3517 100644
--- a/src/main/java/com/amazonaws/codedeploy/AWSClients.java
+++ b/src/main/java/com/amazonaws/codedeploy/AWSClients.java
@@ -1,12 +1,12 @@
/*
* Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
- *
+ *
* http://aws.amazon.com/apache2.0
- *
+ *
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
@@ -74,20 +74,20 @@ public AWSClients(String region, AWSCredentials credentials, String proxyHost, i
codedeploy.setRegion(Region.getRegion(Regions.fromName(this.region)));
s3.setRegion(Region.getRegion(Regions.fromName(this.region)));
}
-
+
public static AWSClients fromDefaultCredentialChain(String region, String proxyHost, int proxyPort) {
return new AWSClients(region, null, proxyHost, proxyPort);
}
-
+
public static AWSClients fromIAMRole(String region, String iamRole, String externalId, String proxyHost, int proxyPort) {
return new AWSClients(region, getCredentials(iamRole, externalId), proxyHost, proxyPort);
}
-
+
public static AWSClients fromBasicCredentials(String region, String awsAccessKey, String awsSecretKey, String proxyHost, int proxyPort) {
return new AWSClients(region, new BasicAWSCredentials(awsAccessKey, awsSecretKey), proxyHost, proxyPort);
}
- /**
+ /*
* Via the default provider chain (i.e., global keys for this Jenkins instance), return the account ID for the
* currently authenticated user.
* @return 12-digit account id
diff --git a/src/main/java/com/amazonaws/codedeploy/AWSCodeDeployPublisher.java b/src/main/java/com/amazonaws/codedeploy/AWSCodeDeployPublisher.java
index 7ecc46f..abe2237 100644
--- a/src/main/java/com/amazonaws/codedeploy/AWSCodeDeployPublisher.java
+++ b/src/main/java/com/amazonaws/codedeploy/AWSCodeDeployPublisher.java
@@ -67,7 +67,7 @@
import javax.servlet.ServletException;
-/**
+/*
* The AWS CodeDeploy Publisher is a post-build plugin that adds the ability to start a new CodeDeploy deployment
* with the project's workspace as the application revision.
*
@@ -104,6 +104,7 @@ public class AWSCodeDeployPublisher extends Publisher {
private final String credentials;
private final String deploymentMethod;
private final String versionFileName;
+ private final String fileExistsBehaviour;
private PrintStream logger;
private Map envVars;
@@ -131,7 +132,8 @@ public AWSCodeDeployPublisher(
String proxyHost,
int proxyPort,
String excludes,
- String subdirectory) {
+ String subdirectory,
+ String fileExistsBehaviour) {
this.externalId = externalId;
this.applicationName = applicationName;
@@ -154,6 +156,7 @@ public AWSCodeDeployPublisher(
this.awsSecretKey = awsSecretKey;
this.iamRoleArn = iamRoleArn;
this.deploymentGroupAppspec = deploymentGroupAppspec;
+ this.fileExistsBehaviour = fileExistsBehaviour;
if (waitForCompletion != null && waitForCompletion) {
this.waitForCompletion = waitForCompletion;
@@ -419,6 +422,7 @@ private String createDeployment(AWSClients aws, RevisionLocation revisionLocatio
.withApplicationName(getApplicationNameFromEnv())
.withRevision(revisionLocation)
.withDescription("Deployment created by Jenkins")
+ .withFileExistsBehavior(getFileExistsBehaviour())
);
return createDeploymentResult.getDeploymentId();
@@ -492,7 +496,7 @@ public BuildStepMonitor getRequiredMonitorService() {
return BuildStepMonitor.STEP;
}
- /**
+ /*
* Descriptor for {@link AWSCodeDeployPublisher}. Used as a singleton.
* The class is marked as public so that it can be accessed from views.
*
@@ -727,6 +731,10 @@ public int getProxyPort() {
return proxyPort;
}
+ public String getFileExistsBehaviour() {
+ return fileExistsBehaviour;
+ }
+
public String getApplicationNameFromEnv() {
return Util.replaceMacro(this.applicationName, envVars);
}
diff --git a/src/main/resources/com/amazonaws/codedeploy/AWSCodeDeployPublisher/config.jelly b/src/main/resources/com/amazonaws/codedeploy/AWSCodeDeployPublisher/config.jelly
index 104cdb1..3896d08 100644
--- a/src/main/resources/com/amazonaws/codedeploy/AWSCodeDeployPublisher/config.jelly
+++ b/src/main/resources/com/amazonaws/codedeploy/AWSCodeDeployPublisher/config.jelly
@@ -61,6 +61,26 @@
+
+
+
+ The deployment fails. This is also the default behavior if no option is specified.
+
+
+
+
+
+ The version of the file from the application revision currently being deployed replaces the version already on the instance.
+
+
+
+
+
+ The version of the file already on the instance is kept and used as part of the new deployment.
+
+
+
+
If these keys are left blank, the plugin will attempt to use credentials from the default provider chain. That