Class: Ufo::Docker::Pusher
- Inherits:
-
Object
- Object
- Ufo::Docker::Pusher
- Includes:
- Concerns
- Defined in:
- lib/ufo/docker/pusher.rb
Instance Attribute Summary collapse
-
#last_image_name ⇒ Object
readonly
Returns the value of attribute last_image_name.
Instance Method Summary collapse
- #builder ⇒ Object
-
#initialize(image, options) ⇒ Pusher
constructor
A new instance of Pusher.
- #push ⇒ Object
- #update_auth_token ⇒ Object
Methods included from Utils::Pretty
#pretty_home, #pretty_path, #pretty_time
Methods included from Utils::Logging
Methods included from Utils::Execute
Constructor Details
#initialize(image, options) ⇒ Pusher
Returns a new instance of Pusher.
7 8 9 10 11 12 |
# File 'lib/ufo/docker/pusher.rb', line 7 def initialize(image, ) @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 |
Instance Attribute Details
#last_image_name ⇒ Object (readonly)
Returns the value of attribute last_image_name.
6 7 8 |
# File 'lib/ufo/docker/pusher.rb', line 6 def last_image_name @last_image_name end |
Instance Method Details
#builder ⇒ Object
29 30 31 |
# File 'lib/ufo/docker/pusher.rb', line 29 def builder @builder ||= Builder.new(@options.merge(image: last_image_name)) end |
#push ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/ufo/docker/pusher.rb', line 14 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 |
#update_auth_token ⇒ Object
33 34 35 36 37 |
# File 'lib/ufo/docker/pusher.rb', line 33 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 |