Sha256: d8b05a8ff1019a27cc83880617e7b8f0ea639311742a9f756b31b1d73b1f3d4b

Contents?: true

Size: 975 Bytes

Versions: 29

Compression:

Stored size: 975 Bytes

Contents

require_relative 'stacks_helper'

module Kontena::Cli::Stacks
  class DeployCommand < Kontena::Command
    include Kontena::Cli::Common
    include Kontena::Cli::GridOptions
    include StacksHelper

    banner "Deploys all services of a stack"

    parameter "NAME ...", "Stack name", attribute_name: :names

    option '--[no-]wait', :flag, 'Wait for deployment to finish', default: true

    requires_current_master
    requires_current_master_token

    def execute
      names.each do |name|
        deployment = nil
        spinner "Triggering deployment of stack #{pastel.cyan(name)}" do
          deployment = deploy_stack(name)
        end
        if wait?
          spinner "Waiting for deployment to start" do
            wait_for_deployment_to_start(deployment)
          end
          wait_for_deploy_to_finish(deployment)
        end
      end
    end

    def deploy_stack(name)
      client.post("stacks/#{current_grid}/#{name}/deploy", {})
    end
  end
end

Version data entries

29 entries across 29 versions & 2 rubygems

Version Path
krates-1.7.11 lib/kontena/cli/stacks/deploy_command.rb
krates-1.7.10 lib/kontena/cli/stacks/deploy_command.rb
krates-1.7.9 lib/kontena/cli/stacks/deploy_command.rb
krates-1.7.8 lib/kontena/cli/stacks/deploy_command.rb
krates-1.7.7 lib/kontena/cli/stacks/deploy_command.rb
krates-1.7.6 lib/kontena/cli/stacks/deploy_command.rb
krates-1.7.5 lib/kontena/cli/stacks/deploy_command.rb
krates-1.7.4 lib/kontena/cli/stacks/deploy_command.rb
krates-1.7.3 lib/kontena/cli/stacks/deploy_command.rb
krates-1.7.2 lib/kontena/cli/stacks/deploy_command.rb
krates-1.7.1 lib/kontena/cli/stacks/deploy_command.rb
krates-1.7.0 lib/kontena/cli/stacks/deploy_command.rb
krates-1.6.9 lib/kontena/cli/stacks/deploy_command.rb
krates-1.6.8 lib/kontena/cli/stacks/deploy_command.rb
krates-1.6.7 lib/kontena/cli/stacks/deploy_command.rb
krates-1.6.6 lib/kontena/cli/stacks/deploy_command.rb
krates-1.6.5 lib/kontena/cli/stacks/deploy_command.rb
krates-1.6.4 lib/kontena/cli/stacks/deploy_command.rb
krates-1.6.3 lib/kontena/cli/stacks/deploy_command.rb
krates-1.6.2 lib/kontena/cli/stacks/deploy_command.rb