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

Cron is unable to work with multiple time zones

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • core

      Freestyle and Pipeline Jobs are unable to add corn rules for multiple timezones.

          TZ=Europe/London
          H 8 * * *
          TZ=Africa/Ouagadougou
          H(0-30) 17 * * *
      

      also code like this is illegal

          H 8 * * *
          TZ=Africa/Ouagadougou
          H(0-30) 17 * * *
      

          [JENKINS-69919] Cron is unable to work with multiple time zones

          Bartosz Nowak created issue -
          Bartosz Nowak made changes -
          Description Original: Freestyle and Pipeline Jobs are unable to add corn rules for multiple timezones.

          {code:java}
              TZ=Europe/London
              H 8 * * *
              TZ=Africa/Ouagadougou
              H(0-30) 17 * * *
          {code}
          New: Freestyle and Pipeline Jobs are unable to add corn rules for multiple timezones.

          {code:java}
              TZ=Europe/London
              H 8 * * *
              TZ=Africa/Ouagadougou
              H(0-30) 17 * * *
          {code}

          also code like this is illegal
          {code:java}
              H 8 * * *
              TZ=Africa/Ouagadougou
              H(0-30) 17 * * *
          {code}
          Bartosz Nowak made changes -
          Issue Type Original: Improvement [ 4 ] New: Bug [ 1 ]

          Bartosz Nowak added a comment -

          https://github.com/basil/jenkins/blob/master/core/src/test/java/hudson/scheduler/CronTabTest.java
          I saw that there is no test case which can handle this.
          So this means this feature is unsupported?

          Bartosz Nowak added a comment - https://github.com/basil/jenkins/blob/master/core/src/test/java/hudson/scheduler/CronTabTest.java I saw that there is no test case which can handle this. So this means this feature is unsupported?
          Alex Earl made changes -
          Comment [ Timezones are not supported in the cron syntax. ]

          Alex Earl added a comment -

          Alex Earl added a comment - Sorry, you are correct, only the first line can specify a TZ. https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/scheduler/CronTabList.java#L115

          Bartosz Nowak added a comment - - edited

          slide_o_mix Could we do something about it?

          I reported this because:
          1. It's a bit unintuitive and undocumented. As far as I know, corn allows for it.
          https://serverfault.com/questions/374284/crontab-schedule-in-different-timezones
          2. In a multicultural work environment where each team works from a different timezone, It would be nice to trigger a job in a timezone you are familiar with.
          Maybe in normal `cron` it's not so useful, but for this plugin it can be crucial.
          https://plugins.jenkins.io/parameterized-trigger/

          I have a team from India and other from US.
          They all use the same pipeline to trigger a set of other pipelines, with different locale parameter.

          Bartosz Nowak added a comment - - edited slide_o_mix Could we do something about it? I reported this because: 1. It's a bit unintuitive and undocumented. As far as I know, corn allows for it. https://serverfault.com/questions/374284/crontab-schedule-in-different-timezones 2. In a multicultural work environment where each team works from a different timezone, It would be nice to trigger a job in a timezone you are familiar with. Maybe in normal `cron` it's not so useful, but for this plugin it can be crucial. https://plugins.jenkins.io/parameterized-trigger/ I have a team from India and other from US. They all use the same pipeline to trigger a set of other pipelines, with different locale parameter.

          Alex Earl added a comment -

          I'm sure something can be done about it. I don't know if someone has the bandwidth to look at it.

          Alex Earl added a comment - I'm sure something can be done about it. I don't know if someone has the bandwidth to look at it.
          Bartosz Nowak made changes -
          Labels New: core cron

          Bartosz Nowak added a comment -

          Anybody is interested in fixing this?

          Bartosz Nowak added a comment - Anybody is interested in fixing this?

            Unassigned Unassigned
            dumam Bartosz Nowak
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: