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

PodTemplate’s copy constructor was incomplete #608

Merged
merged 4 commits into from
Oct 1, 2019

Conversation

jglick
Copy link
Member

@jglick jglick commented Sep 30, 2019

Evidently unused in this plugin, but can cause problems in downstream plugins.

Note that PodTemplateUtils.combine(PodTemplate, PodTemplate) also has a similar long enumeration of fields, and could well be missing some, though this seems to have better test coverage.

@jglick jglick requested a review from Vlatombe September 30, 2019 18:37
this.setVolumes(from.getVolumes());
this.setWorkspaceVolume(from.getWorkspaceVolume());
this.yaml = from.yaml;
this.setYamls(from.getYamls());
this.setShowRawYaml(from.isShowRawYaml());
this.setNodeProperties(from.getNodeProperties());
this.showRawYaml = from.showRawYaml;
Copy link
Member Author

Choose a reason for hiding this comment

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

Just to avoid having the field be defined in the copy when null in the original.

this.setShowRawYaml(from.isShowRawYaml());
this.setNodeProperties(from.getNodeProperties());
this.showRawYaml = from.showRawYaml;
if (from.nodeProperties != null) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Ditto.

@@ -171,12 +171,15 @@ public PodTemplate(PodTemplate from) {
this.setServiceAccount(from.getServiceAccount());
this.setSlaveConnectTimeout(from.getSlaveConnectTimeout());
this.setActiveDeadlineSeconds(from.getActiveDeadlineSeconds());
this.setIdleMinutes(from.getIdleMinutes());
Copy link
Member Author

Choose a reason for hiding this comment

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

But this was really wrong: the idleMinutes in the copy was always zero.

@@ -740,10 +725,6 @@ protected Object readResolve() {
yamls = null;
}

if (showRawYaml == null) {
showRawYaml = Boolean.TRUE;
Copy link
Member Author

Choose a reason for hiding this comment

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

isShowRawYamlSet would go from false to true after a restart, if setShowRawYaml had never been called to begin with. (It would be called reliably from a GUI save, and from the podTemplate step we would not be doing deserialization except in Snippet Generator, so maybe this does not matter.)

@jglick jglick marked this pull request as ready for review September 30, 2019 21:36
@Vlatombe Vlatombe added the bug Bug Fixes label Oct 1, 2019
@Vlatombe Vlatombe merged commit 35c10f8 into jenkinsci:master Oct 1, 2019
@jglick jglick deleted the PodTemplate-copy-constructor branch October 1, 2019 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug Fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants