Class: CommitStatus
Constant Summary
TaggableQueries::MAX_TAGS_IDS, TaggableQueries::TooManyTagsError
Ci::HasStatus::ACTIVE_STATUSES, Ci::HasStatus::ALIVE_STATUSES, Ci::HasStatus::AVAILABLE_STATUSES, Ci::HasStatus::BLOCKED_STATUS, Ci::HasStatus::CANCELABLE_STATUSES, Ci::HasStatus::COMPLETED_STATUSES, Ci::HasStatus::DEFAULT_STATUS, Ci::HasStatus::IGNORED_STATUSES, Ci::HasStatus::ORDERED_STATUSES, Ci::HasStatus::PASSED_WITH_WARNINGS_STATUSES, Ci::HasStatus::STARTED_STATUSES, Ci::HasStatus::STATUSES_ENUM, Ci::HasStatus::STOPPED_STATUSES, Ci::HasStatus::UnknownStatusError
Ci::Partitionable::MUTEX
ApplicationRecord::MAX_PLUCK
ResetOnUnionError::MAX_RESET_PERIOD
Instance Attribute Summary
Attributes included from Importable
#imported, #importing
Class Method Summary
collapse
Instance Method Summary
collapse
#tags_ids
#bulk_insert_associations!, bulk_inserts_enabled?, with_bulk_insert
#present
#run_after_commit, #run_after_commit_or_now
#active?, #blocked?, #complete?, #incomplete?, #started?
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!, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order
#serializable_hash
Class Method Details
.locking_enabled? ⇒ Boolean
228
229
230
|
# File 'app/models/commit_status.rb', line 228
def self.locking_enabled?
false
end
|
.names ⇒ Object
217
218
219
|
# File 'app/models/commit_status.rb', line 217
def self.names
select(:name)
end
|
.switch_table_names ⇒ Object
12
13
14
15
16
17
18
|
# File 'app/models/commit_status.rb', line 12
def self.switch_table_names
if Gitlab::Utils.to_boolean(ENV['USE_CI_BUILDS_ROUTING_TABLE'])
:p_ci_builds
else
:ci_builds
end
end
|
.update_as_processed! ⇒ Object
221
222
223
224
225
226
|
# File 'app/models/commit_status.rb', line 221
def self.update_as_processed!
update_all(processed: true)
end
|
Instance Method Details
#all_met_to_become_pending? ⇒ Boolean
284
285
286
|
# File 'app/models/commit_status.rb', line 284
def all_met_to_become_pending?
true
end
|
#archived? ⇒ Boolean
272
273
274
|
# File 'app/models/commit_status.rb', line 272
def archived?
false
end
|
#auto_canceled? ⇒ Boolean
288
289
290
|
# File 'app/models/commit_status.rb', line 288
def auto_canceled?
canceled? && auto_canceled_by_id?
end
|
#cancelable? ⇒ Boolean
268
269
270
|
# File 'app/models/commit_status.rb', line 268
def cancelable?
false
end
|
#detailed_status(current_user) ⇒ Object
292
293
294
295
296
|
# File 'app/models/commit_status.rb', line 292
def detailed_status(current_user)
Gitlab::Ci::Status::Factory
.new(self, current_user)
.fabricate!
end
|
#duration ⇒ Object
247
248
249
|
# File 'app/models/commit_status.rb', line 247
def duration
calculate_duration(started_at, finished_at)
end
|
#expire_etag_cache! ⇒ Object
#group_name ⇒ Object
236
237
238
239
240
241
242
243
244
|
# File 'app/models/commit_status.rb', line 236
def group_name
regex = %r{([\b\s:]+((\[.*\])|(\d+[\s:\/\\]+\d+))){1,3}\s*\z}
name.to_s.sub(regex, '').strip
end
|
#has_trace? ⇒ Boolean
280
281
282
|
# File 'app/models/commit_status.rb', line 280
def has_trace?
false
end
|
#importing? ⇒ Object
We still create some CommitStatuses outside of CreatePipelineService.
These are pages deployments and external statuses.
114
115
116
117
118
119
120
121
122
|
# File 'app/models/commit_status.rb', line 114
before_create unless: :importing? do
next if Feature.enabled?(:ci_remove_ensure_stage_service, project)
Ci::EnsureStageService.new(project, user).execute(self) do |stage|
self.run_after_commit { StageUpdateWorker.perform_async(stage.id) }
end
end
|
#latest? ⇒ Boolean
256
257
258
|
# File 'app/models/commit_status.rb', line 256
def latest?
!retried?
end
|
#locking_enabled? ⇒ Boolean
232
233
234
|
# File 'app/models/commit_status.rb', line 232
def locking_enabled?
will_save_change_to_status?
end
|
#playable? ⇒ Boolean
260
261
262
|
# File 'app/models/commit_status.rb', line 260
def playable?
false
end
|
#queued_duration ⇒ Object
Time spent in the pending state.
252
253
254
|
# File 'app/models/commit_status.rb', line 252
def queued_duration
calculate_duration(queued_at, started_at)
end
|
#recoverable? ⇒ Boolean
304
305
306
|
# File 'app/models/commit_status.rb', line 304
def recoverable?
failed? && !unrecoverable_failure?
end
|
#resource_parent ⇒ Object
333
334
335
|
# File 'app/models/commit_status.rb', line 333
def resource_parent
project
end
|
#retryable? ⇒ Boolean
264
265
266
|
# File 'app/models/commit_status.rb', line 264
def retryable?
false
end
|
#sortable_name ⇒ Object
298
299
300
301
302
|
# File 'app/models/commit_status.rb', line 298
def sortable_name
name.to_s.split(/(\d+)/).map do |v|
/\d+/.match?(v) ? v.to_i : v
end
end
|
#stage_name ⇒ Object
323
324
325
|
# File 'app/models/commit_status.rb', line 323
def stage_name
ci_stage&.name
end
|
#stuck? ⇒ Boolean
276
277
278
|
# File 'app/models/commit_status.rb', line 276
def stuck?
false
end
|
#to_ability_name ⇒ Object
328
329
330
|
# File 'app/models/commit_status.rb', line 328
def to_ability_name
'build'
end
|
#update_older_statuses_retried! ⇒ Object
308
309
310
311
312
313
314
315
|
# File 'app/models/commit_status.rb', line 308
def update_older_statuses_retried!
pipeline
.statuses
.latest
.where(name: name)
.where.not(id: id)
.update_all(retried: true, processed: true)
end
|