Skip to content
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

[JENKINS-56927] Implementation of credentials for private SSH keys used by EC2 plugin #445

Merged
merged 51 commits into from
Aug 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
3a77b9e
Main places now manage private key through ssh-credentials plugin
djesionek Mar 13, 2020
4aac4c0
Now credentials id is being peristed instead of private key itself
djesionek Mar 16, 2020
aecb6bc
[JENKINS-56927] Main places now manage private key through ssh-creden…
djesionek Mar 13, 2020
3084309
[JENKINS-56927] Now credentials id is being peristed instead of priva…
djesionek Mar 16, 2020
29ca034
[JENKINS-56927] First credential migration changes
djesionek Mar 17, 2020
e06e134
[JENKINS-56927] Refactored migration code a bit and added migration o…
djesionek Mar 17, 2020
788a387
[JENKINS-56927] Added trimming of migrated private key
djesionek Mar 17, 2020
9fec334
[JENKINS-56927] Removed privateKey from persisted data
djesionek Mar 18, 2020
560ffa6
[JENKINS-56927] Now handling reference to missing credentials
djesionek Mar 18, 2020
7f7ad8f
[JENKINS-56927] Removed test for private key input field
djesionek Mar 18, 2020
509e062
[JENKINS-56927] BouncyCastleProvider is now being injected in private…
djesionek Mar 18, 2020
6681aca
[JENKINS-56927] Fixed tests where private key dummy is used
djesionek Mar 18, 2020
963ee0e
Merged origin
djesionek Mar 19, 2020
0e516c3
[JENKINS-56927] Fixed backwards compatibility for tests
djesionek Mar 19, 2020
df859e3
[JENKINS-56927] Updated config as code export test
djesionek Mar 19, 2020
c9578bc
[JENKINS-56927] Implemented private key credential store for eucalyptus
djesionek Mar 19, 2020
551dd3b
[JENKINS-56927] Resolving of credential id now happens on demand and …
djesionek Mar 19, 2020
5eaa1a4
[JENKINS-56927] Minor code cleanup
djesionek Mar 19, 2020
4868bb1
[JENKINS-56927] Fixed bugs found by spotbugs
djesionek Mar 20, 2020
997fdc8
[JENKINS-56927] Fixed warnings found by spotbugs
djesionek Mar 20, 2020
ab02e81
[JENKINS-56927] Apply update of deps as suggested
djesionek Apr 8, 2020
1e8bf07
[JENKINS-56927] Removed user scoping of credentials as suggested
djesionek Apr 8, 2020
6ecfe8f
[JENKINS-56927] Added permission checks as suggested
djesionek Apr 8, 2020
197e2fe
[JENKINS-56927] Pulled duplicates to common superclass
djesionek Apr 8, 2020
d04f9ad
Revert "[JENKINS-56927] Pulled duplicates to common superclass"
djesionek Apr 8, 2020
6b0822a
[JENKINS-56927] Pulled duplicates to common superclass
djesionek Apr 8, 2020
c10c3f0
[JENKINS-56927] Resolved dependency errors with bom
djesionek Apr 8, 2020
33c2fac
Merge branch 'master' into JENKINS-56927
djesionek Apr 8, 2020
37ab647
JENKINS-56927: Replaced star imports
djesionek Apr 13, 2020
81ee588
JENKINS-56927: Applied suggested changes
djesionek Apr 13, 2020
9b1c4a2
JENKINS-56927: Removed changes made on test
djesionek Apr 13, 2020
2d9d7af
JENKINS-56927: Applied suggested changes
djesionek Apr 13, 2020
9c3a07d
JENKINS-56927: Reverted incidental change
djesionek Apr 13, 2020
cf3b2e6
[JENKINS-56927] Fixed warnings found by spotbugs
djesionek Apr 28, 2020
b9f9fdc
Merge branch 'master' into JENKINS-56927
djesionek Apr 28, 2020
fcf19de
[JENKINS-56927] Fixed warnings found by spotbugs
djesionek Apr 28, 2020
63e76db
Merge branch 'JENKINS-56927' of github.com:djesionek/ec2-plugin into …
djesionek Apr 28, 2020
ee072eb
[JENKINS-56927] Fixed tests
djesionek Apr 29, 2020
398da8d
[JENKINS-56927] Fixed AmazonEC2CloudUnitTest and removed JenkinsRule
djesionek Apr 29, 2020
8992e19
[JENKINS-56927] Fixed und updated AmazonEC2CloudTest
djesionek Apr 29, 2020
718ee57
[JENKINS-56927] Fixed possible bug
djesionek Apr 29, 2020
2930157
[JENKINS-56927] Added reverse compatibility for old configuration loc…
djesionek Apr 29, 2020
ea5ae30
Merged master into JENKINS-56927 and resolved conflicts
djesionek May 7, 2020
7058462
[JENKINS-56927] Fixed RequireUpperBoundDeps for enforcer
djesionek May 7, 2020
d6c35d1
[JENKINS-56927] Made suggested changes
djesionek May 12, 2020
a4ed92a
[JENKINS-56927] Readded privateKey attribute as requested
djesionek May 12, 2020
eeac051
[JENKINS-56927] Rewritten migration trigger to include privateKey att…
djesionek May 12, 2020
1e627c6
[JENKINS-56927] Better error handling in the case of a missing privat…
djesionek May 26, 2020
657d0de
[JENKINS-56927] Added @RequirePOST to doCheckSshKeysCredentialsId
djesionek May 27, 2020
afea9f2
Resolved conflicts with master
djesionek Aug 7, 2020
2d08f6c
[JENKINS-56927] Fixed test with new constructor
djesionek Aug 9, 2020
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
20 changes: 19 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,21 @@ THE SOFTWARE.
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>credentials</artifactId>
<version>2.3.5</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>aws-credentials</artifactId>
<version>1.11</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>ssh-credentials</artifactId>
<version>1.18.1</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>bouncycastle-api</artifactId>
Expand Down Expand Up @@ -138,7 +148,7 @@ THE SOFTWARE.
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>trilead-api</artifactId>
<version>1.0.3</version><!-- TODO: BUMP when trilead split is in LTS and is the baseline -->
<version>1.0.5</version>
</dependency>
<dependency>
<groupId>io.jenkins.temp.jelly</groupId>
Expand Down Expand Up @@ -227,6 +237,7 @@ THE SOFTWARE.
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>structs</artifactId>
<version>1.20</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -258,6 +269,13 @@ THE SOFTWARE.

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>jenkins-bom</artifactId>
djesionek marked this conversation as resolved.
Show resolved Hide resolved
<version>${jenkins.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
Expand Down
13 changes: 9 additions & 4 deletions src/main/java/hudson/plugins/ec2/AmazonEC2Cloud.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,12 @@
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.DataBoundSetter;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerResponse;
import org.kohsuke.stapler.interceptor.RequirePOST;

import com.amazonaws.auth.AWSCredentialsProvider;
import com.amazonaws.services.ec2.AmazonEC2;
import com.amazonaws.services.ec2.model.DescribeRegionsResult;
import com.amazonaws.services.ec2.model.Region;
import org.kohsuke.stapler.interceptor.RequirePOST;

/**
* The original implementation of {@link EC2Cloud}.
Expand All @@ -70,6 +69,12 @@ public class AmazonEC2Cloud extends EC2Cloud {
private boolean noDelayProvisioning;

@DataBoundConstructor
public AmazonEC2Cloud(String cloudName, boolean useInstanceProfileForCredentials, String credentialsId, String region, String privateKey, String sshKeysCredentialsId, String instanceCapStr, List<? extends SlaveTemplate> templates, String roleArn, String roleSessionName) {
super(createCloudId(cloudName), useInstanceProfileForCredentials, credentialsId, privateKey, sshKeysCredentialsId, instanceCapStr, templates, roleArn, roleSessionName);
this.region = region;
}

@Deprecated
public AmazonEC2Cloud(String cloudName, boolean useInstanceProfileForCredentials, String credentialsId, String region, String privateKey, String instanceCapStr, List<? extends SlaveTemplate> templates, String roleArn, String roleSessionName) {
super(createCloudId(cloudName), useInstanceProfileForCredentials, credentialsId, privateKey, instanceCapStr, templates, roleArn, roleSessionName);
this.region = region;
Expand Down Expand Up @@ -205,7 +210,7 @@ public FormValidation doTestConnection(
@QueryParameter String region,
@QueryParameter boolean useInstanceProfileForCredentials,
@QueryParameter String credentialsId,
@QueryParameter String privateKey,
@QueryParameter String sshKeysCredentialsId,
@QueryParameter String roleArn,
@QueryParameter String roleSessionName)

Expand All @@ -215,7 +220,7 @@ public FormValidation doTestConnection(
region = DEFAULT_EC2_HOST;
}

return super.doTestConnection(getEc2EndpointUrl(region), useInstanceProfileForCredentials, credentialsId, privateKey, roleArn, roleSessionName, region);
return super.doTestConnection(getEc2EndpointUrl(region), useInstanceProfileForCredentials, credentialsId, sshKeysCredentialsId, roleArn, roleSessionName, region);
}
}
}
Loading