BigW Consortium Gitlab

lints_controller.rb 611 Bytes
Newer Older
1
module Ci
2
  class LintsController < ::ApplicationController
Valery Sizov committed
3
    before_action :authenticate_user!
4 5 6 7 8

    def show
    end

    def create
9
      @content = params[:content]
Katarzyna Kobierska committed
10
      @error = Ci::GitlabCiYamlProcessor.validation_message(@content)
Katarzyna Kobierska committed
11
      @status = @error.blank?
12

Katarzyna Kobierska committed
13
      if @error.blank?
14
        @config_processor = Ci::GitlabCiYamlProcessor.new(@content)
15 16
        @stages = @config_processor.stages
        @builds = @config_processor.builds
17
        @jobs = @config_processor.jobs
18
      end
19
    rescue
20
      @error = 'Undefined error'
21
      @status = false
22 23
    ensure
      render :show
24 25 26
    end
  end
end