Class: UffizziCore::Api::Cli::V1::Projects::Deployments::ContainerSerializer

Inherits:
BaseSerializer
  • Object
show all
Defined in:
app/serializers/uffizzi_core/api/cli/v1/projects/deployments/container_serializer.rb

Instance Method Summary collapse

Instance Method Details

#nameObject



10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/serializers/uffizzi_core/api/cli/v1/projects/deployments/container_serializer.rb', line 10

def name
  image_name = object.image.split('/').pop
  commit = object&.repo&.builds&.deployed&.last&.commit
  container_name = "#{image_name}:#{object.tag}"

  if !commit.nil?
    short_commit_hash = commit.slice(0..5)
    container_name = "#{container_name}@#{short_commit_hash}"
  end

  container_name
end

#secret_variablesObject



23
24
25
26
27
28
29
# File 'app/serializers/uffizzi_core/api/cli/v1/projects/deployments/container_serializer.rb', line 23

def secret_variables
  return unless object.secret_variables.present?

  object.secret_variables.map do |var|
    { name: var['name'], value: anonymize(var['value']) }
  end
end