[JENKINS-60738] Fix global configuration submission from UI#347
[JENKINS-60738] Fix global configuration submission from UI#347KostyaSha merged 8 commits intojenkinsci:masterfrom
Conversation
julieheard
left a comment
There was a problem hiding this comment.
LGTM, manually tested and is working 🙂
|
While this sounds fine as a hotfix, the proper fix would be to delete all the overrides and special cases handling and fix the form to use normal databinding by convention. |
| f.entry(title: _("Override Hook URL")) { | ||
| g.blockWrapper { | ||
| f.optionalBlock(title: _("Specify another hook URL for GitHub configuration"), | ||
| name: "isOverrideHookUrl", | ||
| inline: true, | ||
| checked: instance.isOverrideHookUrl()) { | ||
| f.entry(field: "hookUrl") { | ||
| f.textbox(checkMethod: "post") | ||
| f.textbox(checkMethod: "post", name: "hookUrl") | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
For example all of this should just be like
<f:entry field="hookUrl">
<f:textbox label="Alternate hook URL for GitHub configuration"/>
</f:entry>which may be blank.
There was a problem hiding this comment.
Oh I see. Remove all the optional block that is not necessary.. Yeah sounds good to me I can test this.
There was a problem hiding this comment.
Would be more work for sure. The usual problem with this sort of fix is retaining compatibility for both XML settings and JCasC. Sometimes hacking up the JSON processing in the GUI logic is the only option since refactoring to a simpler structure would break something.
There was a problem hiding this comment.
the thing that bother me is the type URL of the hookUrl... Because of that type, the value cannot actually be blank :( :
java.net.MalformedURLException: no protocol:
at java.base/java.net.URL.<init>(URL.java:645)
at java.base/java.net.URL.<init>(URL.java:541)
at java.base/java.net.URL.<init>(URL.java:488)
at org.kohsuke.stapler.Stapler$3.convert(Stapler.java:1141)
Caused: org.apache.commons.beanutils.ConversionException: no protocol:
So it is not that simple to "reset" the hook URL because of the binding.. I thought about changing the type from URL to String but the existing public getter might be a problem: https://github.com/jenkinsci/github-plugin/blob/master/src/main/java/org/jenkinsci/plugins/github/config/GitHubPluginConfig.java#L131-L141
Changing its signature could be a breaking change. Though it does not seem to be used outside the scope of that plugin repo: https://github.com/search?ref=simplesearch&type=code&q=user%3Ajenkinsci++getHookUrl.
There was a problem hiding this comment.
BTW use permalinks for better display:
src/main/java/org/jenkinsci/plugins/github/config/GitHubPluginConfig.java
Show resolved
Hide resolved
|
@KostyaSha are you ok with this as the active maintainer of this plugin? |
|
What's the status of this? I've just run into this with our own instance. |
|
I have the same issue; as a workaround I've been adding |
If you edit the config file and restart so it has the updated value in memory then the UI should show the correct setting and not clobber it on save. |
|
Can this be merged soon? I've just noticed this open PR after implementing the same fix and opening another PR : #375 Feel free to close the other PR |
|
(I am not a maintainer) |
|
@jenkinsci/github-plugin-developers anybody able to merge this ? |
|
@KostyaSha perhaps |
|
@KostyaSha @lanwen @oleg-nenashev anybody able to help merge this ? |
But even when adding the hookUrl to the xml and restarting, the endpoint still only works for "/github-webhook/". everything else gives a "HTTP ERROR 403 No valid crumb was included in the request" |
|
Hi @jenkinsci/github-plugin-developers, is there any chance to merge this PR? |
the group contains |
thanks to dependabot who spamed from all jenkins repos |
|
@KostyaSha thanks for merging. Could you please make a release now? Thanks |
looks like a good idea. @KostyaSha let us know if you are too busy to maintain the plugin actively, I'm pretty sure some people will be happy to help to maintain such critical plugin. |
Fixes JENKINS-60738 caused by changes introduced in #221.
Databinding of
hookUrlis not working properly, per my understanding because theDataboundSettersetHookUrl(String hookUrl) accepts aStringbut the field is aURL. While adding apublic void setHookUrl(URL hookUrl)might solve some of the problem, then there is yet another issue that disabling the Specify another hook URL for GitHub configuration checkbox does not remove the hook URL at all... that seems wrong.So the propose fix:
configure(StaplerRequest req, JSONObject json)