Commit f09fc5cc authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch 'return-bad-request-for-invalid-yaml-pipeline' into 'master'

Return Bad Request from Pipelines Controller for Invalid Ci Yaml

Closes #210238

See merge request gitlab-org/gitlab!27142
parents 538d893b f9004813
...@@ -60,10 +60,10 @@ class Projects::PipelinesController < Projects::ApplicationController ...@@ -60,10 +60,10 @@ class Projects::PipelinesController < Projects::ApplicationController
.new(project, current_user, create_params) .new(project, current_user, create_params)
.execute(:web, ignore_skip_ci: true, save_on_errors: false) .execute(:web, ignore_skip_ci: true, save_on_errors: false)
if @pipeline.persisted? if @pipeline.created_successfully?
redirect_to project_pipeline_path(project, @pipeline) redirect_to project_pipeline_path(project, @pipeline)
else else
render 'new' render 'new', status: :bad_request
end end
end end
......
...@@ -634,7 +634,8 @@ describe Projects::PipelinesController do ...@@ -634,7 +634,8 @@ describe Projects::PipelinesController do
it 'does not persist a pipeline' do it 'does not persist a pipeline' do
expect { post_request }.not_to change { project.ci_pipelines.count } expect { post_request }.not_to change { project.ci_pipelines.count }
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:bad_request)
expect(response).to render_template('new')
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment