Sha256: d35e20f81d96501127e006d20a571325b56ad1c7f9bdaff5bf6ad7cbbf2230c2

Contents?: true

Size: 1.1 KB

Versions: 22

Compression:

Stored size: 1.1 KB

Contents

module Ufo::Docker
  class Pusher
    include Concerns

    delegate :docker_image, to: :builder
    attr_reader :last_image_name
    def initialize(image, options)
      @options = options
      # docker_image ultimately uses @options, so @last_image_name assignment
      # line must be defined after setting @options.
      @last_image_name = image || docker_image
    end

    def push
      update_auth_token
      start_time = Time.now
      logger.info "Pushing Docker Image"
      command = "docker push #{last_image_name}"
      log = ".ufo/log/docker.log" if @options[:quiet]
      success = execute(command, log: log)
      unless success
        logger.info "ERROR: The docker image fail to push.".color(:red)
        exit 1
      end
      took = Time.now - start_time
      logger.info "Took #{pretty_time(took)}"
    end

    def builder
      @builder ||= Builder.new(@options.merge(image: last_image_name))
    end

    def update_auth_token
      auth = Ufo::Ecr::Auth.new(last_image_name)
      # wont update auth token unless the image being pushed in the ECR image format
      auth.update
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
ufo-6.2.5 lib/ufo/docker/pusher.rb
ufo-6.2.4 lib/ufo/docker/pusher.rb
ufo-6.2.3 lib/ufo/docker/pusher.rb
ufo-6.2.2 lib/ufo/docker/pusher.rb
ufo-6.2.1 lib/ufo/docker/pusher.rb
ufo-6.2.0 lib/ufo/docker/pusher.rb
ufo-6.1.5 lib/ufo/docker/pusher.rb
ufo-6.1.4 lib/ufo/docker/pusher.rb
ufo-6.1.3 lib/ufo/docker/pusher.rb
ufo-6.1.2 lib/ufo/docker/pusher.rb
ufo-6.1.1 lib/ufo/docker/pusher.rb
ufo-6.1.0 lib/ufo/docker/pusher.rb
ufo-6.0.9 lib/ufo/docker/pusher.rb
ufo-6.0.8 lib/ufo/docker/pusher.rb
ufo-6.0.7 lib/ufo/docker/pusher.rb
ufo-6.0.6 lib/ufo/docker/pusher.rb
ufo-6.0.5 lib/ufo/docker/pusher.rb
ufo-6.0.4 lib/ufo/docker/pusher.rb
ufo-6.0.3 lib/ufo/docker/pusher.rb
ufo-6.0.2 lib/ufo/docker/pusher.rb