Skip to content

Conversation

@stevenbaker
Copy link
Contributor

@stevenbaker stevenbaker commented Sep 1, 2025

This PR resolves this ticketed bug:
https://issues.jenkins.io/browse/JENKINS-76057

Description

The EC2 plugin configuration UI is broken. Users cannot view or save EC2 cloud configurations on this page:

Manage Jenkins → Clouds → [Cloud Name] -> Configure

The page now shows empty AMI sections and broken form fields.

Form submissions fail with HTTP 500 errors, preventing users from saving any configuration changes.

A root cause analysis is included in the original ticket linked above.

Changes Made

SlaveTemplate.java

  • Added 26 JavaBean-compliant getter methods for UI field binding
  • Made getZone() method public (was package-private)
  • Added getAvoidUsingOrphanedNodes() method for missing field

EC2Cloud.java

  • Added getName() method for JavaBean compliance
  • Verified existing @Extension DescriptorImpl registration

AmazonEC2Cloud.java

  • Added @DataBoundConstructor annotation to primary constructor for form binding
  • Added @Extension DescriptorImpl extending EC2Cloud.DescriptorImpl

Similar fixes applied to other EC2 plugin classes (SpotConfiguration in a467252, March 2020) and across many Jenkins plugins as framework requirements tightened.

Testing Done

  • Executed mvn clean package - all tests pass
  • Deployed HPI artifact to local Jenkins server
  • Verified "Configure" UI now works as expected (see screenshots)
  • Verified form submission now works without HTTP 500 errors

Screenshots

Before the change:

CleanShot 2025-09-01 at 12 50 30@2x

After the change:

CleanShot 2025-09-01 at 15 26 00@2x

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

…inding

Jenkins form submission requires @DataBoundConstructor to identify which
constructor Stapler should use when creating instances from form data.
Without this annotation, form submissions fail with:
org.kohsuke.stapler.NoStaplerConstructorException: There's no @DataBoundConstructor
on any constructor of class hudson.plugins.ec2.AmazonEC2Cloud

This prevents users from saving EC2 cloud configuration changes through
the Jenkins web interface, causing HTTP 500 errors on form submission.

Similar pattern was used in SpotConfiguration (commit a467252, March 2020)
and required across Jenkins plugins as Stapler framework enforcement
became stricter in recent Jenkins versions.
@stevenbaker stevenbaker changed the title fix(JENKINS-76057): Fix broken "Configure" UI (slave templates failing to load) fix(JENKINS-76057): Fix EC2 plugin "Configure" UI - users cannot view or save cloud configurations Sep 1, 2025
@res0nance res0nance merged commit 8120395 into jenkinsci:master Oct 11, 2025
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