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

          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 added a comment -

          Anybody is interested in fixing this?

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

          Alex Earl added a comment -

          I have a possible fix somewhere, it's actually pretty simple. I just need some time to get it submitted.

          Alex Earl added a comment - I have a possible fix somewhere, it's actually pretty simple. I just need some time to get it submitted.

          Bartosz Nowak added a comment - - edited

          Nice , I would be truly grateful if this could land in upcoming LTS.

          Bartosz Nowak added a comment - - edited Nice , I would be truly grateful if this could land in upcoming LTS.

          Alex Earl added a comment -

          It wouldn't land in the upcoming LTS is my guess since it is not a bug but a feature enhancement, it would take some time to make it into an LTS.

          Alex Earl added a comment - It wouldn't land in the upcoming LTS is my guess since it is not a bug but a feature enhancement, it would take some time to make it into an LTS.

          Bartosz Nowak added a comment -

          Ok, so I will wait and cross my fingers for successful implementation.

          Bartosz Nowak added a comment - Ok, so I will wait and cross my fingers for successful implementation.

          Markus Winter added a comment -

          I've written a plugin that has an extended syntax for cron. It also supports the jenkins style syntax and allows to set the TZ anywhere in the file.
          https://plugins.jenkins.io/extended-timer-trigger/

          Markus Winter added a comment - I've written a plugin that has an extended syntax for cron. It also supports the jenkins style syntax and allows to set the TZ anywhere in the file. https://plugins.jenkins.io/extended-timer-trigger/

          Mark added a comment -

          I had not noticed this issue earlier so I submitted a duplicate (which I've now linked since I've found this one)

          Mark added a comment - I had not noticed this issue earlier so I submitted a duplicate (which I've now linked since I've found this one)

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

              Created:
              Updated: