Sha256: 630ca31dd44201c0f13abb08c197c59073a3418f2169bd41c0cfb2ba7e374cdd

Contents?: true

Size: 780 Bytes

Versions: 2

Compression:

Stored size: 780 Bytes

Contents

# frozen_string_literal: true

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

    def call
      image = latest_image

      config[:app_workloads].each do |workload|
        cp.workload_get(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.2.0 lib/command/promote_image.rb
cpl-0.1.0 lib/command/promote_image.rb