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

Remove Eucalyptus support #1027

Merged
merged 1 commit into from
Dec 27, 2024
Merged

Remove Eucalyptus support #1027

merged 1 commit into from
Dec 27, 2024

Conversation

basil
Copy link
Member

@basil basil commented Dec 21, 2024

Motivation

The AWS SDK for Java v2 has some changes in how EC2 clients are constructed with regard to the region, as described here. It is not clear how to implement these changes for Eucalyptus clouds, which do not have a region. After thinking about this some more, I decided it would be simpler to remove support for Eucalyptus clouds. This solves the problem about how to adapt to v2 API changes by eliminating the problem for Eucalyptus clouds, leaving only Amazon EC2 clouds for which the solution is straightforward.

The last commit to https://github.com/eucalyptus/eucalyptus was 7 years ago, and the entire GitHub organization was archived on August 30, 2024. This technology seems dead. I could find no references in open PRs after 2013, except for developers working on routine maintenance wondering how to deal with this dead code (usually guessing at the changes needed, or making changes without testing). The last references I can find in Jira are from 2016/2017, which roughly matches the timeline here showing that the last release of Eucalyptus was in 2018. Since this was over 6 years ago, I can't imagine anyone still using this technology today, and if they are then it seems like lack of support in the Jenkins EC2 plugin would be the least of their problems.

Problem

Eucalyptus support is dead code.

Solution

Flense it.

Implementation

Delete all Eucalyptus-related code. With that out of the way, flatten the class hierarchy by deprecating AmazonEC2Cloud (now the only type of EC2Cloud again, as it was before Eucalyptus support was introduced) and pushing up all its functionality into EC2Cloud. This restores the status quo before Eucalyptus support was added.

Preserve compatibility for serialized XML and JCasC. For XML, update the XStream alias to add EC2Cloud as an implementation so that deserialized instances of EC2Cloud are EC2Cloud rather than the deprecated AmazonEC2Cloud (which is also needed for JCasC export to work, since the descriptor is now part o EC2Cloud). Retain the alias, though, so that instances of AmazonEC2Cloud that are created via Groovy scripts still get serialized to the same EC2Cloud class as before this PR. Add @Symbol("amazonEC2") so that JCasC import/export works as before with no changes to import or export.

Testing done

Confirmed that JCasC export had the same symbols as before. Confirmed that XML from the old version was readable and that new clouds saved with the changes from this PR were saved with the same XML as before this PR.

Confirmed that Groovy scripts with the old types still worked using the deprecated constructors and were serialized into the same format as before this PR.

Ran JCasC tests with these changes and jenkinsci/configuration-as-code-plugin#2611 successfully.

}

@POST
public FormValidation doCheckAltEC2Endpoint(@QueryParameter String value) {

Check warning

Code scanning / Jenkins Security Scan

Stapler: Missing permission check Warning

Potential missing permission check in DescriptorImpl#doCheckAltEC2Endpoint
@basil basil changed the title Remove Eucalyptus suppot Remove Eucalyptus support Dec 21, 2024
basil added a commit to basil/configuration-as-code-plugin that referenced this pull request Dec 21, 2024
@basil basil requested a review from Vlatombe December 21, 2024 23:10
@basil basil marked this pull request as ready for review December 21, 2024 23:10
@@ -363,7 +362,7 @@ def slaveTemplateUsEast1Parameters = [
nodeProperties: null
]

def AmazonEC2CloudParameters = [
def EC2CloudParameters = [
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested this Groovy scripts after this PR with both the old and the new class names. Confirmed XStream serialization was the same as before.


private boolean noDelayProvisioning;

@DataBoundConstructor
public AmazonEC2Cloud(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Preserved for binary compatibility with Groovy scripts.

}

@Deprecated
public AmazonEC2Cloud(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Preserved for binary compatibility with Groovy scripts.

@@ -127,7 +136,7 @@
*
* @author Kohsuke Kawaguchi
*/
public abstract class EC2Cloud extends Cloud {
public class EC2Cloud extends Cloud {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restoring the status quo before Eucalyptus support was added.

Comment on lines +201 to +208
/**
* Represents the region. Can be null for backward compatibility reasons.
*/
private String region;

private String altEC2Endpoint;

private boolean noDelayProvisioning;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed up from AmazonEC2Cloud with no changes.

@POST
protected FormValidation doTestConnection(
@RequirePOST
public FormValidation doTestConnection(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merging this method with the version in AmazonEC2Cloud which just did some prep work and then delegated to this method.

@@ -1484,6 +1592,75 @@ public ListBoxModel doFillCredentialsIdItems(@AncestorInPath ItemGroup context)
Collections.emptyList(),
CredentialsMatchers.always());
}

@POST
public FormValidation doCheckCloudName(@QueryParameter String value) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed up from AmazonEC2Cloud with no changes.

@@ -77,7 +77,7 @@ public String getDisplayName() {
@Override
public void postInitialize() throws IOException {
// backward compatibility with the legacy class name
Jenkins.XSTREAM.alias("hudson.plugins.ec2.EC2Cloud", AmazonEC2Cloud.class);
Jenkins.XSTREAM.alias("hudson.plugins.ec2.EC2Cloud", AmazonEC2Cloud.class, EC2Cloud.class);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Serialize AmazonEC2Cloud to EC2Cloud, and deserialize EC2Cloud to EC2Cloud rather than AmazonEC2Cloud.

There is a minor issue with this: if creating an AmazonEC2Cloud with a Groovy script, it will be serialized to EC2Cloud but remain in memory as AmazonEC2Cloud until the next Jenkins restart, which will also means JCasC export won't work until the Jenkins restart. This seems acceptable, especially because any user who cares about this behavior can always fix the problem by migrating to EC2Cloud in their Groovy script.

* Unit tests related to {@link EC2Cloud}, but do not require a Jenkins instance.
*/
@RunWith(MockitoJUnitRunner.Silent.class)
public class EC2CloudUnitTest {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not new code, but rather a combination of the old EC2Test and the old AmazonEC2CloudUnitTest.

@RunWith(MockitoJUnitRunner.class)
/**
* @author Kohsuke Kawaguchi
*/
public class EC2CloudTest {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The equivalent of the old AmazonEC2CloudTest. The tests that previously lived in this class have been moved to EC2CloudUnitTest (along with the other tests that used to be in AmazonEC2CloudUnitTest.

timja pushed a commit to jenkinsci/configuration-as-code-plugin that referenced this pull request Dec 21, 2024
Copy link
Member

@Vlatombe Vlatombe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@basil basil merged commit 4b7fcc5 into jenkinsci:master Dec 27, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants