Browse Source

流水线pipeline_type

pull/347/head
xxq250 1 year ago
parent
commit
ec13987023
5 changed files with 9 additions and 9 deletions
  1. +1
    -0
      app/controllers/api/v1/projects/pipelines_controller.rb
  2. +0
    -4
      app/models/action/pipeline.rb
  3. +2
    -3
      app/views/api/v1/projects/pipelines/create.json.jbuilder
  4. +1
    -2
      app/views/api/v1/projects/pipelines/show.json.jbuilder
  5. +5
    -0
      db/migrate/202503180515147_add_pipelines_type.rb

+ 1
- 0
app/controllers/api/v1/projects/pipelines_controller.rb View File

@@ -87,6 +87,7 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController
@pipeline.file_name = ".gitea/workflows/#{@pipeline.pipeline_name}.yml"
@pipeline.branch = params[:branch] || @project.default_branch
@pipeline.is_graphic_design = params[:pipeline_type] == 2 ? true : false
@pipeline.pipeline_type = params[:pipeline_type] if params[:pipeline_type].present?
@pipeline.save!
end



+ 0
- 4
app/models/action/pipeline.rb View File

@@ -36,8 +36,4 @@ class Action::Pipeline < ApplicationRecord
validates :pipeline_name, presence: { message: "不能为空" }
validates :json, length: { maximum: 65535, too_long: "不能超过65535个字符"}
validates :yaml, length: { maximum: 65535, too_long: "不能超过65535个字符"}

def pipeline_type
self.is_graphic_design? ? 2 : 1
end
end

+ 2
- 3
app/views/api/v1/projects/pipelines/create.json.jbuilder View File

@@ -1,5 +1,4 @@
json.status 0
json.message "success"
json.extract! @pipeline, :id, :pipeline_name, :pipeline_status, :description, :file_name, :is_graphic_design,
:repo_name, :repo_identifier, :branch, :event, :sha, :disable, :json, :yaml, :created_at, :updated_at
# json.project
json.extract! @pipeline, :id, :pipeline_name, :pipeline_status, :description, :file_name, :is_graphic_design, :pipeline_type,
:repo_name, :repo_identifier, :branch, :event, :sha, :disable, :json, :yaml, :created_at, :updated_at

+ 1
- 2
app/views/api/v1/projects/pipelines/show.json.jbuilder View File

@@ -1,5 +1,4 @@
json.status 0
json.message "success"
json.extract! @pipeline, :id, :pipeline_name, :pipeline_status, :description, :file_name, :is_graphic_design,
json.extract! @pipeline, :id, :pipeline_name, :pipeline_status, :description, :file_name, :is_graphic_design, :pipeline_type,
:repo_name, :repo_identifier, :branch, :event, :sha, :disable, :json, :yaml, :created_at, :updated_at
# json.project

+ 5
- 0
db/migrate/202503180515147_add_pipelines_type.rb View File

@@ -0,0 +1,5 @@
class AddPipelinesType < ActiveRecord::Migration[5.2]
def change
add_column :action_pipelines, :pipeline_type, :integer, :default => 1
end
end

Loading…
Cancel
Save