Skip to content

StashBuildTrigger: Use correct getter names for config.jelly fields #112

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

Merged
merged 1 commit into from
Jul 7, 2019

Conversation

proski
Copy link

@proski proski commented Jul 3, 2019

Getter names for fields referenced in config.jelly should start with "get" followed by the capitalized property name. "is" is not supported.

That's an alternative to #72 and it has unit tests.

It's not a pipeline only issue and should not be blocked by any other PR. The current code is not following the rule recommended in the Jenkins Wiki.

https://wiki.jenkins.io/display/JENKINS/Basic+guide+to+Jelly+usage+in+Jenkins#BasicguidetoJellyusageinJenkins-Understandingtheitobject

@jakub-bochenski
Copy link

The documentation you link to isn't very clear.

I'd recommend using the Java convention for naming methods (e.g. starting getters with 'get' and using CamelCase) so that Jelly can always find the methods.

is prefix for boolean properties is also part of the established Java naming convention. The get part is only an example (implying there are other possibilities).

In this light I appreciate adding the Descriptor unit test -- at least we have automated check that Jenkins recognizes the properties (whatever the logic for recognizing them might be).

Still -- I'm worried about job-dsl. Changing method names could cause problems with the autogenerated DSL API.

@jakub-bochenski
Copy link

FYI according to build StashBuildTriggerTest has wrong formatting now

@jakub-bochenski
Copy link

Still -- I'm worried about job-dsl. Changing method names could cause problems with the autogenerated DSL API.

We are safe with the getter/setter changes because we use @DataBoundConstructor and not the setter annotations.

@proski
Copy link
Author

proski commented Jul 3, 2019

Still -- I'm worried about job-dsl. Changing method names could cause problems with the autogenerated DSL API.

We are safe with the getter/setter changes because we use @DataBoundConstructor and not the setter annotations.

We should move optional parameters to setters according to this document:
https://jenkins.io/doc/developer/plugin-development/pipeline-integration/

@proski
Copy link
Author

proski commented Jul 3, 2019

is prefix for boolean properties is also part of the established Java naming convention. The get part is only an example (implying there are other possibilities).

I can send a patch for Jenkins to recognize "is", but it will be a long time until we can require the new Jenkins version.

Still -- I'm worried about job-dsl. Changing method names could cause problems with the autogenerated DSL API.

That's another reason we should move to individual setters for parameters with defaults. The generated DSL won't include default settings.

@jakub-bochenski
Copy link

I can send a patch for Jenkins to recognize "is", but it will be a long time until we can require the new Jenkins version.

I'm not asking for this, just wanted to explain why I think this change isn't as trivial as it might seem

That's another reason we should move to individual setters for parameters with defaults. The generated DSL won't include default settings.

Agree

@jakub-bochenski jakub-bochenski requested a review from jimklimov July 4, 2019 17:35
@jakub-bochenski
Copy link

@guyv any comments? for some reason I can't add you as a reviewer

Getter names for fields referenced in config.jelly should start with
"get" followed by the capitalized property name. "is" is not supported.
@guyv
Copy link

guyv commented Jul 6, 2019

@guyv any comments? for some reason I can't add you as a reviewer

@jakub-bochenski looks good to me

@jakub-bochenski jakub-bochenski merged commit a6dc8bb into jenkinsci:master Jul 7, 2019
@proski proski deleted the getter-names branch July 7, 2019 02:19
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