Commit 7759242a authored by Grzegorz Bizon's avatar Grzegorz Bizon

Move global CI cache configuration to new CI classes

parent f4421817
...@@ -13,7 +13,7 @@ module Ci ...@@ -13,7 +13,7 @@ module Ci
ALLOWED_CACHE_KEYS = [:key, :untracked, :paths] ALLOWED_CACHE_KEYS = [:key, :untracked, :paths]
ALLOWED_ARTIFACTS_KEYS = [:name, :untracked, :paths, :when, :expire_in] ALLOWED_ARTIFACTS_KEYS = [:name, :untracked, :paths, :when, :expire_in]
attr_reader :path, :cache attr_reader :path, :cache, :stages
def initialize(config, path = nil) def initialize(config, path = nil)
@ci_config = Gitlab::Ci::Config.new(config) @ci_config = Gitlab::Ci::Config.new(config)
...@@ -44,10 +44,6 @@ module Ci ...@@ -44,10 +44,6 @@ module Ci
end end
end end
def stages
@stages
end
def global_variables def global_variables
@variables @variables
end end
...@@ -68,8 +64,8 @@ module Ci ...@@ -68,8 +64,8 @@ module Ci
@services = @ci_config.services @services = @ci_config.services
@variables = @ci_config.variables @variables = @ci_config.variables
@stages = @ci_config.stages @stages = @ci_config.stages
@cache = @ci_config.cache
@cache = @config[:cache]
@jobs = {} @jobs = {}
@config.except!(*ALLOWED_YAML_KEYS) @config.except!(*ALLOWED_YAML_KEYS)
...@@ -116,8 +112,6 @@ module Ci ...@@ -116,8 +112,6 @@ module Ci
end end
def validate! def validate!
validate_global_cache! if @cache
@jobs.each do |name, job| @jobs.each do |name, job|
validate_job!(name, job) validate_job!(name, job)
end end
...@@ -125,26 +119,6 @@ module Ci ...@@ -125,26 +119,6 @@ module Ci
true true
end end
def validate_global_cache!
@cache.keys.each do |key|
unless ALLOWED_CACHE_KEYS.include?(key)
raise ValidationError, "Cache config has unknown parameter: #{key}"
end
end
if @cache[:key] && !validate_string(@cache[:key])
raise ValidationError, "cache:key parameter should be a string"
end
if @cache[:untracked] && !validate_boolean(@cache[:untracked])
raise ValidationError, "cache:untracked parameter should be an boolean"
end
if @cache[:paths] && !validate_array_of_strings(@cache[:paths])
raise ValidationError, "cache:paths parameter should be an array of strings"
end
end
def validate_job!(name, job) def validate_job!(name, job)
validate_job_name!(name) validate_job_name!(name)
validate_job_keys!(name, job) validate_job_keys!(name, job)
......
...@@ -8,7 +8,7 @@ module Gitlab ...@@ -8,7 +8,7 @@ module Gitlab
# Temporary delegations that should be removed after refactoring # Temporary delegations that should be removed after refactoring
# #
delegate :before_script, :image, :services, :after_script, :variables, delegate :before_script, :image, :services, :after_script, :variables,
:stages, to: :@global :stages, :cache, to: :@global
def initialize(config) def initialize(config)
@config = Loader.new(config).load! @config = Loader.new(config).load!
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment