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-57828] Cleaning up the Snippet Generator output for PodTemplateStep #703

Merged
merged 30 commits into from
Mar 13, 2020
Merged

[JENKINS-57828] Cleaning up the Snippet Generator output for PodTemplateStep #703

merged 30 commits into from
Mar 13, 2020

Conversation

kerogers-cloudbees
Copy link
Contributor

@kerogers-cloudbees kerogers-cloudbees commented Feb 7, 2020

JENKINS-57828

Followed the instructions https://jenkins.io/doc/developer/plugin-development/pipeline-integration/ in the Handling default values section, except had to use Util.fixEmpty(String s) instead of Util.fixNull()
Added defaults for podRetention and workspaceVolume in PodTemplateStep.
Changed DynamicPVCWorkspaceVolume to be compliant with snippet generation, changed DataBoundConstructor to have no parameters, added DataBoundSetters for all properties.
Added tests classifier to workflow-cps test dependency to get the SnippitizerTest class.
Added unit test for PodTemplateStep.

…for PodTemplateStep.

Followed the instructions https://jenkins.io/doc/developer/plugin-development/pipeline-integration/ in the Handling default values section, except had to use `Util.fixEmpty(String s)` instead of `Util.fixNull()`
Changed the default value of `instanceCap` to 0 from MAX_INT. Otherwise requires a lot of logic to make it not be generated if set to the default of 0 from the config.jelly.
Added defaults for podRetention and workspaceVolume in PodTemplateStep.
Changed DynamicPVCWorkspaceVolume to be compliant with snippet generation, changed DataBoundConstructor to have no parameters, added DataBoundSetters for all properties.
Added tests classifier to workflow-cps test dependency to get the SnippitizerTest class.
Added unit test for PodTemplateStep.
@jglick jglick changed the title [CPLT2-6206][JENKINS-57828] Cleaning up the Snippet Generator output … [CPLT2-6206][JENKINS-57828] Cleaning up the Snippet Generator output for PodTemplateStep Feb 7, 2020
@jglick
Copy link
Member

jglick commented Feb 7, 2020

Have some SpotBugs errors.

…/PodTemplateStepTest.java


Change @issue argument.

Co-Authored-By: Jesse Glick <jglick@cloudbees.com>
Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

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

For List-typed fields, the natural default in most cases is an empty list.

@jglick
Copy link
Member

jglick commented Feb 7, 2020

As of master, the unconfigured step gives

podTemplate(inheritFrom: '', instanceCap: 0, namespace: '', nodeSelector: '', podRetention: always(), serviceAccount: '', supplementalGroups: '', workspaceVolume: dynamicPVC(accessModes: 'ReadWriteOnce', requestsSize: '', storageClassName: ''), yaml: '') {
    // some block
}

which is too much, but neither containers nor volumes are mentioned here, so there is no need to touch these properties—only those which actually appear in the above list.

Revert changes to list properties, they are all initialized and should never be null.
Change defaults to be the same as the PodTemplate defaults.
Change config.jelly to use these defaults also.
….com:kerogers-cloudbees/kubernetes-plugin into podTemplate-snippet-jenkins-57828-cplt2-6206
@jglick jglick self-requested a review February 10, 2020 20:03
@jglick
Copy link
Member

jglick commented Feb 10, 2020

#709 might solve these test failures.

@Vlatombe
Copy link
Member

Rebuilding

@Vlatombe Vlatombe closed this Feb 13, 2020
@Vlatombe Vlatombe reopened this Feb 13, 2020
…tanceCap of Integer.MAX_VALUE. Adding logic to the setter that sets instanceCap to Integer.MAX_VALUE if the Integer passed to it is null or less than equal to 0.
…Test.runInPodNestedExplicitInherit to pass. Having inheritFrom be null instead of an empty string was breaking something in the podTemplate construction.
@Vlatombe Vlatombe added the enhancement Improvements label Mar 3, 2020
…equire escaping in either xml or java and seems very unlikely to ever be the name of an actual template.
@Vlatombe
Copy link
Member

Vlatombe commented Mar 6, 2020

@kerogers-cloudbees can you process latest reviews from Jessie?

…n. The behavior I intended for this string to trigger is actually the opposite of the default behavior, it is to create a pod template step that has inheritance set to an empty string so that `PodTemplateStepExecution` will not add the templates to the inheritance.
…e default inheritance. Use the string "<default>" in the snippet generator to mean null in the generated script.
@jglick jglick changed the title [CPLT2-6206][JENKINS-57828] Cleaning up the Snippet Generator output for PodTemplateStep [JENKINS-57828] Cleaning up the Snippet Generator output for PodTemplateStep Mar 9, 2020
@jglick jglick self-requested a review March 9, 2020 14:53
kerogers-cloudbees and others added 8 commits March 11, 2020 05:16
….com:kerogers-cloudbees/kubernetes-plugin into podTemplate-snippet-jenkins-57828-cplt2-6206
…/PodTemplateStep.java

Co-Authored-By: Jesse Glick <jglick@cloudbees.com>
…/PodTemplateStep.java

Co-Authored-By: Jesse Glick <jglick@cloudbees.com>
…/PodTemplateStep.java


recommended change from review

Co-Authored-By: Jesse Glick <jglick@cloudbees.com>
recommended change from review

Co-Authored-By: Vincent Latombe <vincent@latombe.net>
…form. Removed attributes `oneEach`, `hasHeader`, `addCaption`, and `deleteCaption` as they don't seem to work with a `dropdownDescriptorSelector`
Copy link
Member

@Vlatombe Vlatombe left a comment

Choose a reason for hiding this comment

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

lgtm

@Vlatombe Vlatombe merged commit 55233bc into jenkinsci:master Mar 13, 2020
@jglick
Copy link
Member

jglick commented Mar 13, 2020

Looks right now. Thanks for your perseverance!

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

Successfully merging this pull request may close these issues.

3 participants