Interface ConsoleUrlProvider

All Superinterfaces:
Describable<ConsoleUrlProvider>
All Known Implementing Classes:
DefaultConsoleUrlProvider

public interface ConsoleUrlProvider extends Describable<ConsoleUrlProvider>
Extension point that allows implementations to redirect build console links to a specified URL.

In order to produce links to console URLs in Jelly templates, use Functions.getConsoleUrl(jenkins.console.WithConsoleUrl).

Note: If you implement this API, consider providing a link to the classic console from within your console visualization as a fallback, particularly if your visualization is not as general as the classic console, has limitations that might be relevant in some cases, or requires advanced data that may be not exist for failed or corrupted builds. For example, if you visualize Pipeline build logs using only LogStorage.stepLog, there will be log lines that will never show up in your visualization, or if your visualization traverses the Pipeline flow graph, there may be various edge cases where your visualization does not work at all, but the classic console view is unaffected.

Since:
2.433
See Also:
  • Field Details

    • LOGGER

      @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) static final Logger LOGGER
  • Method Details

    • getConsoleUrl

      @CheckForNull String getConsoleUrl(Run<?,?> run)
      Get a URL relative to the context path of Jenkins which should be used to link to the console for the specified build.

      Should only be used in the context of serving an HTTP request.

      Parameters:
      run - the build
      Returns:
      the URL for the console for the specified build, relative to the context of Jenkins (should not start with /), or null if this implementation does not want to serve a special console view for this build.
    • getDescriptor

      default Descriptor<ConsoleUrlProvider> getDescriptor()
      Description copied from interface: Describable
      Gets the descriptor for this instance.

      Descriptor is a singleton for every concrete Describable implementation, so if a.getClass() == b.getClass() then by default a.getDescriptor() == b.getDescriptor() as well. (In rare cases a single implementation class may be used for instances with distinct descriptors.)

      Specified by:
      getDescriptor in interface Describable<ConsoleUrlProvider>
    • getRedirectUrl

      @NonNull static String getRedirectUrl(Run<?,?> run)
      Get a URL relative to the web server root which should be used to link to the console for the specified build.

      Should only be used in the context of serving an HTTP request.

      Use Functions.getConsoleUrl(jenkins.console.WithConsoleUrl) to obtain this link in a Jelly template.

      Parameters:
      run - the build
      Returns:
      the URL for the console for the specified build, relative to the web server root
    • consoleUrlOf

      @NonNull static String consoleUrlOf(Run<?,?> run)
      Looks up the getConsoleUrl(hudson.model.Run<?, ?>) value from the first provider to offer one.
      Since:
      2.476
    • isEnabled

      static boolean isEnabled()
      Check whether there are at least two ConsoleUrlProvider implementations available.
      Returns:
      true if there are at least two ConsoleUrlProvider implementations available, false otherwise.