summaryrefslogtreecommitdiff
path: root/app/controllers/projects/ci/lints_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/projects/ci/lints_controller.rb')
-rw-r--r--app/controllers/projects/ci/lints_controller.rb42
1 files changed, 10 insertions, 32 deletions
diff --git a/app/controllers/projects/ci/lints_controller.rb b/app/controllers/projects/ci/lints_controller.rb
index c13baaea8c6..813a0a9ddd5 100644
--- a/app/controllers/projects/ci/lints_controller.rb
+++ b/app/controllers/projects/ci/lints_controller.rb
@@ -2,6 +2,9 @@
class Projects::Ci::LintsController < Projects::ApplicationController
before_action :authorize_create_pipeline!
+ before_action do
+ push_frontend_feature_flag(:ci_lint_vue, project)
+ end
def show
end
@@ -10,40 +13,15 @@ class Projects::Ci::LintsController < Projects::ApplicationController
@content = params[:content]
@dry_run = params[:dry_run]
- if @dry_run && Gitlab::Ci::Features.lint_creates_pipeline_with_dry_run?(@project)
- pipeline = Ci::CreatePipelineService
- .new(@project, current_user, ref: @project.default_branch)
- .execute(:push, dry_run: true, content: @content)
-
- @status = pipeline.error_messages.empty?
- @stages = pipeline.stages
- @errors = pipeline.error_messages.map(&:content)
- @warnings = pipeline.warning_messages.map(&:content)
- else
- result = Gitlab::Ci::YamlProcessor.new_with_validation_errors(@content, yaml_processor_options)
+ @result = Gitlab::Ci::Lint
+ .new(project: @project, current_user: current_user)
+ .validate(@content, dry_run: @dry_run)
- @status = result.valid?
- @errors = result.errors
- @warnings = result.warnings
-
- if result.valid?
- @config_processor = result.config
- @stages = @config_processor.stages
- @builds = @config_processor.builds
- @jobs = @config_processor.jobs
+ respond_to do |format|
+ format.html { render :show }
+ format.json do
+ render json: ::Ci::Lint::ResultSerializer.new.represent(@result)
end
end
-
- render :show
- end
-
- private
-
- def yaml_processor_options
- {
- project: @project,
- user: current_user,
- sha: project.repository.commit.sha
- }
end
end