diff --git a/app/controllers/api/v1/projects/pipelines_controller.rb b/app/controllers/api/v1/projects/pipelines_controller.rb index e080fdcdc..66830d13c 100644 --- a/app/controllers/api/v1/projects/pipelines_controller.rb +++ b/app/controllers/api/v1/projects/pipelines_controller.rb @@ -115,7 +115,6 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController job_nodes = pipeline_json["nodes"].select { |node| node["data"]["name"].to_s.include?("job") } on_nodes = pipeline_json["nodes"].select { |node| ["on-push", "on-schedule", "on-pull_request", "on-fork"].include?(node["data"]["name"]) } @on_nodes = build_nodes(on_nodes) - Rails.logger.info "111=========================#{@on_nodes}" @job_nodes = [] job_nodes.each do |job| node = Action::Node.find_by(name: job["data"]["name"]) @@ -128,7 +127,6 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController get_all_child_nodes(node, next_step_node) if next_step_node.present? @job_nodes.push(node) end - Rails.logger.info "222=========================#{@job_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/, "") Rails.logger.info "=========================" 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 aa170b071..ffd8ddf00 100644 --- a/app/views/api/v1/projects/pipelines/build_pipeline.yaml.erb +++ b/app/views/api/v1/projects/pipelines/build_pipeline.yaml.erb @@ -1,7 +1,7 @@ name: "<%=@pipeline_name %>" on: <%@on_nodes.each do |node| %> - <%if node.name.to_s.include?("on-push") %> + <%if node.name.to_s.include?("on-push") && node.input_values.present? %> push: <% node.input_values.each_key do |key| %> <%=key %>: @@ -14,7 +14,7 @@ on: <% end %> <% end %> <% end %> - <%if node.name.to_s.include?("on-pull_request") %> + <%if node.name.to_s.include?("on-pull_request") && node.input_values.present? %> pull_request: <% node.input_values.each_key do |key| %> <%=key %>: @@ -27,7 +27,7 @@ on: <% end %> <% end %> <% end %> - <%if node.name.to_s.include?("on-schedule") %> + <%if node.name.to_s.include?("on-schedule") && node.input_values.present? %> schedule: <% node.input_values.each_key do |key| %> - <%=key %>: "<%=node.input_values[key] %>"