class KubeDeployTools::Publish

Public Class Methods

new(manifest:, artifact_registry:, output_dir:) click to toggle source
# 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

Public Instance Methods

publish() click to toggle source
# 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