debian-mirror-gitlab/app/controllers/projects/ci/lints_controller.rb

36 lines
737 B
Ruby
Raw Normal View History

2018-12-05 23:21:45 +05:30
# frozen_string_literal: true
2018-05-09 12:01:36 +05:30
class Projects::Ci::LintsController < Projects::ApplicationController
before_action :authorize_create_pipeline!
def show
end
def create
@content = params[:content]
2020-01-01 13:55:28 +05:30
result = Gitlab::Ci::YamlProcessor.new_with_validation_errors(@content, yaml_processor_options)
2018-05-09 12:01:36 +05:30
2020-03-09 13:42:32 +05:30
@status = result.valid?
@errors = result.errors
2020-01-01 13:55:28 +05:30
if result.valid?
@config_processor = result.content
2018-05-09 12:01:36 +05:30
@stages = @config_processor.stages
@builds = @config_processor.builds
@jobs = @config_processor.jobs
end
render :show
end
private
def yaml_processor_options
2019-02-15 15:39:39 +05:30
{
project: @project,
user: current_user,
sha: project.repository.commit.sha
}
2018-05-09 12:01:36 +05:30
end
end