Class: Ci::PipelineSchedule
Constant Summary
Constants included
from Limitable
Limitable::GLOBAL_SCOPE
ApplicationRecord::MAX_PLUCK
ResetOnUnionError::MAX_RESET_PERIOD
Instance Attribute Summary
Attributes included from Importable
#imported, #importing
Instance Method Summary
collapse
extended, extensions, included, method_added, override, prepended, queue_verification, verify!
#nullify_dependent_associations_in_batches
Methods included from Limitable
#exceeds_limits?
#schedule_next_run!
#strip_attributes!
model_name, table_name_prefix
cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, pluck_primary_key, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order
#serializable_hash
Instance Method Details
#daily_limit ⇒ Object
66
67
68
|
# File 'app/models/ci/pipeline_schedule.rb', line 66
def daily_limit
project.actual_limits.limit_for(:ci_daily_pipeline_schedule_triggers)
end
|
#deactivate! ⇒ Object
51
52
53
|
# File 'app/models/ci/pipeline_schedule.rb', line 51
def deactivate!
update_attribute(:active, false)
end
|
#destroy ⇒ Object
Using destroy instead of before_destroy as we want nullify_dependent_associations_in_batches to run first and not in a transaction block. This prevents timeouts for schedules with numerous pipelines
88
89
90
91
92
|
# File 'app/models/ci/pipeline_schedule.rb', line 88
def destroy
nullify_dependent_associations_in_batches
super
end
|
#for_tag? ⇒ Boolean
76
77
78
79
80
|
# File 'app/models/ci/pipeline_schedule.rb', line 76
def for_tag?
return false unless ref.present?
ref.start_with? 'refs/tags/'
end
|
#inactive? ⇒ Boolean
47
48
49
|
# File 'app/models/ci/pipeline_schedule.rb', line 47
def inactive?
!active?
end
|
#job_variables ⇒ Object
55
56
57
|
# File 'app/models/ci/pipeline_schedule.rb', line 55
def job_variables
variables&.map(&:to_runner_variable) || []
end
|
#own!(user) ⇒ Object
43
44
45
|
# File 'app/models/ci/pipeline_schedule.rb', line 43
def own!(user)
update(owner: user)
end
|
#owned_by?(current_user) ⇒ Boolean
39
40
41
|
# File 'app/models/ci/pipeline_schedule.rb', line 39
def owned_by?(current_user)
owner == current_user
end
|
#ref_for_display ⇒ Object
70
71
72
73
74
|
# File 'app/models/ci/pipeline_schedule.rb', line 70
def ref_for_display
return unless ref.present?
ref.gsub(%r{^refs/(heads|tags)/}, '')
end
|
#set_next_run_at ⇒ Object
60
61
62
63
64
|
# File 'app/models/ci/pipeline_schedule.rb', line 60
def set_next_run_at
self.next_run_at = ::Ci::PipelineSchedules::CalculateNextRunService .new(project)
.execute(self, fallback_method: method(:calculate_next_run_at))
end
|
#worker_cron_expression ⇒ Object
82
83
84
|
# File 'app/models/ci/pipeline_schedule.rb', line 82
def worker_cron_expression
Settings.cron_jobs['pipeline_schedule_worker']['cron']
end
|