Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
7759242a
Commit
7759242a
authored
Jun 29, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move global CI cache configuration to new CI classes
parent
f4421817
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
29 deletions
+3
-29
lib/ci/gitlab_ci_yaml_processor.rb
lib/ci/gitlab_ci_yaml_processor.rb
+2
-28
lib/gitlab/ci/config.rb
lib/gitlab/ci/config.rb
+1
-1
No files found.
lib/ci/gitlab_ci_yaml_processor.rb
View file @
7759242a
...
...
@@ -13,7 +13,7 @@ module Ci
ALLOWED_CACHE_KEYS
=
[
:key
,
:untracked
,
:paths
]
ALLOWED_ARTIFACTS_KEYS
=
[
:name
,
:untracked
,
:paths
,
:when
,
:expire_in
]
attr_reader
:path
,
:cache
attr_reader
:path
,
:cache
,
:stages
def
initialize
(
config
,
path
=
nil
)
@ci_config
=
Gitlab
::
Ci
::
Config
.
new
(
config
)
...
...
@@ -44,10 +44,6 @@ module Ci
end
end
def
stages
@stages
end
def
global_variables
@variables
end
...
...
@@ -68,8 +64,8 @@ module Ci
@services
=
@ci_config
.
services
@variables
=
@ci_config
.
variables
@stages
=
@ci_config
.
stages
@cache
=
@ci_config
.
cache
@cache
=
@config
[
:cache
]
@jobs
=
{}
@config
.
except!
(
*
ALLOWED_YAML_KEYS
)
...
...
@@ -116,8 +112,6 @@ module Ci
end
def
validate!
validate_global_cache!
if
@cache
@jobs
.
each
do
|
name
,
job
|
validate_job!
(
name
,
job
)
end
...
...
@@ -125,26 +119,6 @@ module Ci
true
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
)
validate_job_name!
(
name
)
validate_job_keys!
(
name
,
job
)
...
...
lib/gitlab/ci/config.rb
View file @
7759242a
...
...
@@ -8,7 +8,7 @@ module Gitlab
# Temporary delegations that should be removed after refactoring
#
delegate
:before_script
,
:image
,
:services
,
:after_script
,
:variables
,
:stages
,
to: :@global
:stages
,
:cache
,
to: :@global
def
initialize
(
config
)
@config
=
Loader
.
new
(
config
).
load!
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment