mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-16 09:45:57 +08:00
ADD devops builds's api
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
class DevOps::BuildsController < ApplicationController
|
||||
class ::DevOps::BuildsController < ApplicationController
|
||||
before_action :require_login
|
||||
before_action :find_project
|
||||
before_action :find_repo
|
||||
|
||||
def index
|
||||
cloud_account = @repo.dev_ops_cloud_account
|
||||
@@ -37,7 +37,7 @@ class DevOps::BuildsController < ApplicationController
|
||||
end
|
||||
|
||||
private
|
||||
def find_project
|
||||
@repo = Repository.find params[:id]
|
||||
def find_repo
|
||||
@repo = ::Repository.find params[:id]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -14,12 +14,12 @@ class DevOps::CloudAccountsController < ApplicationController
|
||||
logger.info "######### create_params: #{create_params}"
|
||||
|
||||
|
||||
if cloud_account = @project.dev_ops_cloud_account
|
||||
if cloud_account = @repo.dev_ops_cloud_account
|
||||
cloud_account
|
||||
else
|
||||
cloud_account = DevOps::CloudAccount.new(create_params)
|
||||
cloud_account.user = current_user
|
||||
cloud_account.project_id = @project.id
|
||||
cloud_account.repo_id = @repo.id
|
||||
cloud_account.save!
|
||||
end
|
||||
|
||||
@@ -64,11 +64,10 @@ class DevOps::CloudAccountsController < ApplicationController
|
||||
|
||||
private
|
||||
def devops_params
|
||||
params.permit(:account, :secret, :ip_num, :project_id)
|
||||
params.permit(:account, :secret, :ip_num, :repo_id)
|
||||
end
|
||||
|
||||
def find_project
|
||||
@project = Project.find_by_id params[:project_id]
|
||||
render_not_found("未找到project_id为:#{params[:project_id]}相关的项目") if @project.blank?
|
||||
@repo = Repository.find params[:repo_id]
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user