summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-09-07 13:06:21 +0000
committerRémy Coutable <remy@rymai.me>2016-09-07 13:06:21 +0000
commita83c5ff48f74c718bd4d0f9b5746502e2ebaff27 (patch)
tree269c43497cb8e989ab476dcaab454937cdf4dba8 /doc
parent39d1e4acd282bf419c130e4567e552c275f28bdd (diff)
parentea48310579385c86cd6da9663e8150701707452d (diff)
downloadgitlab-ce-a83c5ff48f74c718bd4d0f9b5746502e2ebaff27.tar.gz
Merge branch '15571-api-for-ci-lint' into 'master'
API for CI Lint ## What does this MR do? Add API for CI Lint. Can check if `.gitlab-ci.yml` content is valid. ## What are the relevant issue numbers? Closes #15571 ## Does this MR meet the acceptance criteria? - [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added - [x] API support added - [x] Documentation - Tests - [x] Added for this feature/bug - [x] All builds are passing cc @ubudzisz @grzesiek @yorickpeterse See merge request !5953
Diffstat (limited to 'doc')
-rw-r--r--doc/api/README.md3
-rw-r--r--doc/api/ci/lint.md49
2 files changed, 51 insertions, 1 deletions
diff --git a/doc/api/README.md b/doc/api/README.md
index 96d94e08487..e12070dc1ce 100644
--- a/doc/api/README.md
+++ b/doc/api/README.md
@@ -41,8 +41,9 @@ following locations:
- [Sidekiq metrics](sidekiq_metrics.md)
- [System Hooks](system_hooks.md)
- [Tags](tags.md)
-- [Users](users.md)
- [Todos](todos.md)
+- [Users](users.md)
+- [Validate CI configuration](ci/lint.md)
### Internal CI API
diff --git a/doc/api/ci/lint.md b/doc/api/ci/lint.md
new file mode 100644
index 00000000000..0c96b3ee335
--- /dev/null
+++ b/doc/api/ci/lint.md
@@ -0,0 +1,49 @@
+# Validate the .gitlab-ci.yml
+
+> [Introduced][ce-5953] in GitLab 8.12.
+
+Checks if your .gitlab-ci.yml file is valid.
+
+```
+POST ci/lint
+```
+
+| Attribute | Type | Required | Description |
+| ---------- | ------- | -------- | -------- |
+| `content` | string | yes | the .gitlab-ci.yaml content|
+
+```bash
+curl --header "Content-Type: application/json" https://gitlab.example.com/api/v3/ci/lint --data '{"content": "{ \"image\": \"ruby:2.1\", \"services\": [\"postgres\"], \"before_script\": [\"gem install bundler\", \"bundle install\", \"bundle exec rake db:create\"], \"variables\": {\"DB_NAME\": \"postgres\"}, \"types\": [\"test\", \"deploy\", \"notify\"], \"rspec\": { \"script\": \"rake spec\", \"tags\": [\"ruby\", \"postgres\"], \"only\": [\"branches\"]}}"}'
+```
+
+Be sure to copy paste the exact contents of `.gitlab-ci.yml` as YAML is very picky about indentation and spaces.
+
+Example responses:
+
+* 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"
+ }
+ ```