debian-mirror-gitlab/app/controllers/projects/ci/lints_controller.rb
2020-01-01 13:55:28 +05:30

35 lines
750 B
Ruby

# frozen_string_literal: true
class Projects::Ci::LintsController < Projects::ApplicationController
before_action :authorize_create_pipeline!
def show
end
def create
@content = params[:content]
result = Gitlab::Ci::YamlProcessor.new_with_validation_errors(@content, yaml_processor_options)
@error = result.errors.join(', ')
@status = result.valid?
if result.valid?
@config_processor = result.content
@stages = @config_processor.stages
@builds = @config_processor.builds
@jobs = @config_processor.jobs
end
render :show
end
private
def yaml_processor_options
{
project: @project,
user: current_user,
sha: project.repository.commit.sha
}
end
end