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-71737] rename cloudName to name #892

Merged
merged 2 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ def slaveTemplateUsEast1Parameters = [
]

def AmazonEC2CloudParameters = [
cloudName: 'MyCompany',
name: 'MyCompany',
credentialsId: 'jenkins-aws-key',
instanceCapStr: '2',
privateKey: '''-----BEGIN RSA PRIVATE KEY-----
Expand Down Expand Up @@ -453,7 +453,7 @@ SlaveTemplate slaveTemplateUsEast1 = new SlaveTemplate(

// https://javadoc.jenkins.io/plugin/ec2/index.html?hudson/plugins/ec2/AmazonEC2Cloud.html
AmazonEC2Cloud amazonEC2Cloud = new AmazonEC2Cloud(
AmazonEC2CloudParameters.cloudName,
AmazonEC2CloudParameters.name,
AmazonEC2CloudParameters.useInstanceProfileForCredentials,
AmazonEC2CloudParameters.credentialsId,
AmazonEC2CloudParameters.region,
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ THE SOFTWARE.
<changelist>999999-SNAPSHOT</changelist>
<jenkins.version>2.414</jenkins.version>
<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>
<hpi.compatibleSinceVersion>1626</hpi.compatibleSinceVersion>
</properties>

<dependencies>
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/hudson/plugins/ec2/AmazonEC2Cloud.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ 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(cloudName, useInstanceProfileForCredentials, credentialsId, privateKey, sshKeysCredentialsId, instanceCapStr, templates, roleArn, roleSessionName);
public AmazonEC2Cloud(String name, boolean useInstanceProfileForCredentials, String credentialsId, String region, String privateKey, String sshKeysCredentialsId, String instanceCapStr, List<? extends SlaveTemplate> templates, String roleArn, String roleSessionName) {
super(name, 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(cloudName, useInstanceProfileForCredentials, credentialsId, privateKey, instanceCapStr, templates, roleArn, roleSessionName);
public AmazonEC2Cloud(String name, boolean useInstanceProfileForCredentials, String credentialsId, String region, String privateKey, String instanceCapStr, List<? extends SlaveTemplate> templates, String roleArn, String roleSessionName) {
super(name, useInstanceProfileForCredentials, credentialsId, privateKey, instanceCapStr, templates, roleArn, roleSessionName);
this.region = region;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ THE SOFTWARE.
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form" xmlns:c="/lib/credentials">
<f:entry title="${%Name}" field="cloudName">
<f:entry title="${%Name}" field="name">
<f:textbox />
</f:entry>
<f:entry field="credentialsId" title="${%Amazon EC2 Credentials}" description="AWS IAM Access Key used to connect to EC2. If not specified, implicit authentication mechanisms are used (IAM roles...)">
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/hudson/plugins/ec2/AmazonEC2CloudTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void setUp() throws Exception {
@Test
public void testConfigRoundtrip() throws Exception {
r.submit(getConfigForm());
r.assertEqualBeans(cloud, r.jenkins.clouds.get(AmazonEC2Cloud.class), "cloudName,region,useInstanceProfileForCredentials,privateKey,instanceCap,roleArn,roleSessionName");
r.assertEqualBeans(cloud, r.jenkins.clouds.get(AmazonEC2Cloud.class), "name,region,useInstanceProfileForCredentials,privateKey,instanceCap,roleArn,roleSessionName");
}

@Test
Expand All @@ -94,7 +94,7 @@ public void testSshKeysCredentialsIdRemainsUnchangedAfterUpdatingOtherFields() t
r.submit(form);
AmazonEC2Cloud actual = r.jenkins.clouds.get(AmazonEC2Cloud.class);
assertEquals("updatedSessionName", actual.getRoleSessionName());
r.assertEqualBeans(cloud, actual, "cloudName,region,useInstanceProfileForCredentials,sshKeysCredentialsId,instanceCap,roleArn");
r.assertEqualBeans(cloud, actual, "name,region,useInstanceProfileForCredentials,sshKeysCredentialsId,instanceCap,roleArn");
}

@Test
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/hudson/plugins/ec2/Ami.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ configuration-as-code:
jenkins:
clouds:
- amazonEC2:
cloudName: "test"
name: "test"
privateKey: "${PRIVATE_KEY}"
templates:
- ami: ami-0123456789abcdefg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ configuration-as-code:
jenkins:
clouds:
- amazonEC2:
cloudName: "us-east-1"
name: "us-east-1"
privateKey: "${PRIVATE_KEY}"
templates:
- associatePublicIp: false
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/hudson/plugins/ec2/EC2CloudEmpty.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
jenkins:
clouds:
- amazonEC2:
cloudName: "empty"
name: "empty"
privateKey: "${PRIVATE_KEY}"
2 changes: 1 addition & 1 deletion src/test/resources/hudson/plugins/ec2/Mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
jenkins:
clouds:
- amazonEC2:
cloudName: "staging"
name: "staging"
useInstanceProfileForCredentials: true
privateKey: "${PRIVATE_KEY}"
templates:
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/hudson/plugins/ec2/MacData.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
jenkins:
clouds:
- amazonEC2:
cloudName: "production"
name: "production"
useInstanceProfileForCredentials: true
sshKeysCredentialsId: "random credentials id"
templates:
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/hudson/plugins/ec2/MacDataExport.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- amazonEC2:
cloudName: "production"
name: "production"
region: "us-east-1"
sshKeysCredentialsId: "random credentials id"
templates:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
jenkins:
clouds:
- amazonEC2:
cloudName: "timed"
name: "timed"
useInstanceProfileForCredentials: true
sshKeysCredentialsId: "random credentials id"
templates:
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/hudson/plugins/ec2/Unix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
jenkins:
clouds:
- amazonEC2:
cloudName: "staging"
name: "staging"
useInstanceProfileForCredentials: true
privateKey: "${PRIVATE_KEY}"
templates:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ jenkins:
clouds:
- amazonEC2:
altEC2Endpoint: "https.//ec2.us-east-1.amazonaws.com"
cloudName: "production"
name: "production"
region: "eu-central-1"
useInstanceProfileForCredentials: true
sshKeysCredentialsId: "random credentials id"
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/hudson/plugins/ec2/UnixData.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
jenkins:
clouds:
- amazonEC2:
cloudName: "production"
name: "production"
useInstanceProfileForCredentials: true
sshKeysCredentialsId: "random credentials id"
templates:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- amazonEC2:
altEC2Endpoint: "https.//ec2.us-east-1.amazonaws.com"
cloudName: "production"
name: "production"
region: "eu-central-1"
sshKeysCredentialsId: "random credentials id"
templates:
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/hudson/plugins/ec2/UnixDataExport.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- amazonEC2:
cloudName: "production"
name: "production"
region: "us-east-1"
sshKeysCredentialsId: "random credentials id"
templates:
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/hudson/plugins/ec2/WindowsData.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
jenkins:
clouds:
- amazonEC2:
cloudName: "development"
name: "development"
useInstanceProfileForCredentials: true
privateKey: "${PRIVATE_KEY}"
templates:
Expand Down