Class: RunPipelineScheduleWorker
- Inherits:
-
Object
- Object
- RunPipelineScheduleWorker
- Includes:
- ApplicationWorker, PipelineQueue
- Defined in:
- app/workers/run_pipeline_schedule_worker.rb
Overview
rubocop:disable Scalability/IdempotentWorker
Constant Summary
Constants included from ApplicationWorker
ApplicationWorker::LOGGING_EXTRA_KEY, ApplicationWorker::SAFE_PUSH_BULK_LIMIT
Constants included from Gitlab::Loggable
Constants included from WorkerAttributes
WorkerAttributes::DEFAULT_DATA_CONSISTENCY, WorkerAttributes::DEFAULT_DEFER_DELAY, WorkerAttributes::NAMESPACE_WEIGHTS, WorkerAttributes::VALID_DATA_CONSISTENCIES, WorkerAttributes::VALID_RESOURCE_BOUNDARIES, WorkerAttributes::VALID_URGENCIES
Instance Method Summary collapse
- #perform(schedule_id, user_id, options = {}) ⇒ Object
- #run_pipeline_schedule(schedule, user) ⇒ Object
Methods included from Gitlab::Loggable
Methods included from Gitlab::SidekiqVersioning::Worker
Methods included from WorkerContext
Instance Method Details
#perform(schedule_id, user_id, options = {}) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/workers/run_pipeline_schedule_worker.rb', line 16 def perform(schedule_id, user_id, = {}) schedule = Ci::PipelineSchedule.find_by_id(schedule_id) user = User.find_by_id(user_id) return unless schedule && schedule.project && user .symbolize_keys! if [:scheduling] return if schedule.next_run_at > Time.current update_next_run_at_for(schedule) end run_pipeline_schedule(schedule, user) end |
#run_pipeline_schedule(schedule, user) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'app/workers/run_pipeline_schedule_worker.rb', line 33 def run_pipeline_schedule(schedule, user) response = Ci::CreatePipelineService .new(schedule.project, user, ref: schedule.ref) .execute( :schedule, save_on_errors: Feature.enabled?(:persist_failed_pipelines_from_schedules, schedule.project), ignore_skip_ci: true, schedule: schedule ) return response if response.payload.persisted? # Remove with FF persist_failed_pipelines_from_schedules enabled, as corrupted yml is not longer logged # This is a user operation error such as corrupted .gitlab-ci.yml. Log the error for debugging purpose. (:pipeline_creation_error, response.) rescue StandardError => e error(schedule, e) end |