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
Jérome Perrin
gitlab-ce
Commits
0d81fd05
Commit
0d81fd05
authored
Aug 30, 2016
by
Katarzyna Kobierska
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code refactor
parent
1a7a900d
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
9 additions
and
10 deletions
+9
-10
app/controllers/ci/lints_controller.rb
app/controllers/ci/lints_controller.rb
+2
-4
lib/api/lint.rb
lib/api/lint.rb
+1
-1
lib/ci/gitlab_ci_yaml_processor.rb
lib/ci/gitlab_ci_yaml_processor.rb
+1
-0
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
+1
-1
spec/requests/api/lint_spec.rb
spec/requests/api/lint_spec.rb
+4
-4
No files found.
app/controllers/ci/lints_controller.rb
View file @
0d81fd05
...
...
@@ -8,14 +8,12 @@ module Ci
def
create
@content
=
params
[
:content
]
@error
=
Ci
::
GitlabCiYamlProcessor
.
validation_message
(
@content
)
unless
@error
.
blank?
@status
=
@error
.
blank?
else
if
@error
.
blank?
@config_processor
=
Ci
::
GitlabCiYamlProcessor
.
new
(
@content
)
@stages
=
@config_processor
.
stages
@builds
=
@config_processor
.
builds
@status
=
true
end
rescue
@error
=
'Undefined error'
...
...
lib/api/lint.rb
View file @
0d81fd05
...
...
@@ -5,7 +5,7 @@ module API
requires
:content
,
type:
String
,
desc:
'Content of .gitlab-ci.yml'
end
namespace
'ci'
do
namespace
:ci
do
post
'/lint'
do
errors
=
Ci
::
GitlabCiYamlProcessor
.
validation_message
(
params
[
:content
])
...
...
lib/ci/gitlab_ci_yaml_processor.rb
View file @
0d81fd05
...
...
@@ -80,6 +80,7 @@ module Ci
def
self
.
validation_message
(
content
)
return
'Please provide content of .gitlab-ci.yml'
if
content
.
blank?
begin
Ci
::
GitlabCiYamlProcessor
.
new
(
content
)
nil
...
...
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
View file @
0d81fd05
...
...
@@ -1251,7 +1251,7 @@ EOT
end
end
describe
"#
errors
"
do
describe
"#
validation_message
"
do
context
"when the YAML could not be parsed"
do
it
"returns an error about invalid configutaion"
do
content
=
YAML
.
dump
(
"invalid: yaml: test"
)
...
...
spec/requests/api/lint_spec.rb
View file @
0d81fd05
...
...
@@ -4,11 +4,11 @@ describe API::Lint, api: true do
include
ApiHelpers
describe
'POST /ci/lint'
do
context
'with valid .gitlab-ci.yaml content'
do
let
(
:yaml_content
)
do
File
.
read
(
Rails
.
root
.
join
(
'spec/support/gitlab_stubs/gitlab_ci.yml'
))
end
context
'with valid .gitlab-ci.yaml content'
do
it
'passes validation'
do
post
api
(
'/ci/lint'
),
{
content:
yaml_content
}
...
...
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