Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-09-19 04:45:44 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-09-19 04:45:44 +0300
commit85dc423f7090da0a52c73eb66faf22ddb20efff9 (patch)
tree9160f299afd8c80c038f08e1545be119f5e3f1e1 /app/controllers/projects/pipelines_controller.rb
parent15c2c8c66dbe422588e5411eee7e68f1fa440bb8 (diff)
Add latest changes from gitlab-org/gitlab@13-4-stable-ee
Diffstat (limited to 'app/controllers/projects/pipelines_controller.rb')
-rw-r--r--app/controllers/projects/pipelines_controller.rb27
1 files changed, 22 insertions, 5 deletions
diff --git a/app/controllers/projects/pipelines_controller.rb b/app/controllers/projects/pipelines_controller.rb
index bfe23eb1035..c1734d2cd8a 100644
--- a/app/controllers/projects/pipelines_controller.rb
+++ b/app/controllers/projects/pipelines_controller.rb
@@ -63,10 +63,27 @@ class Projects::PipelinesController < Projects::ApplicationController
.new(project, current_user, create_params)
.execute(:web, ignore_skip_ci: true, save_on_errors: false)
- if @pipeline.created_successfully?
- redirect_to project_pipeline_path(project, @pipeline)
- else
- render 'new', status: :bad_request
+ respond_to do |format|
+ format.html do
+ if @pipeline.created_successfully?
+ redirect_to project_pipeline_path(project, @pipeline)
+ else
+ render 'new', status: :bad_request
+ end
+ end
+ format.json do
+ if @pipeline.created_successfully?
+ render json: PipelineSerializer
+ .new(project: project, current_user: current_user)
+ .represent(@pipeline),
+ status: :created
+ else
+ render json: { errors: @pipeline.error_messages.map(&:content),
+ warnings: @pipeline.warning_messages(limit: ::Gitlab::Ci::Warnings::MAX_LIMIT).map(&:content),
+ total_warnings: @pipeline.warning_messages.length },
+ status: :bad_request
+ end
+ end
end
end
@@ -247,7 +264,7 @@ class Projects::PipelinesController < Projects::ApplicationController
end
def latest_pipeline
- @project.latest_pipeline_for_ref(params['ref'])
+ @project.latest_pipeline(params['ref'])
&.present(current_user: current_user)
end