FIX 重构ci流程

This commit is contained in:
Jasder
2020-08-20 18:37:53 +08:00
parent 89b2e263ae
commit 7c1ab2cddf
34 changed files with 207 additions and 54 deletions

19
app/models/ci/repo.rb Normal file
View File

@@ -0,0 +1,19 @@
class Ci::Repo < Ci::RemoteBase
self.primary_key = 'repo_id'
belongs_to :user, foreign_key: :repo_user_id
has_many :builds, foreign_key: "build_repo_id", dependent: :destroy
def self.find_with_namespace(namespace_path, identifier)
logger.info "########namespace_path: #{namespace_path} ########identifier: #{identifier} "
user = Ci::User.find_by_user_login namespace_path
return nil if user.blank?
repo = user.repos.find_by(repo_name: identifier)
return nil if repo.blank?
[user, repo]
end
end