fixed 组织流水线中多仓库按文件查询
This commit is contained in:
parent
44396e444b
commit
d3bc799263
|
@ -16,9 +16,11 @@ class Api::Pm::PipelinesController < Api::Pm::BaseController
|
||||||
db_files = pipelines.pluck(:file_name)
|
db_files = pipelines.pluck(:file_name)
|
||||||
@run_result = []
|
@run_result = []
|
||||||
run_files.each do |file_info|
|
run_files.each do |file_info|
|
||||||
file = file_info.workflow_id
|
# file = file_info.workflow_id
|
||||||
project = Project.find_by(gpid: file_info.repo_id)
|
project = Project.find_by(gpid: file_info.repo_id)
|
||||||
next if project.blank?
|
next if project.blank?
|
||||||
|
files = $gitea_client.get_repos_contents_by_owner_repo_filepath(project&.owner&.login, project&.identifier, ".gitea/workflows") rescue []
|
||||||
|
files.map { |i| i['name'] }.each do |file|
|
||||||
unless db_files.include?(".gitea/workflows/#{file}")
|
unless db_files.include?(".gitea/workflows/#{file}")
|
||||||
pipeline = Action::Pipeline.find_or_initialize_by(pipeline_name: file.to_s.gsub(".yml", "").gsub(".yaml", ""),
|
pipeline = Action::Pipeline.find_or_initialize_by(pipeline_name: file.to_s.gsub(".yml", "").gsub(".yaml", ""),
|
||||||
file_name: ".gitea/workflows/#{file}",
|
file_name: ".gitea/workflows/#{file}",
|
||||||
|
@ -65,7 +67,8 @@ class Api::Pm::PipelinesController < Api::Pm::BaseController
|
||||||
failure: failure
|
failure: failure
|
||||||
}.merge(last_action_run_json)
|
}.merge(last_action_run_json)
|
||||||
end
|
end
|
||||||
Rails.logger.info("@run_result======#{@run_result}")
|
end
|
||||||
|
# Rails.logger.info("@run_result======#{@run_result}")
|
||||||
@disabled_workflows = Gitea::RepoUnit.where(repo_id: project_gpids, type: 10).where("config is not null")
|
@disabled_workflows = Gitea::RepoUnit.where(repo_id: project_gpids, type: 10).where("config is not null")
|
||||||
@pipelines = Action::Pipeline.where(project_id: @project_ids).order(updated_at: :desc)
|
@pipelines = Action::Pipeline.where(project_id: @project_ids).order(updated_at: :desc)
|
||||||
@pipelines = @pipelines.where("pipeline_name like ?", "%#{params[:pipeline_name]}%") if params[:pipeline_name].present?
|
@pipelines = @pipelines.where("pipeline_name like ?", "%#{params[:pipeline_name]}%") if params[:pipeline_name].present?
|
||||||
|
|
|
@ -55,7 +55,7 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController
|
||||||
failure: failure
|
failure: failure
|
||||||
}.merge(last_action_run_json)
|
}.merge(last_action_run_json)
|
||||||
end
|
end
|
||||||
Rails.logger.info("@run_result======#{@run_result}")
|
# Rails.logger.info("@run_result======#{@run_result}")
|
||||||
disabled_config = Gitea::RepoUnit.where(repo_id: @project.gpid, type: 10)&.first&.config
|
disabled_config = Gitea::RepoUnit.where(repo_id: @project.gpid, type: 10)&.first&.config
|
||||||
@disabled_workflows = disabled_config.present? ? JSON.parse(disabled_config)["DisabledWorkflows"] : []
|
@disabled_workflows = disabled_config.present? ? JSON.parse(disabled_config)["DisabledWorkflows"] : []
|
||||||
@pipelines = Action::Pipeline.where(project_id: @project.id).order(updated_at: :desc)
|
@pipelines = Action::Pipeline.where(project_id: @project.id).order(updated_at: :desc)
|
||||||
|
|
Loading…
Reference in New Issue