Skip to content

Scheduled pipelines throw TZInfo::AmbiguousTime with cron jobs scheduled after 2020-11-01

Summary

The present version of Fugit (v1.2.1) throws and exception when trying to calculate the next_time for a once-a-year cron if it is out more than 11 months, which is the case once it has run.

If such a cron is used in a pipeline schedule, it breaks the schedule run preventing all schedules after it in the iteration from running.

Steps to reproduce

Using gitlab-rails c or similarly using Fugit v1.2.1 (the current version in GitLab):

Fugit::VERSION
=> "1.2.1"

Fugit::Cron.new('7 12 30 9 *').next_time(Time.now)
=> #<EtOrbi::EoTime:0x00007fa8ab5d8850 @seconds=1601485620.0, @zone=#<TZInfo::DataTimezone: America/Chicago>, @time=nil>

Fugit::Cron.new('7 12 1 10 *').next_time(Time.now)
Traceback (most recent call last):
        1: from (irb):238
TZInfo::AmbiguousTime (Time: 2020-11-01 01:00:00 UTC is an ambiguous local time.)

What is the current bug behavior?

Throws an exception.

Note that the error referring to TZInfo::AmbiguousTime is a red herring and irrelevant.

What is the expected correct behavior?

Return a valid EtOrbi::EoTime.

Possible fixes

The latest version of Fugit (v3.1.3) does not have this bug. Suggest upgrading GitLab to use this version.

Edited by Stan Hu