Merge branch 'standalone_develop' of https://gitlink.org.cn/Trustie/forgeplus into standalone_develop
This commit is contained in:
		
						commit
						69a143417e
					
				| 
						 | 
				
			
			@ -92,7 +92,7 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController
 | 
			
		|||
    tip_exception("参数错误") if params[:owner].blank? || params[:repo].blank? || params[:run_id].blank?
 | 
			
		||||
    @project, @owner = Project.find_with_namespace(params[:owner], params[:repo])
 | 
			
		||||
    tip_exception("项目不存在") if @project.blank?
 | 
			
		||||
    result = Action::PipelineResult.find_or_initialize_by(run_id: params[:run_id],  project_id: @project.id)
 | 
			
		||||
    result = Action::PipelineResult.find_or_initialize_by(run_id: params[:run_id], step_id: params[:step_id], project_id: @project.id)
 | 
			
		||||
    result.step_id = params[:step_id]
 | 
			
		||||
    result.job_name = params[:job_name]
 | 
			
		||||
    result.job_show_type = params[:job_show_type] || "html"
 | 
			
		||||
| 
						 | 
				
			
			@ -131,6 +131,8 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController
 | 
			
		|||
      next_edge_nodes = pipeline_json["edges"].select { |edge| edge["source"]["cell"].include?(job["id"]) }
 | 
			
		||||
      node_ids = next_edge_nodes.map { |t| t["target"]["cell"] }
 | 
			
		||||
      next_step_node = pipeline_json["nodes"].select { |node| node_ids.include?(node["id"]) && !node["data"]["name"].to_s.include?("job") }&.first
 | 
			
		||||
      parent_node = pipeline_json["edges"].select { |edge| edge["target"]["cell"].include?(job["id"]) }.first
 | 
			
		||||
      node.parent_node_id = parent_node.present? ? parent_node["source"]["cell"] : ""
 | 
			
		||||
      node.sub_nodes = []
 | 
			
		||||
      get_all_child_nodes(pipeline_json, node, next_step_node) if next_step_node.present?
 | 
			
		||||
      @job_nodes.push(node)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -38,7 +38,7 @@ class Action::Node < ApplicationRecord
 | 
			
		|||
 | 
			
		||||
  belongs_to :user, optional: true
 | 
			
		||||
 | 
			
		||||
  attr_accessor :cust_name, :run_values, :input_values, :sub_nodes, :link_type_array, :node_id
 | 
			
		||||
  attr_accessor :cust_name, :run_values, :input_values, :parent_node_id, :sub_nodes, :link_type_array, :node_id
 | 
			
		||||
 | 
			
		||||
  validates :name, presence: { message: "不能为空" }
 | 
			
		||||
  validates :full_name, length: { maximum: 200, too_long: "不能超过200个字符" }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -37,12 +37,12 @@ on:
 | 
			
		|||
 | 
			
		||||
jobs:
 | 
			
		||||
<%@job_nodes.each_with_index do |job,index| %>
 | 
			
		||||
  job<%=index + 1 %>:
 | 
			
		||||
  <%=job.node_id %>:
 | 
			
		||||
    name: "<%=job.label || job.name %>[<%=job.node_id %>]"
 | 
			
		||||
    # 运行环境,这里就是上面定义的多个 os
 | 
			
		||||
    runs-on: 'ubuntu-latest'
 | 
			
		||||
    <% if index >0 %>
 | 
			
		||||
    needs: job<%=index %>
 | 
			
		||||
    needs: <%=job.parent_node_id %>
 | 
			
		||||
    <% end %>
 | 
			
		||||
    steps:
 | 
			
		||||
    <%job.sub_nodes.each do |node| %>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue