-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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-44285] Tool Location overwrites are not preserved #318
Conversation
Tool location was not preserved when configuration is saved. Configuration ui is changed in jelly. NodeProperties is initialized in definition. Add NodeProperties method added.
SuppressFBWarning for SE_BAD_FIELD Tool location was not preserved when configuration is saved. Configuration ui is changed in jelly. NodeProperties is initialized in definition. Add NodeProperties method added.
Hi Carlos, Could you please check the pull request. Thank you. |
<f:descriptorList title="${%Node Properties}" descriptors="${h.getNodePropertyDescriptors(descriptor.clazz)}" field="nodeProperties" /> | ||
<!-- descriptorList is not working somehow, repeatableProperty has same functionality, just ui changes a little --> | ||
<f:entry title="${%Tool Locations}"> | ||
<f:repeatableProperty field="nodeProperties" noAddButton="false" /> |
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.
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.
@Vlatombe any suggestions?
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.
I'd better stick to the existing one.
@@ -448,4 +450,22 @@ public void shouldSubstituteMultipleEnvVarsAndNotUseDefaultsForMissing() { | |||
properties.put("key2", "value2"); | |||
assertEquals("value1 or value2 or ${key3}", substitute("${key1} or ${key2} or ${key3}", properties, "defaultValue")); | |||
} | |||
|
|||
@Test | |||
public void shouldCompineAllToolLocations() |
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.
typo
@@ -110,7 +112,8 @@ | |||
|
|||
private List<PodImagePullSecret> imagePullSecrets = new ArrayList<PodImagePullSecret>(); | |||
|
|||
private transient List<ToolLocationNodeProperty> nodeProperties; | |||
@SuppressFBWarnings(value = "SE_BAD_FIELD") | |||
private List<ToolLocationNodeProperty> nodeProperties = new ArrayList<>(); |
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.
on upgrade this will be null because the xml does not have the option nodeProperties
entry, it should be checked in getNodeProperties
} | ||
} | ||
|
||
public void addNodeProperties(List<ToolLocationNodeProperty> nodeProperties){ |
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.
do we need this method?
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.
Should be inlined.
@@ -110,7 +112,8 @@ | |||
|
|||
private List<PodImagePullSecret> imagePullSecrets = new ArrayList<PodImagePullSecret>(); | |||
|
|||
private transient List<ToolLocationNodeProperty> nodeProperties; | |||
@SuppressFBWarnings(value = "SE_BAD_FIELD") |
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.
is this actually needed ? doesn't fail without it
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.
I indeed get a FindBugs. However ignoring it feels like hack.
In Jenkins core, this is handled using a DescribableList
(see here). I would recommend sticking to the same pattern.
Hi, Thank you for the review, i will look asap. |
NodeProperties implemented As DescribableList as in Jenkins Slave UI preserved as in Node Configuration SuppressFBWarning for SE_BAD_FIELD setNodeProperties throws IOException, throws added to methods which related.
NodeProperties implemented As DescribableList as in Jenkins Slave UI preserved as in Node Configuration SuppressFBWarning for SE_BAD_FIELD setNodeProperties throws IOException, throws added to methods which related. Comments added.
# Conflicts: # src/main/java/org/csanchez/jenkins/plugins/kubernetes/PodTemplateUtils.java # src/test/java/org/csanchez/jenkins/plugins/kubernetes/PodTemplateUtilsTest.java
NodeProperties implemented As DescribableList as in Jenkins Slave UI preserved as in Node Configuration SuppressFBWarning for SE_BAD_FIELD setNodeProperties throws IOException, throws added to methods which related. Comments added.
NodeProperties implemented As DescribableList as in Jenkins Slave UI preserved as in Node Configuration DescribableList implemented as PodTemplateToolLocation as Serializable Comments added.
Hi All, |
The new |
NodeProperties implemented As DescribableList as in Jenkins Slave UI preserved as in Node Configuration DescribableList implemented as PodTemplateToolLocation as Serializable Comments added. Unnecessary throws Removed
… into JENKINS-44285 # Conflicts: # src/main/java/org/csanchez/jenkins/plugins/kubernetes/PodTemplateUtils.java
Hi Carlos, |
@@ -512,7 +512,7 @@ public PodTemplate getTemplate(@CheckForNull Label label) { | |||
* @param podTemplate the pod template to unwrap. | |||
* @return the unwrapped pod template | |||
*/ | |||
public PodTemplate getUnwrappedTemplate(PodTemplate podTemplate) { | |||
public PodTemplate getUnwrappedTemplate(PodTemplate podTemplate) throws IOException { |
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.
should not throw IOException
|
||
private String yaml; | ||
|
||
@DataBoundConstructor | ||
public PodTemplate() { | ||
} | ||
|
||
public PodTemplate(PodTemplate from) { | ||
public PodTemplate(PodTemplate from) throws IOException { |
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.
should not throw IOException
@@ -0,0 +1,36 @@ | |||
package org.csanchez.jenkins.plugins.kubernetes; |
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.
can you add the MIT license header please
@@ -215,7 +219,7 @@ public void shouldUnwrapParent() { | |||
} | |||
|
|||
@Test | |||
public void shouldDropNoDataWhenIdentical() { | |||
public void shouldDropNoDataWhenIdentical() { |
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.
extra whitespaces
UI preserved as in Node Configuration DescribableList implemented as PodTemplateToolLocation as Serializable Comments added. Unnecessary throws Removed White Spaces removed Mit License Added
Made the changes. |
SuppressFBWarning for SE_BAD_FIELD Tool location was not preserved when configuration is saved. Configuration ui is changed in jelly. NodeProperties is initialized in definition. Add NodeProperties method added.