2017-09-10 17:25:29 +05:30
|
|
|
# Validate the .gitlab-ci.yml (API)
|
2016-09-29 09:46:39 +05:30
|
|
|
|
|
|
|
> [Introduced][ce-5953] in GitLab 8.12.
|
|
|
|
|
|
|
|
Checks if your .gitlab-ci.yml file is valid.
|
|
|
|
|
|
|
|
```
|
2018-03-17 18:26:18 +05:30
|
|
|
POST /lint
|
2016-09-29 09:46:39 +05:30
|
|
|
```
|
|
|
|
|
|
|
|
| Attribute | Type | Required | Description |
|
|
|
|
| ---------- | ------- | -------- | -------- |
|
|
|
|
| `content` | string | yes | the .gitlab-ci.yaml content|
|
|
|
|
|
|
|
|
```bash
|
2017-08-17 22:00:37 +05:30
|
|
|
curl --header "Content-Type: application/json" https://gitlab.example.com/api/v4/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\"]}}"}'
|
2016-09-29 09:46:39 +05:30
|
|
|
```
|
|
|
|
|
|
|
|
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"
|
|
|
|
}
|
|
|
|
```
|
2017-09-10 17:25:29 +05:30
|
|
|
|
|
|
|
[ce-5953]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5953
|
2018-03-17 18:26:18 +05:30
|
|
|
|