gitlab-org--gitlab-foss/lib/api/lint.rb

27 lines
547 B
Ruby
Raw Normal View History

2016-08-24 09:42:48 +00:00
module API
class Lint < Grape::API
2016-08-29 13:07:19 +00:00
desc 'Validation of .gitlab-ci.yml content'
params do
requires :content, type: String, desc: 'Content of .gitlab-ci.yml'
end
2016-08-29 13:07:19 +00:00
post 'ci/lint' do
error = Ci::GitlabCiYamlProcessor.validation_message(params[:content])
response = {
status: '',
error: ''
}
2016-08-29 13:07:19 +00:00
if error.blank?
response[:status] = 'valid'
else
response[:error] = error
response[:status] = 'invalid'
2016-08-24 09:42:48 +00:00
end
2016-08-29 13:07:19 +00:00
status 200
response
2016-08-24 09:42:48 +00:00
end
end
end