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
b63d20a1
Commit
b63d20a1
authored
Aug 31, 2016
by
Katarzyna Kobierska
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Documentation to Ci Lint API
parent
0d81fd05
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
4 deletions
+51
-4
doc/api/README.md
doc/api/README.md
+3
-1
doc/api/ci_lint.md
doc/api/ci_lint.md
+45
-0
lib/api/lint.rb
lib/api/lint.rb
+3
-3
No files found.
doc/api/README.md
View file @
b63d20a1
...
@@ -41,8 +41,10 @@ following locations:
...
@@ -41,8 +41,10 @@ following locations:
-
[
Sidekiq metrics
](
sidekiq_metrics.md
)
-
[
Sidekiq metrics
](
sidekiq_metrics.md
)
-
[
System Hooks
](
system_hooks.md
)
-
[
System Hooks
](
system_hooks.md
)
-
[
Tags
](
tags.md
)
-
[
Tags
](
tags.md
)
-
[
Users
](
users.md
)
-
[
Todos
](
todos.md
)
-
[
Todos
](
todos.md
)
-
[
Users
](
users.md
)
-
[
Validate the .gitlab-ci.yaml
](
ci_lint.md
)
### Internal CI API
### Internal CI API
...
...
doc/api/ci_lint.md
0 → 100644
View file @
b63d20a1
# Validate the .gitlab-ci.yaml
Check whether your .gitlab-ci.yml file is valid.
```
POST ci/lint
```
| Attribute | Type | Required | Description |
| ---------- | ------- | -------- | -------- |
|
`content`
| hash | yes | the .gitlab-ci.yaml content|
```
bash
curl
--request
POST
"https://gitlab.example.com/api/v3/ci/lint?content=YAML+Content"
```
Example response:
*
valid content
```
json
{
"status"
:
"valid"
,
"errors"
:
[]
}
```
*
invalid content
```
json
{
"status"
:
"invalid"
,
"errors"
:
[
"variables config should be a hash of key value pairs"
]
}
```
*
without the content attribute
```
json
{
"error"
:
"content is missing"
}
```
lib/api/lint.rb
View file @
b63d20a1
...
@@ -7,14 +7,14 @@ module API
...
@@ -7,14 +7,14 @@ module API
namespace
:ci
do
namespace
:ci
do
post
'/lint'
do
post
'/lint'
do
error
s
=
Ci
::
GitlabCiYamlProcessor
.
validation_message
(
params
[
:content
])
error
=
Ci
::
GitlabCiYamlProcessor
.
validation_message
(
params
[
:content
])
status
200
status
200
if
error
s
.
blank?
if
error
.
blank?
{
status:
'valid'
,
errors:
[]
}
{
status:
'valid'
,
errors:
[]
}
else
else
{
status:
'invalid'
,
errors:
[
error
s
]
}
{
status:
'invalid'
,
errors:
[
error
]
}
end
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