Class: Ci::RunningBuild

Inherits:
ApplicationRecord show all
Defined in:
app/models/ci/running_build.rb

Constant Summary

Constants inherited from ApplicationRecord

ApplicationRecord::MAX_PLUCK

Class Method Summary collapse

Methods inherited from ApplicationRecord

model_name, table_name_prefix

Methods inherited from ApplicationRecord

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

Methods included from SensitiveSerializableHash

#serializable_hash

Class Method Details

.upsert_shared_runner_build!(build) ⇒ Object


11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/models/ci/running_build.rb', line 11

def self.upsert_shared_runner_build!(build)
  unless build.shared_runner_build?
    raise ArgumentError, 'build has not been picked by a shared runner'
  end

  entry = self.new(build: build,
                   project: build.project,
                   runner: build.runner,
                   runner_type: build.runner.runner_type)

  entry.validate!

  self.upsert(entry.attributes.compact, returning: %w[build_id], unique_by: :build_id)
end