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
fb1c7254
Commit
fb1c7254
authored
Aug 18, 2016
by
Katarzyna Kobierska
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
API for CI Lint
parent
1d548869
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
0 deletions
+55
-0
lib/ci/api/api.rb
lib/ci/api/api.rb
+1
-0
lib/ci/api/entities.rb
lib/ci/api/entities.rb
+7
-0
lib/ci/api/lint.rb
lib/ci/api/lint.rb
+24
-0
spec/requests/ci/api/lint_spec.rb
spec/requests/ci/api/lint_spec.rb
+23
-0
No files found.
lib/ci/api/api.rb
View file @
fb1c7254
...
@@ -24,6 +24,7 @@ module Ci
...
@@ -24,6 +24,7 @@ module Ci
mount
::
Ci
::
API
::
Builds
mount
::
Ci
::
API
::
Builds
mount
::
Ci
::
API
::
Runners
mount
::
Ci
::
API
::
Runners
mount
::
Ci
::
API
::
Triggers
mount
::
Ci
::
API
::
Triggers
mount
::
Ci
::
API
::
Lint
end
end
end
end
end
end
lib/ci/api/entities.rb
View file @
fb1c7254
...
@@ -59,6 +59,13 @@ module Ci
...
@@ -59,6 +59,13 @@ module Ci
expose
:id
,
:variables
expose
:id
,
:variables
expose
:pipeline
,
using:
Commit
,
as: :commit
expose
:pipeline
,
using:
Commit
,
as: :commit
end
end
class
Lint
<
Grape
::
Entity
expose
:content
expose
:status
expose
:builds
expose
:stages
end
end
end
end
end
end
end
lib/ci/api/lint.rb
0 → 100644
View file @
fb1c7254
module
Ci
module
API
class
Lint
<
Grape
::
API
before
{
authenticate!
}
resources
:lint
do
post
do
content
=
params
[
:content
]
if
content
config_processor
=
Ci
::
GitlabCiYamlProcessor
.
new
(
content
)
stages
=
config_processor
.
stages
builds
=
config_processor
.
builds
status
=
true
response
=
{
status:
status
,
stages:
stages
,
builds:
builds
}
end
response
end
end
end
end
end
spec/requests/ci/api/lint_spec.rb
0 → 100644
View file @
fb1c7254
require
'spec_helper'
describe
Ci
::
API
::
API
do
include
ApiHelpers
let
(
:content
)
do
File
.
read
(
Rails
.
root
.
join
(
'spec/support/gitlab_stubs/gitlab_ci.yml'
))
end
describe
"Builds API for Lint"
do
describe
'POST /ci/lint'
do
before
{
content
}
context
"with valid .gitlab-ci.yaml file"
do
it
"has success status"
do
# binding.pry
expect
(
response
).
to
have_content
(
true
)
end
end
end
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