Class: UffizziCore::Controller::DeployContainers::ContainerSerializer
- Inherits:
-
BaseSerializer
- Object
- BaseSerializer
- UffizziCore::Controller::DeployContainers::ContainerSerializer
- Defined in:
- app/serializers/uffizzi_core/controller/deploy_containers/container_serializer.rb
Instance Method Summary collapse
Instance Method Details
#command ⇒ Object
53 54 55 |
# File 'app/serializers/uffizzi_core/controller/deploy_containers/container_serializer.rb', line 53 def command object.command.blank? ? nil : JSON.parse(object.command) end |
#entrypoint ⇒ Object
49 50 51 |
# File 'app/serializers/uffizzi_core/controller/deploy_containers/container_serializer.rb', line 49 def entrypoint object.entrypoint.blank? ? nil : JSON.parse(object.entrypoint) end |
#healthcheck ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'app/serializers/uffizzi_core/controller/deploy_containers/container_serializer.rb', line 57 def healthcheck return {} if object.healthcheck.nil? command = object.healthcheck['test'] new_command = if command.is_a?(Array) items_to_remove = ['CMD', 'CMD-SHELL'] command.select { |item| items_to_remove.exclude?(item) } elsif object.healthcheck['test'].is_a?(String) command.split end object.healthcheck.merge(test: new_command) end |
#image ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/serializers/uffizzi_core/controller/deploy_containers/container_serializer.rb', line 23 def image repo = object.repo credential = UffizziCore::RepoService.credential(repo) case repo.type when UffizziCore::Repo::Google.name, UffizziCore::Repo::Amazon.name, UffizziCore::Repo::Azure.name registry_host = URI.parse(credential.registry_url).host "#{registry_host}/#{object.image}" when UffizziCore::Repo::GithubContainerRegistry.name registry_host = URI.parse(credential.registry_url).host "#{registry_host}/#{repo.namespace}/#{object.image}" else object.image end end |
#tag ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'app/serializers/uffizzi_core/controller/deploy_containers/container_serializer.rb', line 40 def tag case object.repo.type when UffizziCore::Repo::Github.name UffizziCore::RepoService.tag(object.repo) else object.tag end end |