-
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-57828] Cleaning up the Snippet Generator output for PodTemplateStep #703
[JENKINS-57828] Cleaning up the Snippet Generator output for PodTemplateStep #703
Conversation
…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.
Have some SpotBugs errors. |
src/main/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/PodTemplateStep.java
Outdated
Show resolved
Hide resolved
src/test/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/PodTemplateStepTest.java
Outdated
Show resolved
Hide resolved
src/main/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/PodTemplateStep.java
Outdated
Show resolved
Hide resolved
…/PodTemplateStepTest.java Change @issue argument. Co-Authored-By: Jesse Glick <jglick@cloudbees.com>
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.
For List
-typed fields, the natural default in most cases is an empty list.
src/main/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/PodTemplateStep.java
Outdated
Show resolved
Hide resolved
src/main/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/PodTemplateStep.java
Outdated
Show resolved
Hide resolved
src/main/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/PodTemplateStep.java
Outdated
Show resolved
Hide resolved
src/main/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/PodTemplateStep.java
Outdated
Show resolved
Hide resolved
src/main/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/PodTemplateStep.java
Outdated
Show resolved
Hide resolved
src/main/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/PodTemplateStep.java
Outdated
Show resolved
Hide resolved
src/main/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/PodTemplateStep.java
Outdated
Show resolved
Hide resolved
As of 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 |
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
#709 might solve these test failures. |
Rebuilding |
src/main/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/PodTemplateStep.java
Outdated
Show resolved
Hide resolved
…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.
...ources/org/csanchez/jenkins/plugins/kubernetes/pipeline/runInPodNestedExplicitInherit.groovy
Outdated
Show resolved
Hide resolved
…equire escaping in either xml or java and seems very unlikely to ever be the name of an actual template.
src/main/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/PodTemplateStep.java
Outdated
Show resolved
Hide resolved
...main/resources/org/csanchez/jenkins/plugins/kubernetes/pipeline/PodTemplateStep/config.jelly
Outdated
Show resolved
Hide resolved
src/main/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/PodTemplateStep.java
Outdated
Show resolved
Hide resolved
src/main/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/PodTemplateStep.java
Outdated
Show resolved
Hide resolved
src/main/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/PodTemplateStep.java
Outdated
Show resolved
Hide resolved
...ources/org/csanchez/jenkins/plugins/kubernetes/pipeline/runInPodNestedExplicitInherit.groovy
Outdated
Show resolved
Hide resolved
src/test/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/PodTemplateStepTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/PodTemplateStepTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/PodTemplateStepTest.java
Show resolved
Hide resolved
@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.
...ources/org/csanchez/jenkins/plugins/kubernetes/pipeline/runInPodNestedExplicitInherit.groovy
Outdated
Show resolved
Hide resolved
…e default inheritance. Use the string "<default>" in the snippet generator to mean null in the generated script.
src/main/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/PodTemplateStep.java
Outdated
Show resolved
Hide resolved
src/main/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/PodTemplateStep.java
Show resolved
Hide resolved
src/main/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/PodTemplateStep.java
Outdated
Show resolved
Hide resolved
...main/resources/org/csanchez/jenkins/plugins/kubernetes/pipeline/PodTemplateStep/config.jelly
Outdated
Show resolved
Hide resolved
….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`
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.
lgtm
Looks right now. Thanks for your perseverance! |
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 ofUtil.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.