gitlab-org--gitlab-foss/app/models/ci/trigger_request.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 lines
672 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2015-08-26 01:42:46 +00:00
module Ci
class TriggerRequest < Ci::ApplicationRecord
belongs_to :trigger
belongs_to :pipeline, foreign_key: :commit_id
has_many :builds
2015-08-26 01:42:46 +00:00
delegate :short_token, to: :trigger, prefix: true, allow_nil: true
2017-08-28 14:29:28 +00:00
# We switched to Ci::PipelineVariable from Ci::TriggerRequest.variables.
# Ci::TriggerRequest doesn't save variables anymore.
validates :variables, absence: true
serialize :variables # rubocop:disable Cop/ActiveRecordSerialize
2016-07-20 11:17:21 +00:00
def user_variables
return [] unless variables
variables.map do |key, value|
{ key: key, value: value, public: false }
end
end
2015-08-26 01:42:46 +00:00
end
end