Sha256: 145558b86c2f940e25c2e8d5d31a3af1f9de22d984204ee4b0c11bc06f9746d8

Contents?: true

Size: 787 Bytes

Versions: 4

Compression:

Stored size: 787 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.workload_get_and_ensure(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

4 entries across 4 versions & 1 rubygems

Version Path
cpl-0.3.3 lib/command/deploy_image.rb
cpl-0.3.2 lib/command/deploy_image.rb
cpl-0.3.1 lib/command/deploy_image.rb
cpl-0.3.0 lib/command/deploy_image.rb