From 4514b8b5ff75fb0b21d7e23ae7c2e3548962bd79 Mon Sep 17 00:00:00 2001 From: xxq250 Date: Wed, 19 Mar 2025 16:51:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=81=E6=B0=B4=E7=BA=BF=E5=A3=B0=E6=98=8E?= =?UTF-8?q?=E5=BC=8F=EF=BC=8C=E5=9B=BE=E5=BD=A2=E4=BB=A3=E7=BB=9F=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/v1/projects/pipelines_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/v1/projects/pipelines_controller.rb b/app/controllers/api/v1/projects/pipelines_controller.rb index 0e0956d9e..92654bc3e 100644 --- a/app/controllers/api/v1/projects/pipelines_controller.rb +++ b/app/controllers/api/v1/projects/pipelines_controller.rb @@ -95,8 +95,8 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController @pipeline = params[:id].present? ? Action::Pipeline.find(params[:id]) : Action::Pipeline.find_or_initialize_by(pipeline_name: params[:pipeline_name], project_id: @project.id) @pipeline.file_name = ".gitea/workflows/#{@pipeline.pipeline_name}.yml" @pipeline.branch = params[:branch] || @project.default_branch - @pipeline.json = params[:pipeline_json].to_json - pipeline_yaml = build_pipeline_yaml_new(params[:pipeline_name], params[:pipeline_json]) + @pipeline.json = params[:pipeline_json].to_json if params[:pipeline_json].present? + pipeline_yaml = params[:pipeline_yaml].present? ? params[:pipeline_yaml] : build_pipeline_yaml_new(params[:pipeline_name], params[:pipeline_json]) tip_exception("流水线yaml内空不能为空") if pipeline_yaml.blank? @pipeline.yaml = pipeline_yaml Rails.logger.info "pipeline_yaml base64=========================#{Base64.encode64(@pipeline.yaml).gsub(/\n/, '')}"