-
Notifications
You must be signed in to change notification settings - Fork 695
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
Conversation
@@ -363,7 +362,7 @@ def slaveTemplateUsEast1Parameters = [ | |||
nodeProperties: null | |||
] | |||
|
|||
def AmazonEC2CloudParameters = [ | |||
def EC2CloudParameters = [ |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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.
/** | ||
* Represents the region. Can be null for backward compatibility reasons. | ||
*/ | ||
private String region; | ||
|
||
private String altEC2Endpoint; | ||
|
||
private boolean noDelayProvisioning; |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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 ofEC2Cloud
again, as it was before Eucalyptus support was introduced) and pushing up all its functionality intoEC2Cloud
. 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 ofEC2Cloud
areEC2Cloud
rather than the deprecatedAmazonEC2Cloud
(which is also needed for JCasC export to work, since the descriptor is now part oEC2Cloud
). Retain the alias, though, so that instances ofAmazonEC2Cloud
that are created via Groovy scripts still get serialized to the sameEC2Cloud
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.