Commit d9574c0c authored by Shinya Maeda's avatar Shinya Maeda

Maintain MR

parent 57d082f3
...@@ -9,7 +9,6 @@ class TriggerScheduleWorker ...@@ -9,7 +9,6 @@ class TriggerScheduleWorker
trigger_schedule.trigger, trigger_schedule.trigger,
trigger_schedule.ref) trigger_schedule.ref)
rescue => e rescue => e
puts "#{trigger_schedule.id}: Failed to trigger_schedule job: #{e.message}" # TODO: Remove before merge
Rails.logger.error "#{trigger_schedule.id}: Failed to trigger_schedule job: #{e.message}" Rails.logger.error "#{trigger_schedule.id}: Failed to trigger_schedule job: #{e.message}"
ensure ensure
trigger_schedule.schedule_next_run! trigger_schedule.schedule_next_run!
......
---
title: Resolve "Run CI/CD pipelines on a schedule" - "Basic backend implementation"
merge_request: 10133
author: dosuken123
...@@ -7,22 +7,6 @@ class AddRefToTriggers < ActiveRecord::Migration ...@@ -7,22 +7,6 @@ class AddRefToTriggers < ActiveRecord::Migration
# Set this constant to true if this migration requires downtime. # Set this constant to true if this migration requires downtime.
DOWNTIME = false DOWNTIME = false
# When a migration requires downtime you **must** uncomment the following
# constant and define a short and easy to understand explanation as to why the
# migration requires downtime.
# DOWNTIME_REASON = ''
# When using the methods "add_concurrent_index" or "add_column_with_default"
# you must disable the use of transactions as these methods can not run in an
# existing transaction. When using "add_concurrent_index" make sure that this
# method is the _only_ method called in the migration, any other changes
# should go in a separate migration. This ensures that upon failure _only_ the
# index creation fails and can be retried or reverted easily.
#
# To disable transactions uncomment the following line and remove these
# comments:
# disable_ddl_transaction!
def change def change
add_column :ci_triggers, :ref, :string add_column :ci_triggers, :ref, :string
end end
......
...@@ -7,22 +7,6 @@ class CreateCiTriggerSchedules < ActiveRecord::Migration ...@@ -7,22 +7,6 @@ class CreateCiTriggerSchedules < ActiveRecord::Migration
# Set this constant to true if this migration requires downtime. # Set this constant to true if this migration requires downtime.
DOWNTIME = false DOWNTIME = false
# When a migration requires downtime you **must** uncomment the following
# constant and define a short and easy to understand explanation as to why the
# migration requires downtime.
# DOWNTIME_REASON = ''
# When using the methods "add_concurrent_index" or "add_column_with_default"
# you must disable the use of transactions as these methods can not run in an
# existing transaction. When using "add_concurrent_index" make sure that this
# method is the _only_ method called in the migration, any other changes
# should go in a separate migration. This ensures that upon failure _only_ the
# index creation fails and can be retried or reverted easily.
#
# To disable transactions uncomment the following line and remove these
# comments:
# disable_ddl_transaction!
def change def change
create_table :ci_trigger_schedules do |t| create_table :ci_trigger_schedules do |t|
t.integer "project_id" t.integer "project_id"
......
...@@ -7,8 +7,8 @@ describe TriggersHelper do ...@@ -7,8 +7,8 @@ describe TriggersHelper do
subject { helper.real_next_run(trigger_schedule, worker_cron: worker_cron, worker_time_zone: 'UTC') } subject { helper.real_next_run(trigger_schedule, worker_cron: worker_cron, worker_time_zone: 'UTC') }
context 'when next_run_at > worker_next_time' do context 'when next_run_at > worker_next_time' do
let(:worker_cron) { '* * * * *' } # every minutes let(:worker_cron) { '0 0 1 1 *' } # every 00:00, January 1st
let(:user_cron) { '0 0 1 1 *' } # every 00:00, January 1st let(:user_cron) { '1 0 1 1 *' } # every 00:01, January 1st
it 'returns next_run_at' do it 'returns next_run_at' do
is_expected.to eq(trigger_schedule.next_run_at) is_expected.to eq(trigger_schedule.next_run_at)
...@@ -16,8 +16,8 @@ describe TriggersHelper do ...@@ -16,8 +16,8 @@ describe TriggersHelper do
end end
context 'when worker_next_time > next_run_at' do context 'when worker_next_time > next_run_at' do
let(:worker_cron) { '0 0 1 1 *' } # every 00:00, January 1st let(:worker_cron) { '1 0 1 1 *' } # every 00:01, January 1st
let(:user_cron) { '0 */6 * * *' } # each six hours let(:user_cron) { '0 0 1 1 *' } # every 00:00, January 1st
it 'returns worker_next_time' do it 'returns worker_next_time' do
is_expected.to eq(Ci::CronParser.new(worker_cron, 'UTC').next_time_from(Time.now)) is_expected.to eq(Ci::CronParser.new(worker_cron, 'UTC').next_time_from(Time.now))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment