Class ArmorCodeJobDiscovery

All Implemented Interfaces:
ExtensionPoint, Runnable

@Extension public class ArmorCodeJobDiscovery extends AsyncPeriodicWork
Periodic background task that discovers Jenkins jobs and sends their data to ArmorCode. The task runs every minute and checks if the current time matches the configured cron expression. This approach prevents multiple timers from running when the cron configuration changes.
  • Constructor Details

    • ArmorCodeJobDiscovery

      public ArmorCodeJobDiscovery()
      Constructor with name for the background task.
  • Method Details

    • getRecurrencePeriod

      public long getRecurrencePeriod()
      Returns a fixed recurrence period of 1 minute. The actual execution logic in execute() checks if monitoring is enabled and if the cron expression matches the current time. Note: This method is only called once at startup by AsyncPeriodicWork.
      Specified by:
      getRecurrencePeriod in class PeriodicWork
    • execute

      protected void execute(TaskListener listener)
      Executes the periodic task with better error handling and logging. This is called by Jenkins' AsyncPeriodicWork framework every minute. It checks if the current time matches the cron expression before executing.
      Specified by:
      execute in class AsyncPeriodicWork