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

Support multiple time zones in cron expression

XMLWordPrintable

      I tried to report this via the email list, but my email bounced, so let me report it here:

      Currently, If I want to schedule a job to run at 7am in NYC time, I can easily do this by syntax that resembles this:

      TZ=America/New_York
      0 7 * * *
      

      If I want to instead run it at 7am London time, then I can change the first line to London instead of NYC and it still works.
      Ideally, I should be able to run it at 7am in BOTH time zones (that is, twice a day in total).
      The natural syntax would be:

      TZ=America/New_York
      0 7 * * *
      TZ=Europe/London
      0 7 * * *
      

      This syntax is of course not accepted, but it seems that it easily could be.
      It seems that all we need is to remove the "line number == 1" check on line 115, here:
      https://github.com/jenkinsci/jenkins/blame/master/core/src/main/java/hudson/scheduler/CronTabList.java#L115

      The only alternative is to create “wrapper” jobs, one for each time zone you care about, whose sole purpose is to invoke the “real” one.
      This is not nice because it creates clutter in the list of jobs, and also is not newbie friendly.
      I’m a Jenkins newbie myself (first “real” exposure to Jenkins was a few weeks ago) and so far I can’t even figure out HOW to create wrappers.
      Should I be using the “freestyle” jobs? Multi job? Pipeline? Something else?

            Unassigned Unassigned
            marky_b Mark
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: