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
Léo-Paul Géneau
gitlab-ce
Commits
cd72189f
Commit
cd72189f
authored
Sep 07, 2018
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Import external files in Gitlab CI config
CE mirror of a10b777f8cb1902bba3964a4cbad2b1dd6bce785
parent
5f33690e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
8 deletions
+13
-8
app/models/ci/pipeline.rb
app/models/ci/pipeline.rb
+1
-1
lib/gitlab/ci/config.rb
lib/gitlab/ci/config.rb
+8
-3
lib/gitlab/ci/yaml_processor.rb
lib/gitlab/ci/yaml_processor.rb
+2
-2
spec/lib/gitlab/ci/config_spec.rb
spec/lib/gitlab/ci/config_spec.rb
+2
-2
No files found.
app/models/ci/pipeline.rb
View file @
cd72189f
...
...
@@ -464,7 +464,7 @@ module Ci
return
@config_processor
if
defined?
(
@config_processor
)
@config_processor
||=
begin
Gitlab
::
Ci
::
YamlProcessor
.
new
(
ci_yaml_file
)
Gitlab
::
Ci
::
YamlProcessor
.
new
(
ci_yaml_file
,
project
)
rescue
Gitlab
::
Ci
::
YamlProcessor
::
ValidationError
=>
e
self
.
yaml_errors
=
e
.
message
nil
...
...
lib/gitlab/ci/config.rb
View file @
cd72189f
...
...
@@ -6,12 +6,17 @@ module Gitlab
class
Config
ConfigError
=
Class
.
new
(
StandardError
)
def
initialize
(
config
,
opts
=
{})
def
initialize
(
config
,
project
=
nil
,
opts
=
{})
initial_config
=
Config
::
Extendable
.
new
(
build_config
(
config
,
opts
))
.
to_hash
if
project
.
present?
processor
=
::
Gitlab
::
Ci
::
ExternalFiles
::
Processor
.
new
(
initial_config
)
@config
=
processor
.
perform
else
@config
=
initial_config
end
@global
=
Entry
::
Global
.
new
(
@config
)
@global
.
compose!
...
...
lib/gitlab/ci/yaml_processor.rb
View file @
cd72189f
...
...
@@ -7,8 +7,8 @@ module Gitlab
attr_reader
:cache
,
:stages
,
:jobs
def
initialize
(
config
,
opts
=
{})
@ci_config
=
Gitlab
::
Ci
::
Config
.
new
(
config
,
opts
)
def
initialize
(
config
,
project
=
nil
,
opts
=
{})
@ci_config
=
Gitlab
::
Ci
::
Config
.
new
(
config
,
project
,
opts
)
@config
=
@ci_config
.
to_hash
unless
@ci_config
.
valid?
...
...
spec/lib/gitlab/ci/config_spec.rb
View file @
cd72189f
...
...
@@ -3,8 +3,9 @@ require 'fast_spec_helper'
require_dependency
'active_model'
describe
Gitlab
::
Ci
::
Config
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:config
)
do
described_class
.
new
(
yml
)
described_class
.
new
(
yml
,
project
)
end
context
'when config is valid'
do
...
...
@@ -125,7 +126,6 @@ describe Gitlab::Ci::Config do
end
end
context
"when yml has valid 'includes' defined"
do
let
(
:yml
)
do
<<-
EOS
...
...
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