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-71244] Avoid relative link in update center #7992
Conversation
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.
Thanks for the PR! I have tested issue described on the master branch via
diff --git a/core/src/main/java/hudson/model/UpdateCenter.java b/core/src/main/java/hudson/model/UpdateCenter.java
index b9ca1d2001..7fb5a2ce89 100644
--- a/core/src/main/java/hudson/model/UpdateCenter.java
+++ b/core/src/main/java/hudson/model/UpdateCenter.java
@@ -1680,6 +1680,7 @@ public class UpdateCenter extends AbstractModelObject implements Saveable, OnMas
connectionStates.put(ConnectionStatus.UPDATE_SITE, ConnectionStatus.CHECKING);
statuses.add(Messages.UpdateCenter_Status_CheckingJavaNet());
+ statuses.add(Messages.UpdateCenter_Status_UnknownHostException("yo"));
config.checkUpdateCenter(this, site.getUrl());
to replicate the problem the issue linked describes, without messing with networking.
The URL to the proxy configuration page is resolved properly:
I'm not confident this PR addresses an actual issue, given I can't replicate the issue described.
@NotMyFault I'm not exactly sure, but it looks like you are on the main page of the update center when trying to reproduce, right? If I remember it right from the issue, I was actually installing updates (i.e. my screenshot shows pluginManager/updates). Since that error message can appear on pages with different depth from the root, a fixed relative address (as before the patch) cannot work in all cases. |
I see, you were on I recommend removing the leading slash in the .properties files because |
* convert the relative link to an absolute one, since it might be used in different contexts (with different depth from the server root directory) * update all message bundles to use the new format argument
Done. I also like it when such things are cleaned up. :) And I'll have to remember your trick of not even fiddling with the network if it's easily possible to just trigger the error condition in (additional) code. Thanks for that. I didn't rebase, assuming that simplifies your review and you'll probably rebase on submit anyway. Please tell me if that doesn't fit to typical Jenkins project workflows. |
No worries, all good. We don't do that during the review phase, given it detaches code comments, slows the time-to-merge down for no good reason, and generally causes more harm than good. |
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.
.
/label ready-for-merge This PR is now ready for merge, after ~24 hours, we will merge it if there's no negative feedback. Thanks! |
This breaks links when the UI is not accessed through the configured root URL. |
Would you recommend a change independent of |
* convert the relative link to an absolute one, since it might be used in different contexts (with different depth from the server root directory) * update all message bundles to use the new format argument Co-authored-by: Alexander Brandes <mc.cache@web.de> (cherry picked from commit 9061e7b)
This should use |
JENKINS-71905 documents the problem this change causes. FTR using |
See JENKINS-71244.
Note: To my mind, all relative URLs in properties files are a bad design choice, since the related code may be used from different context URLs. It would probably be rather easy to detect such issues with a regex checkstyle rule looking for
href=".
in properties files. If core maintainers agree, I could raise a separate issue for that.Testing done
I've run a developer instance with this change. But I have not been able to force the update center error on my local machine. So Jenkins still runs, but the actual change is untested.
Proposed changelog entries
Proposed upgrade guidelines
N/A
Submitter checklist
@Restricted
or have@since TODO
Javadocs, as appropriate.@Deprecated(since = "TODO")
or@Deprecated(forRemoval = true, since = "TODO")
, if applicable.eval
to ease future introduction of Content Security Policy (CSP) directives (see documentation).Maintainer checklist
Before the changes are marked as
ready-for-merge
:upgrade-guide-needed
label is set and there is a Proposed upgrade guidelines section in the pull request title (see example).lts-candidate
to be considered (see query).