Browse Source

Merge branch 'standalone_develop' of https://gitlink.org.cn/Trustie/forgeplus into standalone_develop

pull/347/head
yystopf 1 year ago
parent
commit
56b277d37b
4 changed files with 53 additions and 19 deletions
  1. +3
    -2
      app/controllers/api/v1/projects/actions/runs_controller.rb
  2. +2
    -1
      app/views/api/v1/projects/actions/runs/index.json.jbuilder
  3. +1
    -16
      app/views/api/v1/projects/pipelines/build_pipeline.yaml.erb
  4. +47
    -0
      config/puma.rb.example

+ 3
- 2
app/controllers/api/v1/projects/actions/runs_controller.rb View File

@@ -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


+ 2
- 1
app/views/api/v1/projects/actions/runs/index.json.jbuilder View File

@@ -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"]


+ 1
- 16
app/views/api/v1/projects/pipelines/build_pipeline.yaml.erb View File

@@ -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:


+ 47
- 0
config/puma.rb.example View File

@@ -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

Loading…
Cancel
Save