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
0d5e6536
Commit
0d5e6536
authored
Jun 28, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix the test and implement missing update
parent
02ff4381
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
2 deletions
+18
-2
app/models/ci/pipeline.rb
app/models/ci/pipeline.rb
+2
-0
spec/models/ci/pipeline_spec.rb
spec/models/ci/pipeline_spec.rb
+16
-2
No files found.
app/models/ci/pipeline.rb
View file @
0d5e6536
...
...
@@ -327,6 +327,8 @@ module Ci
@ci_yaml_file
=
begin
project
.
repository
.
gitlab_ci_yml_for
(
sha
,
ci_yaml_file_path
)
rescue
self
.
yaml_errors
=
"Failed to load CI/CD config file at
#{
ci_yaml_file_path
}
"
nil
end
end
...
...
spec/models/ci/pipeline_spec.rb
View file @
0d5e6536
...
...
@@ -744,31 +744,45 @@ describe Ci::Pipeline, models: true do
describe
'yaml config file resolution'
do
let
(
:project
)
{
FactoryGirl
.
build
(
:project
)
}
let
(
:pipeline
)
{
create
(
:ci_empty_pipeline
,
project:
project
)
}
it
'uses custom ci config file path when present'
do
allow
(
project
).
to
receive
(
:ci_config_file
)
{
'custom/path'
}
expect
(
pipeline
.
ci_yaml_file_path
).
to
eq
(
'custom/path/.gitlab-ci.yml'
)
end
it
'uses root when custom path is nil'
do
allow
(
project
).
to
receive
(
:ci_config_file
)
{
nil
}
expect
(
pipeline
.
ci_yaml_file_path
).
to
eq
(
'.gitlab-ci.yml'
)
end
it
'uses root when custom path is empty'
do
allow
(
project
).
to
receive
(
:ci_config_file
)
{
''
}
expect
(
pipeline
.
ci_yaml_file_path
).
to
eq
(
'.gitlab-ci.yml'
)
end
it
'allows custom filename'
do
allow
(
project
).
to
receive
(
:ci_config_file
)
{
'custom/path/.my-config.yml'
}
expect
(
pipeline
.
ci_yaml_file_path
).
to
eq
(
'custom/path/.my-config.yml'
)
end
it
'custom filename must be yml'
do
allow
(
project
).
to
receive
(
:ci_config_file
)
{
'custom/path/.my-config.cnf'
}
expect
(
pipeline
.
ci_yaml_file_path
).
to
eq
(
'custom/path/.my-config.cnf/.gitlab-ci.yml'
)
end
it
'reports error if the file is not found'
do
allow
(
project
).
to
receive
(
:ci_config_file
)
{
'custom'
}
pipeline
.
ci_yaml_file
expect
(
pipeline
.
yaml_errors
).
to
eq
(
'Failed to load CI config file'
)
expect
(
pipeline
.
yaml_errors
)
.
to
eq
(
'Failed to load CI/CD config file at custom/.gitlab-ci.yml'
)
end
end
...
...
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