summaryrefslogtreecommitdiff
path: root/app/controllers/ci/lints_controller.rb
blob: e06d12cfce16ce5fe0784fb7566045a28341630e (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
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
      end
    rescue
      @error = 'Undefined error'
      @status = false
    ensure
      render :show
    end
  end
end