Welcome to mirror list, hosted at ThFree Co, Russian Federation.

lint.rb « api « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b1c6f52bccba61692343a7d4c51f91358859cd82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
module API
  class Lint < Grape::API
    desc 'Validation of .gitlab-ci.yml content'
    params do
      requires :content, type: String, desc: 'Content of .gitlab-ci.yml'
    end

    post 'ci/lint' do
      error = Ci::GitlabCiYamlProcessor.validation_message(params[:content])
      response = {
        status: '',
        error: ''
      }

      if error.blank?
        response[:status] = 'valid'
      else
        response[:error] = error
        response[:status] = 'invalid'
      end

      status 200
      response
    end
  end
end