-
Notifications
You must be signed in to change notification settings - Fork 90
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-50636] Use @DataBoundSetter for optional pipeline params #48
Conversation
private boolean logarithmic; | ||
private boolean keepRecords; | ||
|
||
// Generated? | ||
@SuppressWarnings("visibilitymodifier") | ||
public String csvFileName; |
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.
Probably this field should be moved to the top where other Required fields
are located.
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.
This one is a little odd, since it's not directly specified by the user with the snippet generator. I'm assuming it's generated here through reflection when the step is created.
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.
No need to move, your assumption is correct. Maybe, in this case, explanation comment from where it comes will be better than Generate?
.
public String getYaxisMaximum() { | ||
return yaxisMaximum; | ||
} | ||
|
||
public List<Series> getSeries() { |
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.
Verified that this one was actually never called from outside. Should be safe to remove.
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'm not super happy with the removal of this, as it splits the pipeline and freestyle jobs further from each other. I tried taking parts of the freestyle config.jelly, unfortunately it's not just simple replacement. I'm not familiar enough with freestyle jobs to say why that is.
@rmstyrczula would be nice to have tests for different combinations. I've prepared a patch for you with a working test and pipeline you provided (it's a We need to have tests (at least):
|
@rmstyrczula + would be nice to include JIRA ticket id in a commit message (check this PR for example). This will post updates to JIRA ticket when PR get's merged. |
I'll look into adding your patched tests and if I can add my own. Regarding the JIRA ticket, do you want me to reference JENKINS-50636? edit: There is a deprecated jenkins image with many older tags. I'll check that out to test older versions |
1a7a8de
to
10d5c29
Compare
Through testing, it seems 2.0 is the minimum required version now. Testing on even the latest 1.x version, 1.656, has failures with the new PlotBuilder tests. I added your patch, added some basic tests on top of it, and modified the original commit message to include the JIRA ticket ID. Let me know if I've missed anything! |
@rmstyrczula good job! That's exactly what I've expected from those tests.
Divide 10d5c29 commit into 2 (if tricky, modifying commit message should be enough):
I've tested on Once you fix the commit messages, I'll merge and release this fix. Thank you so much! |
This helps the Snippet Generator provide a smaller example where many defaults are used, and prevents the Jenkins pipeline linter from complaining about missing "required" parameters.
Pipeline support requires a minimum of 2.0 for newer Jenkins API functionality for subsequent unit tests.
10d5c29
to
6b0d3d2
Compare
I split out the pom update to its own commit, and put your patched tests plus the others in the last commit. Changed the wording as you requested. |
@rmstyrczula thank you so much for this fix 🎉. |
This helps the Snippet Generator provide a smaller example
where many defaults are used, and prevents the Jenkins pipeline
linter from complaining about missing "required" parameters.
JIRA
No issue directly found, though the closest I could find is JENKINS-50636.
Misc
I started working on this due to build failures in my Jenkins pipeline when using a Jenkinsfile from SCM. This does not seem to happen with an inline pipeline job.
plot-build-failure.txt
What has been done
@DataBoundSetter
sseries
has been removed and csv, xml, properties are concatenated duringperform
.How to test
You can check if a Jenkinsfile will pass muster by using the built-in linter
The following Jenkinsfile works with my changes, but fail with errors similar to the attached plot-build-failure.txt.
(You can also just create a simple Pipeline job and paste the following)
I tested this with Jenkins (LTS 2.107.3) inside Docker:
I installed the suggested plugins, and then uploaded the built hpi to test.
Checklist