forked from Trustie/forgeplus
Merge branch 'dev_osredm_server' of https://gitlink.org.cn/Trustie/forgeplus into dev_osredm_server
This commit is contained in:
commit
1a2121b511
|
|
@ -19,21 +19,23 @@ class Api::Pm::PipelinesController < Api::Pm::BaseController
|
|||
file = file_info.workflow_id
|
||||
project = Project.find_by(gpid: file_info.repo_id)
|
||||
next if project.blank?
|
||||
unless db_files.include?(".gitea/workflows/#{file}")
|
||||
pipeline = Action::Pipeline.find_or_initialize_by(pipeline_name: file.to_s.gsub(".yml", "").gsub(".yaml", ""),
|
||||
file_name: ".gitea/workflows/#{file}",
|
||||
branch: project.default_branch,
|
||||
disable: false,
|
||||
project_id: project.id)
|
||||
interactor = Repositories::EntriesInteractor.call(@owner, project.identifier, ".gitea/workflows/#{file}", ref: project.default_branch)
|
||||
if interactor.success?
|
||||
pipeline.yaml = decode64_content(interactor.result, @owner, project.repository, project.default_branch, nil)
|
||||
end
|
||||
pipeline.user_id = current_user.id
|
||||
pipeline.save
|
||||
# 导入的流水线统一先禁用
|
||||
$gitea_hat_client.post_repos_actions_disable(project&.owner&.login, project&.identifier, {query: {workflow: file}}) rescue nil
|
||||
end
|
||||
# unless db_files.include?(".gitea/workflows/#{file}")
|
||||
# pipeline = Action::Pipeline.find_or_initialize_by(pipeline_name: file.to_s.gsub(".yml", "").gsub(".yaml", ""),
|
||||
# file_name: ".gitea/workflows/#{file}",
|
||||
# branch: project.default_branch,
|
||||
# disable: false,
|
||||
# project_id: project.id)
|
||||
# interactor = Repositories::EntriesInteractor.call(@owner, project.identifier, ".gitea/workflows/#{file}", ref: project.default_branch)
|
||||
# if interactor.success?
|
||||
# pipeline.yaml = decode64_content(interactor.result, @owner, project.repository, project.default_branch, nil)
|
||||
# file = interactor.result
|
||||
# pipeline.sha = file['content']['sha']
|
||||
# end
|
||||
# pipeline.user_id = current_user.id
|
||||
# pipeline.save
|
||||
# # 导入的流水线统一先禁用
|
||||
# $gitea_hat_client.post_repos_actions_disable(project&.owner&.login, project&.identifier, {query: {workflow: file}}) rescue nil
|
||||
# end
|
||||
last_action_run = action_runs.where(repo_id: project.gpid).where(workflow_id: file).order(updated: :desc).first
|
||||
last_action_run_json = last_action_run.present? ? {
|
||||
id: last_action_run.id,
|
||||
|
|
|
|||
|
|
@ -11,22 +11,22 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController
|
|||
db_files = pipelines.pluck(:file_name)
|
||||
@run_result = []
|
||||
@files.map { |i| i['name'] }.each do |file|
|
||||
unless db_files.include?(".gitea/workflows/#{file}")
|
||||
pipeline = Action::Pipeline.find_or_initialize_by(pipeline_name: file.to_s.gsub(".yml", "").gsub(".yaml", ""),
|
||||
file_name: ".gitea/workflows/#{file}",
|
||||
branch: @project.default_branch,
|
||||
is_graphic_design: false,
|
||||
disable: false,
|
||||
project_id: @project.id)
|
||||
interactor = Repositories::EntriesInteractor.call(@owner, @project.identifier, ".gitea/workflows/#{file}", ref: @project.default_branch)
|
||||
if interactor.success?
|
||||
pipeline.yaml = decode64_content(interactor.result, @owner, @project.repository, @project.default_branch, nil)
|
||||
end
|
||||
pipeline.user_id = current_user.id
|
||||
pipeline.save
|
||||
# 导入的流水线统一先禁用
|
||||
$gitea_hat_client.post_repos_actions_disable(@project&.owner&.login, @project&.identifier, {query: {workflow: file}}) rescue nil
|
||||
end
|
||||
# unless db_files.include?(".gitea/workflows/#{file}")
|
||||
# pipeline = Action::Pipeline.find_or_initialize_by(pipeline_name: file.to_s.gsub(".yml", "").gsub(".yaml", ""),
|
||||
# file_name: ".gitea/workflows/#{file}",
|
||||
# branch: @project.default_branch,
|
||||
# is_graphic_design: false,
|
||||
# disable: false,
|
||||
# project_id: @project.id)
|
||||
# interactor = Repositories::EntriesInteractor.call(@owner, @project.identifier, ".gitea/workflows/#{file}", ref: @project.default_branch)
|
||||
# if interactor.success?
|
||||
# pipeline.yaml = decode64_content(interactor.result, @owner, @project.repository, @project.default_branch, nil)
|
||||
# end
|
||||
# pipeline.user_id = current_user.id
|
||||
# pipeline.save
|
||||
# # 导入的流水线统一先禁用
|
||||
# $gitea_hat_client.post_repos_actions_disable(@project&.owner&.login, @project&.identifier, {query: {workflow: file}}) rescue nil
|
||||
# end
|
||||
last_action_run = @action_runs.where(workflow_id: file).order(updated: :desc).first
|
||||
last_action_run_json = last_action_run.present? ? {
|
||||
id: last_action_run.id,
|
||||
|
|
@ -80,7 +80,14 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController
|
|||
tip_exception("已经存在#{params[:pipeline_name]}流水线!") if has_pipeline.present?
|
||||
if @pipeline.yaml.present?
|
||||
sha = get_pipeline_file_sha(@pipeline.file_name, @pipeline.branch)
|
||||
if sha.present?
|
||||
new_file_sha = get_pipeline_file_sha(".gitea/workflows/#{params[:pipeline_name]}.yml", @pipeline.branch)
|
||||
# 重命名的新文件存在时,直接修改新文件new_file_sha, 同时删除老文件
|
||||
if sha.present? && new_file_sha.present?
|
||||
interactor = Gitea::UpdateFileInteractor.call(current_user.gitea_token, @owner.login, content_params("update", params[:pipeline_name]).merge(sha: new_file_sha, from_path: ".gitea/workflows/#{params[:pipeline_name]}.yml"))
|
||||
tip_exception(interactor.error) unless interactor.success?
|
||||
del_interactor = Gitea::DeleteFileInteractor.call(current_user.gitea_token, @owner.login, del_content_params(sha).merge(identifier: @project.identifier))
|
||||
tip_exception(del_interactor.error) unless del_interactor.success?
|
||||
elsif sha.present? && new_file_sha.blank?
|
||||
interactor = Gitea::UpdateFileInteractor.call(current_user.gitea_token, @owner.login, content_params("update", params[:pipeline_name]).merge(sha: sha, from_path: ".gitea/workflows/#{@pipeline.pipeline_name}.yml"))
|
||||
tip_exception(interactor.error) unless interactor.success?
|
||||
end
|
||||
|
|
@ -116,6 +123,7 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController
|
|||
file = interactor.result
|
||||
@pipeline.user_id = current_user.id if @pipeline.user_id.blank?
|
||||
@pipeline.pipeline_type = @pipeline.json.present? ? 2 : 1
|
||||
@pipeline.sha = sha.present? ? sha : file['content']['sha']
|
||||
@pipeline.save
|
||||
render_ok({ pipeline_yaml: pipeline_yaml, pipeline_name: @pipeline.pipeline_name, file_name: @pipeline.file_name, sha: sha.present? ? sha : file['content']['sha'] })
|
||||
end
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ json.gitlink_branch_name @branch&.gitlink_branch_name
|
|||
json.external_type @branch&.sync_repository&.type
|
||||
json.external_branch_name @branch&.external_branch_name
|
||||
json.logs @reposync_branch_logs.each do |log|
|
||||
type = log['repo_name'].start_with?('gitee') ? 'gitee' : 'github'
|
||||
json.change_from log['sync_direct'] == "to_inter" ? type : 'gitlink'
|
||||
type = log['repo_name'].start_with?('gitee') ? 'gitee' : log['repo_name'].start_with?('github') ? 'github' : 'gitlink'
|
||||
json.change_from log['sync_direct'] == "to_inter" ? type : 'osredm'
|
||||
json.commit_id log['commit_id']
|
||||
json.sync_time log['update_at']
|
||||
json.log log['log']
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
|
@ -1,118 +0,0 @@
|
|||
@charset "UTF-8";
|
||||
/* line 1, app/assets/stylesheets/oauth.scss */
|
||||
html {
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
font-size: 14px;
|
||||
font-family: "微软雅黑","宋体";
|
||||
}
|
||||
|
||||
/* line 2, app/assets/stylesheets/oauth.scss */
|
||||
body, h1, h2, h3, h4, h5, h6, hr, p, blockquote, dl, dt, dd, ul, ol, li, pre, form, fieldset, legend, button, input, textarea, th, td {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* line 6, app/assets/stylesheets/oauth.scss */
|
||||
.IndexContent {
|
||||
height: 100vh;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
background-image: url("/images/oauth/backImg.png");
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
display: -webkit-box;
|
||||
display: flex;
|
||||
-webkit-box-align: center;
|
||||
align-items: center;
|
||||
-webkit-box-pack: center;
|
||||
justify-content: center;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-box-direction: normal;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
/* line 18, app/assets/stylesheets/oauth.scss */
|
||||
.indexLogo {
|
||||
width: 80px;
|
||||
margin-bottom: 35px;
|
||||
}
|
||||
|
||||
/* line 22, app/assets/stylesheets/oauth.scss */
|
||||
.indexPanel {
|
||||
width: 580px;
|
||||
min-height: 400px;
|
||||
background-color: #fff;
|
||||
box-shadow: 0px 2px 10px 5px rgba(0, 0, 0, 0.05);
|
||||
border-radius: 5px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* line 30, app/assets/stylesheets/oauth.scss */
|
||||
.indexTitle {
|
||||
height: 75px;
|
||||
line-height: 75px;
|
||||
font-size: 18px;
|
||||
color: #333;
|
||||
text-align: center;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
/* line 38, app/assets/stylesheets/oauth.scss */
|
||||
.indexInfo {
|
||||
display: -webkit-box;
|
||||
display: flex;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-box-direction: normal;
|
||||
flex-direction: column;
|
||||
-webkit-box-align: start;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
/* line 43, app/assets/stylesheets/oauth.scss */
|
||||
.indexInfos {
|
||||
padding: 40px 60px;
|
||||
}
|
||||
|
||||
/* line 46, app/assets/stylesheets/oauth.scss */
|
||||
.indexInfo > span {
|
||||
color: #333;
|
||||
font-size: 16px;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
/* line 51, app/assets/stylesheets/oauth.scss */
|
||||
.indexInfo input {
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
border-radius: 2px;
|
||||
border: 1px solid #eee;
|
||||
margin-top: 5px;
|
||||
padding: 0px 0px 0px 8px;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
/* line 60, app/assets/stylesheets/oauth.scss */
|
||||
.indexInfo .checkInfo {
|
||||
height: 15px;
|
||||
color: red;
|
||||
}
|
||||
|
||||
/* line 64, app/assets/stylesheets/oauth.scss */
|
||||
.indexBtn {
|
||||
text-align: center;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
/* line 68, app/assets/stylesheets/oauth.scss */
|
||||
.indexSubmit {
|
||||
width: 50%;
|
||||
height: 32px;
|
||||
line-height: 32px;
|
||||
background-color: #1890FF;
|
||||
border: none;
|
||||
color: #fff;
|
||||
border-radius: 2px;
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
}
|
||||
Binary file not shown.
Loading…
Reference in New Issue