diff --git a/app/controllers/api/v1/projects/actions/runs_controller.rb b/app/controllers/api/v1/projects/actions/runs_controller.rb index 9d0cdb8b0..cdde508a1 100644 --- a/app/controllers/api/v1/projects/actions/runs_controller.rb +++ b/app/controllers/api/v1/projects/actions/runs_controller.rb @@ -1,8 +1,9 @@ class Api::V1::Projects::Actions::RunsController < Api::V1::Projects::Actions::BaseController - def index + def index @result_object = Api::V1::Projects::Actions::Runs::ListService.call(@project, {workflow: params[:workflow], page: page, limit: limit}, current_user&.gitea_token) - puts @result_object + @begin_num = (page.to_i - 1) * limit.to_i + # puts @result_object end def create diff --git a/app/views/api/v1/projects/actions/runs/index.json.jbuilder b/app/views/api/v1/projects/actions/runs/index.json.jbuilder index 9122ef9cf..e0a8aa189 100644 --- a/app/views/api/v1/projects/actions/runs/index.json.jbuilder +++ b/app/views/api/v1/projects/actions/runs/index.json.jbuilder @@ -1,6 +1,7 @@ json.total_data @result_object[:total_data].to_i if @result_object[:data]["Runs"].present? - json.runs @result_object[:data]["Runs"].each do |run| + json.runs @result_object[:data]["Runs"].each_with_index.to_a do |run, index| + json.num @result_object[:total_data].to_i - @begin_num - index json.workflow run["WorkflowID"] json.index run["Index"] json.title run["Title"] diff --git a/app/views/api/v1/projects/pipelines/build_pipeline.yaml.erb b/app/views/api/v1/projects/pipelines/build_pipeline.yaml.erb index c08455162..41908c8f5 100644 --- a/app/views/api/v1/projects/pipelines/build_pipeline.yaml.erb +++ b/app/views/api/v1/projects/pipelines/build_pipeline.yaml.erb @@ -17,23 +17,8 @@ on: - '.gitea/workflows/**' - '.github/workflows/**' <% end %> - <%if node.name.to_s.include?("on-pull_request") && node.input_values.present? %> + <%if node.name.to_s.include?("on-pull_request") %> pull_request: - types: - - opened - <% node.input_values.each_key do |key| %> - <%=key %>: - <% if node.input_values[key].blank? %> - - '*' - <% else %> - <% node.input_values[key].to_s.split(",").each do |val| %> - - <%=val %> - <% end %> - <% end %> - <% end %> - paths-ignore: - - '.gitea/workflows/**' - - '.github/workflows/**' <% end %> <%if node.name.to_s.include?("on-fork") %> fork: diff --git a/config/puma.rb.example b/config/puma.rb.example new file mode 100644 index 000000000..7e890029c --- /dev/null +++ b/config/puma.rb.example @@ -0,0 +1,47 @@ +# Puma can serve each request in a thread from an internal thread pool. +# The `threads` method setting takes two numbers: a minimum and maximum. +# Any libraries that use thread pools should be configured to match +# the maximum value specified for Puma. Default is set to 5 threads for minimum +# and maximum; this matches the default thread size of Active Record. +# +threads_count = ENV.fetch("RAILS_MAX_THREADS") { 8 } +threads threads_count, threads_count * 2 + +# Specifies the `port` that Puma will listen on to receive requests; default is 3000. +# +port ENV.fetch("PORT") { 4000 } + +# Specifies the `environment` that Puma will run in. +# +environment ENV.fetch("RAILS_ENV") { "development" } + +# Specifies the number of `workers` to boot in clustered mode. +# Workers are forked webserver processes. If using threads and workers together +# the concurrency of the application would be max `threads` * `workers`. +# Workers do not work on JRuby or Windows (both of which do not support +# processes). +# +# workers ENV.fetch("WEB_CONCURRENCY") { 8 } + +# Use the `preload_app!` method when specifying a `workers` number. +# This directive tells Puma to first boot the application and load code +# before forking the application. This takes advantage of Copy On Write +# process behavior so workers use less memory. +# +# preload_app! + + +before_fork do + require 'puma_worker_killer' + PumaWorkerKiller.config do |config| + config.ram = 2048 # mb + config.frequency = 20 # seconds + config.percent_usage = 0.98 + #config.rolling_restart_frequency = 12 * 3600 # 12 hours in seconds, or 12.hours if using Rails + end + + PumaWorkerKiller.start +end + +# Allow puma to be restarted by `rails restart` command. +plugin :tmp_restart