CI Lint endpoint also accepting YAML
Problem to solve
Having a simple method of linting CI definition before commiting and pushing towards GitLab
Intended users
Developers
Further details
At the moment the endpoint only accepts JSON as content type. The file however is in yaml. So its not intuitive to create a JSON which contains just a single element with an JSON-escaped YAML. This makes it no so simple to just push the YAML towards the endpoint for linting it. Why can't we do a simple
curl -H "Content-Type: text/yaml" --data @.gitlab-ci.yml https://mygitlab.com/api/v4/ci/lint
Would be nice if we could simply use this in a pre-commit hook or so to avoid additional commit + push cycles in case of any invalid changes to the CI definition.
Alternatively, what about having a push rule on the GitLab project to reject pushes if they contain an invalid yaml file.