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:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-05-09 19:59:45 +0300
committerKamil Trzcinski <ayufan@ayufan.eu>2016-05-09 19:59:45 +0300
commitbaef6728fa4e8e515ccdeba1ea54da996f322aab (patch)
tree22f664f6beace93bc7d27458a9d4469703d03d60 /app/controllers/projects/builds_controller.rb
parent44501820152083d231459223fe09b9d9641b7c1e (diff)
Send trace to a browser incrementally when build is running
We send a state of ansi2html to client, client needs to send this state back. The state describes the configuration of generator and position within trace.
Diffstat (limited to 'app/controllers/projects/builds_controller.rb')
-rw-r--r--app/controllers/projects/builds_controller.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/app/controllers/projects/builds_controller.rb b/app/controllers/projects/builds_controller.rb
index b8b9e78427d..3c9a52a5ddd 100644
--- a/app/controllers/projects/builds_controller.rb
+++ b/app/controllers/projects/builds_controller.rb
@@ -38,6 +38,14 @@ class Projects::BuildsController < Projects::ApplicationController
end
end
+ def trace
+ respond_to do |format|
+ format.json do
+ render json: @build.trace_with_state(params_state).merge!(id: @build.id, status: @build.status)
+ end
+ end
+ end
+
def retry
unless @build.retryable?
return render_404
@@ -72,6 +80,13 @@ class Projects::BuildsController < Projects::ApplicationController
private
+ def params_state
+ begin
+ JSON.parse(params[:state], symbolize_names: true)
+ rescue
+ end
+ end
+
def build
@build ||= project.builds.unscoped.find_by!(id: params[:id])
end