Class SupportPlugin

java.lang.Object
hudson.Plugin
com.cloudbees.jenkins.support.SupportPlugin
All Implemented Interfaces:
Saveable, Loadable, org.kohsuke.stapler.StaplerProxy

public class SupportPlugin extends Plugin
Main entry point for the support plugin.
Author:
Stephen Connolly
  • Field Details

    • REMOTE_OPERATION_TIMEOUT_MS

      public static final int REMOTE_OPERATION_TIMEOUT_MS
      How long remote operations can block support bundle generation for.
    • REMOTE_OPERATION_CACHE_TIMEOUT_SEC

      public static final int REMOTE_OPERATION_CACHE_TIMEOUT_SEC
      How long remote operations fallback caching can wait for
    • AUTO_BUNDLE_PERIOD_HOURS

      public static final int AUTO_BUNDLE_PERIOD_HOURS
      How often automatic support bundles should be collected. Should be 1 unless you have very good reason to use a different period. 0 disables bundle generation and 24 is the longest period permitted.
    • MAX_JENKINS_LOG_ENTRIES_PER_FILE

      public static final int MAX_JENKINS_LOG_ENTRIES_PER_FILE
      How many log Jenkins log entries to capture for each file before rotating. On an active Jenkins instance logs can accumulate quickly, so the default value of 2048 may not be enough to capture an hours worth of logs. Conversely on an inactive Jenkins setting this too high will cause the hourly captured bundles to contain lots of duplicate information, which wastes disk space.
    • SUPPORT_PERMISSIONS

      public static final PermissionGroup SUPPORT_PERMISSIONS
    • CREATE_BUNDLE

      @Deprecated public static final Permission CREATE_BUNDLE
      Deprecated.
      not used anymore as the usage has now been limited to Jenkins.ADMINISTER
    • SUPPORT_DIRECTORY_NAME

      public static final String SUPPORT_DIRECTORY_NAME
      See Also:
  • Constructor Details

    • SupportPlugin

      public SupportPlugin()
  • Method Details

    • migrateExistingLogs

      @Initializer(after=EXTENSIONS_AUGMENTED) public static void migrateExistingLogs()
    • getSupportProvider

      public SupportProvider getSupportProvider()
    • getRootDirectory

      public static File getRootDirectory()
      Working directory that the support-core plugin uses to write out files.
      Returns:
      the working directory that the support-core plugin uses to write out files.
    • getLogsDirectory

      public static File getLogsDirectory()
      Working directory that the support-core plugin uses to write out log files.
      Returns:
      the working directory that the support-core plugin uses to write out log files.
    • getRequesterAuthentication

      @Deprecated public static org.springframework.security.core.Authentication getRequesterAuthentication()
      Deprecated.
      Check permissions directly.
    • setSupportProvider

      public void setSupportProvider(SupportProvider supportProvider) throws IOException
      Throws:
      IOException
    • getExcludedComponents

      public Set<String> getExcludedComponents()
    • setExcludedComponents

      public void setExcludedComponents(Set<String> excludedComponents) throws IOException
      Sets the ids of the components to be excluded.
      Parameters:
      excludedComponents - Component Ids (by default class names) to exclude.
      Throws:
      IOException - if an error occurs while saving the configuration.
      See Also:
    • getJenkinsExecutorTotalCount

      public com.codahale.metrics.Histogram getJenkinsExecutorTotalCount()
    • getJenkinsExecutorUsedCount

      public com.codahale.metrics.Histogram getJenkinsExecutorUsedCount()
    • getJenkinsNodeOnlineCount

      public com.codahale.metrics.Histogram getJenkinsNodeOnlineCount()
    • getJenkinsNodeTotalCount

      public com.codahale.metrics.Histogram getJenkinsNodeTotalCount()
    • setLogLevel

      public static void setLogLevel(String level)
    • setLogLevel

      public static void setLogLevel(Level level)
    • getInstance

      public static SupportPlugin getInstance()
    • getComponents

      public static ExtensionList<Component> getComponents()
    • writeBundle

      @Deprecated public static void writeBundle(OutputStream outputStream) throws IOException
      Deprecated.
      Generate a bundle for all components that are selected in the Global Configuration.
      Parameters:
      outputStream - an OutputStream
      Throws:
      IOException - if an error occurs while generating the bundle.
    • writeBundle

      public static void writeBundle(OutputStream outputStream, List<? extends Component> components) throws IOException
      Generate a bundle for all components that are selected in the Global Configuration.
      Parameters:
      outputStream - an OutputStream
      components - a list of Component to include in the bundle
      Throws:
      IOException - if an error occurs while generating the bundle.
    • writeBundle

      public static void writeBundle(OutputStream outputStream, List<? extends Component> components, ComponentVisitor componentConsumer, Path outputPath, boolean addManifest) throws IOException
      Generate a bundle for all components that are selected in the Global Configuration.
      Parameters:
      outputStream - an OutputStream
      components - a list of Component to include in the bundle
      componentConsumer - a ComponentVisitor
      outputPath - the path with the support bundle will be created in the cases of async generations set this to null, if generating support bundle synchronously
      Throws:
      IOException - if an error occurs while generating the bundle.
    • getContentFilter

      @NonNull @Deprecated public static Optional<ContentFilter> getContentFilter()
      Deprecated.
      use getDefaultContentFilter()
      Get the filter to be used in an Optional just in case.
      Returns:
      the filter.
    • getContentFilter

      @Deprecated public static Optional<ContentFilter> getContentFilter(boolean ensureLoaded)
      Deprecated.
      use getDefaultContentFilter(ensureLoaded)
      Get the filter to be used in an Optional just in case.
      Parameters:
      ensureLoaded - true to ensure that the filter is loaded. Not necessary if ContentFilter.reload() is done explicitly by the caller.
      Returns:
      the filter.
    • getDefaultContentFilter

      @NonNull public static ContentFilter getDefaultContentFilter()
      Get the current ContentFilter.
      Returns:
      the ContentFilter or a pass-through filter if anonymization is off
    • getDefaultContentFilter

      @NonNull public static ContentFilter getDefaultContentFilter(boolean ensureLoaded)
      Get the filter to be used.
      Parameters:
      ensureLoaded - true to ensure that the filter is loaded. Not necessary if ContentFilter.reload() is done explicitly by the caller.
      Returns:
      the filter.
    • getAllLogRecords

      public List<LogRecord> getAllLogRecords()
    • loadConfig

      @Initializer(after=EXTENSIONS_AUGMENTED, before=JOB_LOADED) public static void loadConfig() throws IOException
      Throws:
      IOException
    • completedMilestones

      @Deprecated @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static void completedMilestones() throws IOException
      Deprecated.
      Throws:
      IOException
    • threadDumpStartup

      @Initializer(after=STARTED) public static void threadDumpStartup() throws Exception
      Throws:
      Exception
    • start

      public void start() throws Exception
      Overrides:
      start in class Plugin
      Throws:
      Exception
    • getContext

      @NonNull @Deprecated public SupportContextImpl getContext()
      Deprecated.
      usage removed
      Returns:
      the SupportContext
    • stop

      public void stop() throws Exception
      Overrides:
      stop in class Plugin
      Throws:
      Exception
    • getAllLogRecords

      public List<LogRecord> getAllLogRecords(Node node) throws IOException, InterruptedException
      Throws:
      IOException
      InterruptedException
    • getBundleFileName

      @Deprecated @NonNull public static String getBundleFileName()
      Deprecated.
      Returns the full bundle name.
      Returns:
      the full bundle name.