同步工厂优化过的流水线代码,语法暂不验证

This commit is contained in:
xxq250 2026-05-26 17:15:40 +08:00
parent 20ba9d9ac7
commit 2c7d76b682
2 changed files with 11 additions and 11 deletions

View File

@ -115,10 +115,10 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController
@pipeline.pipeline_name = params[:pipeline_name] if params[:pipeline_name].present?
pipeline_yaml = params[:pipeline_yaml].present? ? params[:pipeline_yaml] : build_pipeline_yaml_new(@pipeline.pipeline_name, params[:pipeline_json])
tip_exception("流水线yaml内空不能为空") if pipeline_yaml.blank?
result = validate_string(pipeline_yaml, @pipeline.branch, @project.default_branch)
unless result[:valid]
tip_exception(result[:errors].join(","))
end
# result = validate_string(pipeline_yaml, @pipeline.branch, @project.default_branch)
# unless result[:valid]
# tip_exception(result[:errors].join(","))
# end
@pipeline.yaml = pipeline_yaml
#Rails.logger.info "pipeline_yaml base64=========================#{Base64.encode64(@pipeline.yaml).gsub(/\n/, '')}"
sha = get_pipeline_file_sha(@pipeline.file_name, @pipeline.branch)

View File

@ -74,13 +74,13 @@ module Api::ActionValidatorHelper
Rails.logger.info "data==true#{data[true]}"
if data[true]
if data[true]['push']
unless data[true]['push'].key?('branches')
errors << "push触发器缺少branches配置"
end
unless data[true]['push'].key?('paths-ignore')
errors << "push触发器缺少paths-ignore配置"
end
# unless data[true]['push'].key?('branches')
# errors << "push触发器缺少branches配置"
# end
#
# unless data[true]['push'].key?('paths-ignore')
# errors << "push触发器缺少paths-ignore配置"
# end
end
if data[true]['schedule'] && branch != default_branch
errors << "只有#{default_branch}分支支持定时触发器"