Class: UffizziCore::RepoService

Inherits:
Object
  • Object
show all
Defined in:
app/services/uffizzi_core/repo_service.rb

Class Method Summary collapse

Class Method Details

.credential(repo) ⇒ Object



11
12
13
14
15
# File 'app/services/uffizzi_core/repo_service.rb', line 11

def credential(repo)
  container_registry_service = UffizziCore::ContainerRegistryService.init_by_subclass(repo.type)
  credentials = repo.project..credentials
  container_registry_service.credential(credentials)
end

.image(repo) ⇒ Object



22
23
24
25
26
# File 'app/services/uffizzi_core/repo_service.rb', line 22

def image(repo)
  repo_credential = credential(repo)

  "#{repo_credential.registry_url}/#{image_name(repo)}"
end

.image_name(repo) ⇒ Object



17
18
19
20
# File 'app/services/uffizzi_core/repo_service.rb', line 17

def image_name(repo)
  "e#{repo.container.deployment_id}r#{repo.id}-#{Digest::SHA256.hexdigest("#{self.class}:#{repo.branch}:
  #{repo.project_id}:#{repo.id}")[0, 10]}"
end

.needs_target_port?(repo) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
8
9
# File 'app/services/uffizzi_core/repo_service.rb', line 5

def needs_target_port?(repo)
  return false if repo.nil?

  !repo.dockerfile?
end