Sha256: a26877b23910c9f472a1af6805960691328ade45ff31ca0afdd44f285f94e3de

Contents?: true

Size: 779 Bytes

Versions: 2

Compression:

Stored size: 779 Bytes

Contents

# frozen_string_literal: true

module Command
  class DeployImage < Base
    NAME = "deploy-image"
    OPTIONS = [
      app_option(required: true)
    ].freeze
    DESCRIPTION = "Deploys the latest image to app workloads"
    LONG_DESCRIPTION = <<~HEREDOC
      - Deploys the latest image to app workloads
    HEREDOC

    def call
      image = latest_image

      config[:app_workloads].each do |workload|
        cp.fetch_workload!(workload).dig("spec", "containers").each do |container|
          next unless container["image"].match?(%r{^/org/#{config[:cpln_org]}/image/#{config.app}:})

          cp.workload_set_image_ref(workload, container: container["name"], image: image)
          progress.puts "updated #{container['name']}"
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cpl-0.4.1 lib/command/deploy_image.rb
cpl-0.4.0 lib/command/deploy_image.rb