fixed 图形化流水线增加分支流程-启动节点数据变更
This commit is contained in:
parent
a5e6594a37
commit
d87fe501c4
|
@ -92,24 +92,6 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController
|
||||||
@pipeline = Action::Pipeline.new(id: 0, pipeline_name: "test-ss", yaml: build_test_yaml) if @pipeline.blank?
|
@pipeline = Action::Pipeline.new(id: 0, pipeline_name: "test-ss", yaml: build_test_yaml) if @pipeline.blank?
|
||||||
end
|
end
|
||||||
|
|
||||||
def build_pipeline_yaml(pipeline_name, pipeline_json)
|
|
||||||
if pipeline_json.present? && pipeline_json.present?
|
|
||||||
@pipeline_name = pipeline_name
|
|
||||||
params_nodes = pipeline_json["nodes"].select { |node| !["on-push", "on-schedule", "on-pull_request", "on-fork"].include?(node["name"]) }
|
|
||||||
on_nodes = pipeline_json["nodes"].select { |node| ["on-push", "on-schedule", "on-pull_request", "on-fork"].include?(node["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 = params[:pipeline_yaml]
|
|
||||||
end
|
|
||||||
Rails.logger.info "pipeline_yaml========================="
|
|
||||||
Rails.logger.info pipeline_yaml
|
|
||||||
pipeline_yaml
|
|
||||||
end
|
|
||||||
|
|
||||||
def build_pipeline_yaml_new(pipeline_name, pipeline_json)
|
def build_pipeline_yaml_new(pipeline_name, pipeline_json)
|
||||||
@pipeline_name = pipeline_name
|
@pipeline_name = pipeline_name
|
||||||
job_nodes = pipeline_json["nodes"].select { |node| node["data"]["name"].to_s.include?("job") }
|
job_nodes = pipeline_json["nodes"].select { |node| node["data"]["name"].to_s.include?("job") }
|
||||||
|
@ -170,8 +152,8 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController
|
||||||
node.label = input_node["data"]["label"] if input_node["data"]["label"].present?
|
node.label = input_node["data"]["label"] if input_node["data"]["label"].present?
|
||||||
run_values = {}
|
run_values = {}
|
||||||
input_values = {}
|
input_values = {}
|
||||||
if input_node["inputs"].present?
|
if input_node["data"]["inputs"].present?
|
||||||
input_node["inputs"].each do |input|
|
input_node["data"]["inputs"].each do |input|
|
||||||
if input["name"].to_s.gsub("--", "") == "run"
|
if input["name"].to_s.gsub("--", "") == "run"
|
||||||
run_values = run_values.merge({ "#{input["name"].gsub("--", "")}": "#{input["value"]}" })
|
run_values = run_values.merge({ "#{input["name"].gsub("--", "")}": "#{input["value"]}" })
|
||||||
else
|
else
|
||||||
|
@ -331,7 +313,8 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController
|
||||||
"name": "branches",
|
"name": "branches",
|
||||||
"input_type": "input",
|
"input_type": "input",
|
||||||
"description": "分支名称,多个分支英文逗号隔开,如'master,dev'",
|
"description": "分支名称,多个分支英文逗号隔开,如'master,dev'",
|
||||||
"is_required": true
|
"is_required": true,
|
||||||
|
"value": "master"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 7,
|
"id": 7,
|
||||||
|
|
Loading…
Reference in New Issue