mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-02 19:30:48 +08:00
构建流水线
This commit is contained in:
@@ -23,20 +23,20 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController
|
||||
end
|
||||
|
||||
def build_yaml
|
||||
# pipeline = params[:pipeline]
|
||||
# @name = params[:name]
|
||||
# params_nodes = JSON.parse(pipeline)["nodes"].select { |node| !["on-push", "on-schedule"].include?(node["component_name"]) }
|
||||
# on_nodes = JSON.parse(pipeline)["nodes"].select { |node| ["on-push", "on-schedule"].include?(node["component_name"]) }
|
||||
# @on_nodes = build_nodes(on_nodes)
|
||||
# @steps_nodes = build_nodes(params_nodes)
|
||||
# yaml = ERB.new(File.read(File.join(Rails.root, "app/views/api/v1/projects/pipelines", "build_pipeline.yaml.erb"))).result(binding)
|
||||
# # 删除空行内容
|
||||
# @pipeline_yaml = yaml.gsub(/^\s*\n/, "")
|
||||
@pipeline_yaml = build_test_yaml
|
||||
if params[:pipeline].present?
|
||||
pipeline = params[:pipeline]
|
||||
@name = params[:name]
|
||||
params_nodes = JSON.parse(pipeline)["nodes"].select { |node| !["on-push", "on-schedule"].include?(node["component_name"]) }
|
||||
on_nodes = JSON.parse(pipeline)["nodes"].select { |node| ["on-push", "on-schedule"].include?(node["component_name"]) }
|
||||
@on_nodes = build_nodes(on_nodes)
|
||||
@steps_nodes = build_nodes(params_nodes)
|
||||
yaml = ERB.new(File.read(File.join(Rails.root, "app/views/api/v1/projects/pipelines", "build_pipeline.yaml.erb"))).result(binding)
|
||||
# # 删除空行内容
|
||||
@pipeline_yaml = yaml.gsub(/^\s*\n/, "")
|
||||
else
|
||||
@pipeline_yaml = build_test_yaml
|
||||
end
|
||||
render plain: @pipeline_yaml
|
||||
# respond_to do |format|
|
||||
# format.text { render yaml: @pipeline_yaml }
|
||||
# end
|
||||
end
|
||||
|
||||
def update
|
||||
|
||||
Reference in New Issue
Block a user