Skip to content

Commit

Permalink
add cloudName back to formData
Browse files Browse the repository at this point in the history
  • Loading branch information
car-roll committed Sep 12, 2023
1 parent bf62fc2 commit 1024b9e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/src/main/java/jenkins/agents/CloudSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@ private void handleNewCloudPage(Descriptor<Cloud> descriptor, String name, Stapl
checkName(name);
JSONObject formData = req.getSubmittedForm();
formData.put("name", name);
// multiple cloud implementations use cloudName instead of name. It is simpler to retain this field rather than
// refactor all the downstream plugins and the related tests.
formData.put("cloudName", name);

Check warning on line 231 in core/src/main/java/jenkins/agents/CloudSet.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 231 is not covered by tests
formData.remove("mode"); // Cloud descriptors won't have this field.
req.setAttribute("instance", formData);
req.setAttribute("descriptor", descriptor);
Expand Down
4 changes: 4 additions & 0 deletions core/src/main/resources/jenkins/agents/CloudSet/_new.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,13 @@ THE SOFTWARE.
<l:main-panel>
<f:form method="post" action="doCreate" name="config" class="jenkins-form">
<h1>${%New cloud}</h1>
<!-- We need to carry over name and cloudName to create the cloud instance -->
<f:invisibleEntry>
<f:textbox field="name"/>
</f:invisibleEntry>
<f:invisibleEntry>
<f:textbox field="cloudName"/>
</f:invisibleEntry>
<!-- main body of the configuration -->
<st:include it="${requestScope.instance}" class="${requestScope.descriptor.clazz}" page="config.jelly" optional="true" />

Expand Down

0 comments on commit 1024b9e

Please sign in to comment.