Commit Graph

13 Commits

Author SHA1 Message Date
dineshpanda e908e11776 Avoid calling freeze on already frozen strings in lib/gitlab 2019-09-04 09:52:02 +05:30
Lin Jen-Shin def2d5565e Adopt Fugit to replace Rufus::Scheduler 2019-01-15 17:06:15 +00:00
gfyoung 06892e88f5 Enable frozen string for lib/gitlab/ci
Enables frozen string for the following:

* lib/gitlab/ci/*.rb
* lib/gitlab/ci/build/**/*.rb
* lib/gitlab/ci/config/**/*.rb
* lib/gitlab/ci/pipeline/**/*.rb
* lib/gitlab/ci/reports/**/*.rb

Partially addresses #47424.
2018-10-26 16:36:42 -07:00
blackst0ne b26a3f91b8 [Rails5] Fix TZInfo::InvalidTimezoneIdentifier exception
In Rails 4.2.10 the `ActiveSupport::TimeZone.find_tzinfo(timezone_name)`
method calls `TZInfo::TimezoneProxy.new(timezone_name)` which returns
`timezone_name` if it is invalid.

But in Rails 5.0 the `ActiveSupport::TimeZone.find_tzinfo(timezone_name)`
method now calls the `TZInfo::Timezone.new(timezone_name)` method which
throws the `TZInfo::InvalidTimezoneIdentifier: Invalid identifier`
exception if `timezone_name` is invalid.

This commit adds the rescue block to return timezone name if the
exception is raised.

Also this change fixes the error:

```
  1) Ci::PipelineSchedule validations does not allow invalid cron patters
     Failure/Error: ActiveSupport::TimeZone.find_tzinfo(timezone).name

     TZInfo::InvalidTimezoneIdentifier:
       Invalid identifier
     # ./lib/gitlab/ci/cron_parser.rb:28:in `timezone_name'
     # ./lib/gitlab/ci/cron_parser.rb:9:in `initialize'
     # ./app/validators/cron_validator.rb:6:in `new'
     # ./app/validators/cron_validator.rb:6:in `validate_each'
     # ./spec/models/ci/pipeline_schedule_spec.rb:26:in `block (3 levels) in <top (required)>'
```
2018-04-29 10:10:36 +11:00
Dosuken shinya 1175937469 Resolve "Update gem sidekiq-cron from 0.4.4 to 0.6.0 and rufus-scheduler from 3.1.10 to 3.4.0" 2017-05-10 15:48:09 +00:00
Dosuken shinya 2fbcaaafcd Fix lazy error handling of cron parser 2017-05-03 15:23:20 +00:00
Shinya Maeda cb082ae291 Improve instantiate recursion in cron_parser.rb 2017-04-06 23:46:59 +09:00
Shinya Maeda 31bd3962d7 Add empty line in cron_parser.rb 2017-04-06 23:46:59 +09:00
Shinya Maeda 4688eb47c6 Rename cron_time_zone to cron_timezone. Separate add_concurrent_foreign_key. 2017-04-06 23:46:59 +09:00
Shinya Maeda 0c153af73d Ommit begin block in try_parse_cron 2017-04-06 23:46:59 +09:00
Shinya Maeda 4949e2b291 Separate cron_valid? and cron_time_zone_valid? 2017-04-06 23:46:59 +09:00
Shinya Maeda 3d3df09713 Dry up next_time_from. Move cron_parser_spec to appropriate location. 2017-04-06 23:46:59 +09:00
Shinya Maeda 914bef671f Move Ci::CronParser to Gitlab::Ci::CronParser 2017-04-06 23:46:58 +09:00