fixed 图形化流水线构建

This commit is contained in:
2024-05-16 09:42:48 +08:00
parent ddf754485a
commit ddaa6f7aec
12 changed files with 795 additions and 33 deletions

View File

@@ -19,6 +19,7 @@
#
# Indexes
#
# by_name (name)
# index_action_nodes_on_action_types_id (action_node_types_id)
# index_action_nodes_on_user_id (user_id)
#
@@ -33,39 +34,31 @@ class Action::Node < ApplicationRecord
belongs_to :user, optional: true
attr_accessor :cust_name, :input_values
# def content_yaml
# "foo".to_yaml
# <<~YAML
# - name: Set up JDK ${{ matrix.java }}
# uses: actions/setup-java@v3
# with:
# distribution: 'temurin'
# java-version: ${{ matrix.java }}
# YAML
# end
def yaml_hash
def content_yaml
"foo".to_yaml
<<~YAML
name: Check dist
on:
push:
branches:
- main
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
workflow_dispatch:
jobs:
call-check-dist:
name: Check dist/
uses: actions/reusable-workflows/.github/workflows/check-dist.yml@main
with:
node-version: '20.x'
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
YAML
end
def node
self
end
def build_yaml
yaml = ERB.new(File.read(File.join(Rails.root, "app/views/api/v1/projects/pipelines", "build_node.yaml.erb"))).result(binding)
# 删除空行内容
yaml = yaml.gsub(/^\s*\n/, "")
# Rails.logger.info "========================="
# Rails.logger.info yaml
yaml
end
end

View File

@@ -0,0 +1,37 @@
# == Schema Information
#
# Table name: action_pipelines
#
# id :integer not null, primary key
# project_id :integer
# user_id :integer
# pipeline_name :string(255)
# pipeline_status :string(255)
# description :string(255)
# file_name :string(255)
# is_graphic_design :boolean default("0")
# repo_name :string(255)
# repo_identifier :string(255)
# repo_owner :string(255)
# branch :string(255)
# event :string(255)
# sha :string(255)
# json :text(65535)
# yaml :text(65535)
# disable :boolean default("0")
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_action_pipelines_on_project_id (project_id)
# index_action_pipelines_on_user_id (user_id)
#
class Action::Pipeline < ApplicationRecord
self.table_name = 'action_pipelines'
belongs_to :user, optional: true
belongs_to :project
end