Class: KubeDeployTools::Publish

Inherits:
Object
  • Object
show all
Defined in:
lib/kube_deploy_tools/publish.rb

Defined Under Namespace

Classes: Optparser

Instance Method Summary collapse

Constructor Details

#initialize(manifest:, artifact_registry:, output_dir:) ⇒ Publish

Returns a new instance of Publish.



11
12
13
14
15
16
17
18
19
# File 'lib/kube_deploy_tools/publish.rb', line 11

def initialize(manifest:, artifact_registry:, output_dir:)
  @config = DeployConfigFile.new(manifest)
  @output_dir = output_dir

  @project = KubeDeployTools::PROJECT
  @build_number = KubeDeployTools::BUILD_NUMBER

  @artifact_registry = artifact_registry.driver
end

Instance Method Details

#publishObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/kube_deploy_tools/publish.rb', line 21

def publish()
  @config.artifacts.each do |c|
    name = c.fetch('name')

    # Allow deploy.yaml to gate certain flavors to certain targets.
    cluster_flavors = @config.flavors.select { |key, value| c['flavors'].nil? || c['flavors'].include?(key) }

    cluster_flavors.each do |flavor, _|
      @artifact_registry.upload(
        local_dir: @output_dir,
        name: name,
        flavor: flavor,
        project: @project,
        build_number: @build_number,
      )
    end
  end
end