2018-09-26 03:45:43 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-13 17:57:16 +00:00
|
|
|
class Projects::Ci::LintsController < Projects::ApplicationController
|
2018-03-21 21:24:49 +00:00
|
|
|
before_action :authorize_create_pipeline!
|
2018-03-13 17:57:16 +00:00
|
|
|
|
|
|
|
def show
|
|
|
|
end
|
|
|
|
|
|
|
|
def create
|
|
|
|
@content = params[:content]
|
2018-12-01 11:39:13 +00:00
|
|
|
@error = Gitlab::Ci::YamlProcessor.validation_message(@content, yaml_processor_options)
|
2018-03-13 17:57:16 +00:00
|
|
|
@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
|
2018-12-01 11:39:13 +00:00
|
|
|
{
|
|
|
|
project: @project,
|
|
|
|
user: current_user,
|
|
|
|
sha: project.repository.commit.sha
|
|
|
|
}
|
2018-03-13 17:57:16 +00:00
|
|
|
end
|
|
|
|
end
|