diff options
5 files changed, 8 insertions, 37 deletions
diff --git a/app/workers/trigger_schedule_worker.rb b/app/workers/trigger_schedule_worker.rb index 36e640592a7..440c579b99d 100644 --- a/app/workers/trigger_schedule_worker.rb +++ b/app/workers/trigger_schedule_worker.rb @@ -9,7 +9,6 @@ class TriggerScheduleWorker trigger_schedule.trigger, trigger_schedule.ref) 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}" ensure trigger_schedule.schedule_next_run! diff --git a/changelogs/unreleased/2989-run-cicd-pipelines-on-a-schedule-idea1-basic-backend-implementation.yml b/changelogs/unreleased/2989-run-cicd-pipelines-on-a-schedule-idea1-basic-backend-implementation.yml new file mode 100644 index 00000000000..dd56409c35b --- /dev/null +++ b/changelogs/unreleased/2989-run-cicd-pipelines-on-a-schedule-idea1-basic-backend-implementation.yml @@ -0,0 +1,4 @@ +--- +title: Resolve "Run CI/CD pipelines on a schedule" - "Basic backend implementation" +merge_request: 10133 +author: dosuken123 diff --git a/db/migrate/20170329095325_add_ref_to_triggers.rb b/db/migrate/20170329095325_add_ref_to_triggers.rb index f8236b5a711..6900ded4277 100644 --- a/db/migrate/20170329095325_add_ref_to_triggers.rb +++ b/db/migrate/20170329095325_add_ref_to_triggers.rb @@ -7,22 +7,6 @@ class AddRefToTriggers < ActiveRecord::Migration # Set this constant to true if this migration requires downtime. 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 add_column :ci_triggers, :ref, :string end diff --git a/db/migrate/20170329095907_create_ci_trigger_schedules.rb b/db/migrate/20170329095907_create_ci_trigger_schedules.rb index 42f9497cac7..7b2e2e2098b 100644 --- a/db/migrate/20170329095907_create_ci_trigger_schedules.rb +++ b/db/migrate/20170329095907_create_ci_trigger_schedules.rb @@ -7,22 +7,6 @@ class CreateCiTriggerSchedules < ActiveRecord::Migration # Set this constant to true if this migration requires downtime. 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 create_table :ci_trigger_schedules do |t| t.integer "project_id" diff --git a/spec/helpers/triggers_helper_spec.rb b/spec/helpers/triggers_helper_spec.rb index ce17f4442ab..d801760335b 100644 --- a/spec/helpers/triggers_helper_spec.rb +++ b/spec/helpers/triggers_helper_spec.rb @@ -7,8 +7,8 @@ describe TriggersHelper do subject { helper.real_next_run(trigger_schedule, worker_cron: worker_cron, worker_time_zone: 'UTC') } context 'when next_run_at > worker_next_time' do - let(:worker_cron) { '* * * * *' } # every minutes - let(:user_cron) { '0 0 1 1 *' } # every 00:00, January 1st + let(:worker_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 is_expected.to eq(trigger_schedule.next_run_at) @@ -16,8 +16,8 @@ describe TriggersHelper do end context 'when worker_next_time > next_run_at' do - let(:worker_cron) { '0 0 1 1 *' } # every 00:00, January 1st - let(:user_cron) { '0 */6 * * *' } # each six hours + let(:worker_cron) { '1 0 1 1 *' } # every 00:01, January 1st + let(:user_cron) { '0 0 1 1 *' } # every 00:00, January 1st it 'returns worker_next_time' do is_expected.to eq(Ci::CronParser.new(worker_cron, 'UTC').next_time_from(Time.now)) |