2015-08-25 21:42:46 -04:00
|
|
|
module Ci
|
|
|
|
class TriggerRequest < ActiveRecord::Base
|
2017-09-06 07:13:52 -04:00
|
|
|
extend Gitlab::Ci::Model
|
2016-07-03 19:58:58 -04:00
|
|
|
|
2016-10-18 17:20:36 -04:00
|
|
|
belongs_to :trigger
|
|
|
|
belongs_to :pipeline, foreign_key: :commit_id
|
|
|
|
has_many :builds
|
2015-08-25 21:42:46 -04:00
|
|
|
|
2017-08-28 10:29:28 -04:00
|
|
|
# We switched to Ci::PipelineVariable from Ci::TriggerRequest.variables.
|
2017-08-24 04:08:32 -04:00
|
|
|
# Ci::TriggerRequest doesn't save variables anymore.
|
|
|
|
validates :variables, absence: true
|
|
|
|
|
2017-07-03 10:01:41 -04:00
|
|
|
serialize :variables # rubocop:disable Cop/ActiveRecordSerialize
|
2016-07-20 07:17:21 -04:00
|
|
|
|
|
|
|
def user_variables
|
|
|
|
return [] unless variables
|
|
|
|
|
|
|
|
variables.map do |key, value|
|
|
|
|
{ key: key, value: value, public: false }
|
|
|
|
end
|
|
|
|
end
|
2015-08-25 21:42:46 -04:00
|
|
|
end
|
|
|
|
end
|