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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
c5001c49
Commit
c5001c49
authored
Apr 05, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
9754c551
07388b30
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
1 deletion
+22
-1
changelogs/unreleased/fix-include-ci-yaml.yml
changelogs/unreleased/fix-include-ci-yaml.yml
+5
-0
lib/gitlab/ci/config/entry/includes.rb
lib/gitlab/ci/config/entry/includes.rb
+1
-1
lib/gitlab/config/entry/validators.rb
lib/gitlab/config/entry/validators.rb
+8
-0
spec/lib/gitlab/ci/yaml_processor_spec.rb
spec/lib/gitlab/ci/yaml_processor_spec.rb
+8
-0
No files found.
changelogs/unreleased/fix-include-ci-yaml.yml
0 → 100644
View file @
c5001c49
---
title
:
Fix single string values for the 'include' keyword validation of gitlab-ci.yml.
merge_request
:
26998
author
:
Paul Bonaud (@paulrbr)
type
:
fixed
lib/gitlab/ci/config/entry/includes.rb
View file @
c5001c49
...
...
@@ -11,7 +11,7 @@ module Gitlab
include
::
Gitlab
::
Config
::
Entry
::
Validatable
validations
do
validates
:config
,
type:
Array
validates
:config
,
array_or_string:
true
end
def
self
.
aspects
...
...
lib/gitlab/config/entry/validators.rb
View file @
c5001c49
...
...
@@ -54,6 +54,14 @@ module Gitlab
end
end
class
ArrayOrStringValidator
<
ActiveModel
::
EachValidator
def
validate_each
(
record
,
attribute
,
value
)
unless
value
.
is_a?
(
Array
)
||
value
.
is_a?
(
String
)
record
.
errors
.
add
(
attribute
,
'should be an array or a string'
)
end
end
end
class
BooleanValidator
<
ActiveModel
::
EachValidator
include
LegacyValidationHelpers
...
...
spec/lib/gitlab/ci/yaml_processor_spec.rb
View file @
c5001c49
...
...
@@ -615,6 +615,14 @@ module Gitlab
subject
{
Gitlab
::
Ci
::
YamlProcessor
.
new
(
YAML
.
dump
(
config
),
opts
)
}
context
"when validating a ci config file with no project context"
do
context
"when a single string is provided"
do
let
(
:include_content
)
{
"/local.gitlab-ci.yml"
}
it
"does not return any error"
do
expect
{
subject
}.
not_to
raise_error
end
end
context
"when an array is provided"
do
let
(
:include_content
)
{
[
"/local.gitlab-ci.yml"
]
}
...
...
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