diff --git a/pom.xml.releaseBackup b/pom.xml.releaseBackup new file mode 100644 index 0000000..28db218 --- /dev/null +++ b/pom.xml.releaseBackup @@ -0,0 +1,81 @@ + + 4.0.0 + + org.jenkins-ci.plugins + plugin + 2.19 + + + codedeploy + 1.15-SNAPSHOT + hpi + com.amazonaws + AWS CodeDeploy Plugin for Jenkins + Adds a post-build step to integrate Jenkins with AWS CodeDeploy + https://wiki.jenkins-ci.org/display/JENKINS/AWS+Codedeploy+plugin + + + + jmcfar + Josh McFarlane + jmcfar@amazon.com + + + + + + Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + scm:git:ssh://github.com/jenkinsci/aws-codedeploy-plugin.git + scm:git:ssh://git@github.com/jenkinsci/aws-codedeploy-plugin.git + https://github.com/jenkinsci/aws-codedeploy-plugin + HEAD + + + + + repo.jenkins-ci.org + http://repo.jenkins-ci.org/public/ + + + + + UTF-8 + 1.580.3 + + + + + org.jenkins-ci.plugins + aws-java-sdk + 1.11.37 + + + + + + repo.jenkins-ci.org + http://repo.jenkins-ci.org/public/ + + + + + + + maven-release-plugin + + + org.apache.maven.plugins + maven-javadoc-plugin + + -Xdoclint:none + + + + + diff --git a/release.properties b/release.properties new file mode 100644 index 0000000..dda7fb0 --- /dev/null +++ b/release.properties @@ -0,0 +1,19 @@ +#release configuration +#Tue Nov 15 18:25:09 UTC 2016 +project.rel.com.amazonaws\:codedeploy=1.15 +scm.tagNameFormat=@{project.artifactId}-@{project.version} +scm.tag=codedeploy-1.15 +project.scm.com.amazonaws\:codedeploy.tag=HEAD +pushChanges=true +scm.url=scm\:git\:ssh\://git@github.com/jenkinsci/aws-codedeploy-plugin.git +preparationGoals=clean install +project.scm.com.amazonaws\:codedeploy.url=https\://github.com/jenkinsci/aws-codedeploy-plugin +project.dev.com.amazonaws\:codedeploy=1.16-SNAPSHOT +project.scm.com.amazonaws\:codedeploy.connection=scm\:git\:ssh\://github.com/jenkinsci/aws-codedeploy-plugin.git +remoteTagging=true +projectVersionPolicyId=default +scm.commentPrefix=[maven-release-plugin] +project.scm.com.amazonaws\:codedeploy.developerConnection=scm\:git\:ssh\://git@github.com/jenkinsci/aws-codedeploy-plugin.git +exec.snapshotReleasePluginAllowed=false +exec.additionalArguments= +completedPhase=end-release diff --git a/src/main/java/com/amazonaws/codedeploy/AWSClients.java b/src/main/java/com/amazonaws/codedeploy/AWSClients.java index 62d6644..75e8560 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 @@ -82,15 +82,15 @@ 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); } diff --git a/src/main/java/com/amazonaws/codedeploy/AWSCodeDeployPublisher.java b/src/main/java/com/amazonaws/codedeploy/AWSCodeDeployPublisher.java index 4a13904..db626b0 100644 --- a/src/main/java/com/amazonaws/codedeploy/AWSCodeDeployPublisher.java +++ b/src/main/java/com/amazonaws/codedeploy/AWSCodeDeployPublisher.java @@ -203,12 +203,21 @@ public void perform(@Nonnull Run build, @Nonnull FilePath workspace, @Nonnu this.proxyHost, this.proxyPort); } else { - aws = AWSClients.fromBasicCredentials( + if (StringUtils.isEmpty(envVars.get(this.awsAccessKey)) && StringUtils.isEmpty(envVars.get(this.awsSecretKey))) { + aws = AWSClients.fromBasicCredentials( this.region, this.awsAccessKey, Secret.toString(this.awsSecretKey), this.proxyHost, this.proxyPort); + } else { + aws = AWSClients.fromBasicCredentials( + this.region, + envVars.get(this.awsAccessKey), + envVars.get(this.awsSecretKey), + this.proxyHost, + this.proxyPort); + } } } else { aws = AWSClients.fromIAMRole( diff --git a/src/main/resources/com/amazonaws/codedeploy/AWSCodeDeployPublisher/help-awsAccessKey.html b/src/main/resources/com/amazonaws/codedeploy/AWSCodeDeployPublisher/help-awsAccessKey.html index bb91a57..8196d20 100644 --- a/src/main/resources/com/amazonaws/codedeploy/AWSCodeDeployPublisher/help-awsAccessKey.html +++ b/src/main/resources/com/amazonaws/codedeploy/AWSCodeDeployPublisher/help-awsAccessKey.html @@ -1,6 +1,8 @@

AWS Access and Secret keys to use for this deployment. At minimum the keys must be allowed to execute - codedeploy:* and s3:Put*. It's a best practice to have these keys be from an IAM role + codedeploy:* and s3:Put*. + You can also use environment variables defined in jenkins's build for this fields. + It's a best practice to have these keys be from an IAM role with limited scope.

diff --git a/src/main/resources/com/amazonaws/codedeploy/AWSCodeDeployPublisher/help-awsSecretKey.html b/src/main/resources/com/amazonaws/codedeploy/AWSCodeDeployPublisher/help-awsSecretKey.html index bb91a57..8196d20 100644 --- a/src/main/resources/com/amazonaws/codedeploy/AWSCodeDeployPublisher/help-awsSecretKey.html +++ b/src/main/resources/com/amazonaws/codedeploy/AWSCodeDeployPublisher/help-awsSecretKey.html @@ -1,6 +1,8 @@

AWS Access and Secret keys to use for this deployment. At minimum the keys must be allowed to execute - codedeploy:* and s3:Put*. It's a best practice to have these keys be from an IAM role + codedeploy:* and s3:Put*. + You can also use environment variables defined in jenkins's build for this fields. + It's a best practice to have these keys be from an IAM role with limited scope.