summaryrefslogtreecommitdiff
path: root/app/controllers/ci/lints_controller.rb
blob: 3eb485de9db8d11f44afb23cd995363c523522d8 (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 Ci
  class LintsController < ::ApplicationController
    before_action :authenticate_user!

    def show
    end

    def create
      @content = params[:content]
      @error = Ci::GitlabCiYamlProcessor.validation_message(@content)
      @status = @error.blank?

      if @error.blank?
        @config_processor = Ci::GitlabCiYamlProcessor.new(@content)
        @stages = @config_processor.stages
        @builds = @config_processor.builds
        @jobs = @config_processor.jobs
      end
    rescue
      @error = 'Undefined error'
      @status = false
    ensure
      render :show
    end
  end
end