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

Impossible to configure default display URL provider but keep redirection (regression in 2.3.4)

XMLWordPrintable

    • display-url-api 2.3.9

      Context

      The GitHub Checks plugin calls DisplayURLProvider.get() and then uses DisplayURLProvider.getRunURL and DisplayURLProvider.getJobURL to get URLs that it publishes to GitHub. These URLs normally end with "display/redirect". When a user clicks such a link on GitHub, the Display URL API plugin redirects to Blue Ocean UI or to the classic UI. If Blue Ocean has been installed, then that is the default, but logged-in users can configure their user account and choose a different option under "Notification URL".

      In https://github.com/jenkins-infra/helpdesk/issues/2833, they wanted to change the default so that users would be redirected to the classic UI by default, but logged-in users would still be able to choose Blue Ocean. To implement this, https://github.com/jenkins-infra/jenkins-infra/pull/2143 added -Djenkins.displayurl.provider=org.jenkinsci.plugins.displayurlapi.ClassicDisplayURLProvider to the Java startup options.

      Problem

      After the jenkins.displayurl.provider property had been set, the URLs that were published to GitHub no longer included the "display/redirect" suffix. Instead, the hyperlinks pointed directly to the classic UI. Users who clicked these links did not get the Blue Ocean UI, even if they had logged in to Jenkins and configured "Notification URL".

      DisplayURLProvider.DisplayURLProviderImpl (source) overrides methods to append DISPLAY_POSTFIX = "display/redirect", and classes like RunDisplayAction (source) then call AbstractDisplayAction.lookupProvider(StaplerRequest) (source) to choose the provider that selects the redirect URL. But if the jenkins.displayurl.provider property points to org.jenkinsci.plugins.displayurlapi.ClassicDisplayURLProvider (source), then DisplayURLProvider.DisplayURLProviderImpl is not used and does not get a chance to add DISPLAY_POSTFIX.

      Requested changes

      Include "display/redirect" in URLs even if the default display URL provider has been configured with the system property or with the environment variable.

      When a request comes to the URL with "display/redirect", and the user has not configured "Notification URL", use the default from the system property or the environment variable. This part may already work that way.

      Could also define a separate system property, to keep the current behavior available. I don't know whether anyone really wants it, though.

            dnusbaum Devin Nusbaum
            kon Kalle Niemitalo
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: