Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-70838

Usability issue with Jenkins root url

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • core
    • None
    • Jenkins 2.395 + JCasc 1569.vb_72405b_80249 (reproduced with the latest LTS for core too: 2.387.1 ).

      Issue

      When setting a Jenkins url in JCasc that is not an URL, Jenkins prints a warning in the logs and displays the "no root url defined" admin monitor (expected) BUT when going to the settings the automatic url detection logic kicks in and fills in the url field automatically.

      This is not an issue in itself (and even probably desirable) outside of JCasc: the user saves the configuration form and the proper url is saved.

      But in the case of JCasc, by design the updated url is not saved and lost in the next restart.

      This issue can be hard to debug since, by design each time the root url is needed in the context of a stapler request, the proper url is computed, only when the url is used outside of the context of a stapler request is the issue appearing.

       

      Expected behavior

      I must admit I don't have a proposal to fix this issue, a couple of thoughts:

      • JCasc should validate the URL
      • `JenkinsLocationConfiguration#preventRootUrlBeingInvalid` should block the startup if a value is provided but is an invalid URL
      • The settings form should use only `JenkinsLocationConfiguration#getUrl` and not the fallback to populate the field (which would make things clear).

      My preference would go to the last option, I'm happy to work on a fix if folks think it's the way to go.

       

      Reproduction

      • Start a fresh Jenkins (latest LTS or latest weekly) with JCasc installed and the jenkins.yaml looking like:

       

      unclassified:
        location:
      
      do not use a real url, eg take the real url and remove http://
          url: 127.0.0.1:8080 
      • observe the INFO log in the startup logs:
      2023-03-21 15:12:29.209+0000 [id=45]    INFO    j.m.JenkinsLocationConfiguration#preventRootUrlBeingInvalid: Invalid URL received: 127.0.0.1:8080/, considered as null
      • observe the admin monitor about the root url, go to the settings and observe how the url is properly populated.

            Unassigned Unassigned
            pierrebtz Pierre Beitz
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: