summaryrefslogtreecommitdiff
path: root/app/controllers/projects/ci/lints_controller.rb
blob: 2090af0a111420e36786779aa49bcdd40d297bbd (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
27
28
29
# frozen_string_literal: true

class Projects::Ci::LintsController < Projects::ApplicationController
  before_action :authorize_create_pipeline!

  def show
  end

  def create
    @content = params[:content]
    @error = Gitlab::Ci::YamlProcessor.validation_message(@content,  yaml_processor_options)
    @status = @error.blank?

    if @error.blank?
      @config_processor = Gitlab::Ci::YamlProcessor.new(@content, yaml_processor_options)
      @stages = @config_processor.stages
      @builds = @config_processor.builds
      @jobs = @config_processor.jobs
    end

    render :show
  end

  private

  def yaml_processor_options
    { project: @project, sha: project.repository.commit.sha }
  end
end