Improve how we handle persistent runner variables
This commit is contained in:
parent
937e7f9e96
commit
e16fba6726
3 changed files with 3 additions and 19 deletions
|
@ -12,9 +12,5 @@ module Ci
|
|||
}
|
||||
|
||||
scope :unprotected, -> { where(protected: false) }
|
||||
|
||||
def to_hash
|
||||
{ key: key, value: value, public: false }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -20,12 +20,8 @@ module HasVariable
|
|||
super(new_key.to_s.strip)
|
||||
end
|
||||
|
||||
def to_hash
|
||||
{ key: key, value: value, public: false }
|
||||
end
|
||||
|
||||
def to_runner_variable
|
||||
to_hash
|
||||
{ key: key, value: value, public: false }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,8 +3,6 @@ module Gitlab
|
|||
module Variables
|
||||
class Collection
|
||||
class Item
|
||||
# TODO, public by default?
|
||||
#
|
||||
def initialize(**options)
|
||||
@variable = {
|
||||
key: options.fetch(:key),
|
||||
|
@ -34,17 +32,11 @@ module Gitlab
|
|||
end
|
||||
|
||||
def self.fabricate(resource)
|
||||
# TODO, to_runner_variable by default for class < ActiveRecord::Base
|
||||
#
|
||||
case resource
|
||||
when Hash
|
||||
self.new(resource)
|
||||
when ::Ci::Variable
|
||||
self.new(resource.to_hash)
|
||||
when ::Ci::PipelineVariable
|
||||
self.new(resource.to_hash)
|
||||
when ::Ci::GroupVariable
|
||||
self.new(resource.to_hash)
|
||||
when ::HasVariable
|
||||
self.new(resource.to_runner_variable)
|
||||
when self
|
||||
resource.dup
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue