function runCronJob(storageMethod, log, cronConfig) {
  let inProgress = false;

  const {schedule, maxAgeInDays, skipBranches = null, onlyBranches = null} = cronConfig;

  const cron = new CronJob(normalizeCronSchedule(schedule), () => {
    if (inProgress) {
      log(`Deleting old builds still in progress. Skipping...`);
      return;
    }
    inProgress = true;
    log(`Starting delete old builds`);
    deleteOldBuilds(storageMethod, maxAgeInDays, skipBranches, onlyBranches)
      .then(() => {
        log(`Successfully delete old builds`);
      })
      .catch(err => {
        log(`Delete old builds failure: ${err.message}`);
      })
      .finally(() => {
        inProgress = false;
      });
  });

  cron.start();
}
@param {LHCI.ServerCommand.StorageMethod} storageMethod
@param {(s: string) => void} log
@param {LHCI.ServerCommand.DeleteOldBuildsCron} cronConfig