Class: Ufo::Docker::Pusher
- Inherits:
-
Object
- Object
- Ufo::Docker::Pusher
- Includes:
- Util
- 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
-
#image_name ⇒ Object
full_image - does not include the tag.
-
#initialize(image, options) ⇒ Pusher
constructor
A new instance of Pusher.
- #push ⇒ Object
- #update_auth_token ⇒ Object
Methods included from Util
#default_cluster, #display_params, #execute, #pretty_time, #settings, #task_definition_arns, #user_params
Constructor Details
#initialize(image, options) ⇒ Pusher
Returns a new instance of Pusher.
9 10 11 12 13 14 |
# File 'lib/ufo/docker/pusher.rb', line 9 def initialize(image, ) @options = # full_image_name ultimately uses @options, so @last_image_name assignment # line must be defined after setting @options. @last_image_name = image || full_image_name end |
Instance Attribute Details
#last_image_name ⇒ Object (readonly)
Returns the value of attribute last_image_name.
8 9 10 |
# File 'lib/ufo/docker/pusher.rb', line 8 def last_image_name @last_image_name end |
Instance Method Details
#builder ⇒ Object
36 37 38 |
# File 'lib/ufo/docker/pusher.rb', line 36 def builder @builder ||= Builder.new(@options.merge(image: last_image_name)) end |
#image_name ⇒ Object
full_image - does not include the tag
47 48 49 |
# File 'lib/ufo/docker/pusher.rb', line 47 def image_name settings[:image] end |
#push ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/ufo/docker/pusher.rb', line 16 def push update_auth_token start_time = Time.now = "Pushed #{last_image_name} docker image." if @options[:noop] = "NOOP #{}" else command = "docker push #{last_image_name}" puts "=> #{command}".color(:green) success = execute(command, use_system: true) unless success puts "ERROR: The docker image fail to push.".color(:red) exit 1 end end took = Time.now - start_time << "\nDocker push took #{pretty_time(took)}.".color(:green) puts unless @options[:mute] end |
#update_auth_token ⇒ Object
40 41 42 43 44 |
# File 'lib/ufo/docker/pusher.rb', line 40 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 |