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

[JENKINS-44285] Tool Location overwrites are not preserved #318

Merged
merged 15 commits into from
Jul 16, 2018

Conversation

aytuncbeken
Copy link
Contributor

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.

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.
@aytuncbeken
Copy link
Contributor Author

Hi Carlos, Could you please check the pull request. Thank you.

@carlossg carlossg changed the title Jenkins 44285 [JENKINS-44285] Tool Location overwrites are not preserved May 21, 2018
<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" />
Copy link
Contributor

Choose a reason for hiding this comment

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

this gives a weird UI with 2 clicks to get to the data

screenshot 2018-05-22 15 14 02

Copy link
Contributor

Choose a reason for hiding this comment

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

@Vlatombe any suggestions?

Copy link
Member

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()
Copy link
Contributor

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<>();
Copy link
Contributor

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){
Copy link
Contributor

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?

Copy link
Member

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")
Copy link
Contributor

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

Copy link
Member

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.

@aytuncbeken
Copy link
Contributor Author

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.
@aytuncbeken
Copy link
Contributor Author

Hi All,
Had chance to check this pull request ? Do you have any reviews ?

@carlossg
Copy link
Contributor

carlossg commented Jul 5, 2018

The new throws IOException should be removed from most if not all methods.
Public methods changed should be deprecated instead of changed.
I will take another look once that is fixed and master is merged

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
@aytuncbeken
Copy link
Contributor Author

Hi Carlos,
could you please check , thanks.

@@ -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 {
Copy link
Contributor

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 {
Copy link
Contributor

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;
Copy link
Contributor

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() {
Copy link
Contributor

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
@aytuncbeken
Copy link
Contributor Author

Made the changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants