diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 21:42:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 21:42:06 +0300 |
commit | 6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch) | |
tree | 78be5963ec075d80116a932011d695dd33910b4e /app/controllers/projects/ci/lints_controller.rb | |
parent | 1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff) |
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'app/controllers/projects/ci/lints_controller.rb')
-rw-r--r-- | app/controllers/projects/ci/lints_controller.rb | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/app/controllers/projects/ci/lints_controller.rb b/app/controllers/projects/ci/lints_controller.rb index 73b3eb9c205..c13baaea8c6 100644 --- a/app/controllers/projects/ci/lints_controller.rb +++ b/app/controllers/projects/ci/lints_controller.rb @@ -8,16 +8,30 @@ class Projects::Ci::LintsController < Projects::ApplicationController def create @content = params[:content] - result = Gitlab::Ci::YamlProcessor.new_with_validation_errors(@content, yaml_processor_options) - - @status = result.valid? - @errors = result.errors - - if result.valid? - @config_processor = result.config - @stages = @config_processor.stages - @builds = @config_processor.builds - @jobs = @config_processor.jobs + @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) + + @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 + end end render :show |