mikoshi 0.5.1 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 91901df0fd3e05112bf50bba02099fbf6326896c
4
- data.tar.gz: 9209a991655d9191c47f07f0e7d3bba06b78720b
3
+ metadata.gz: e07ee0e950e881ccf43b42fb0528695f1d229cff
4
+ data.tar.gz: 1e9bf381a69bee72be583f4437e3876c83b3272b
5
5
  SHA512:
6
- metadata.gz: ef033b5f1751400c0f7d8c2d8b01faf4df2b2fe0d691c098eb378a64a921b4a83dbd4d22dc1371f87d4e3695ccfbcf506f3a5ac90ddf8d12e20d5167a13d33e7
7
- data.tar.gz: a7e481bf5ed34d64af1b6c712a595eccd3f6e4e57087eed12a209723f86f8a6a5c07e5a307812a7779776792f6d936b42f23fdf8eef1c9cd5a76047c7c0a4580
6
+ metadata.gz: 5e31bf93102661b0ae4e3344866afb4c38eb0b801a4e2a2fbee7dc6d4e7cc695f12e4b0fc390875df43e35ca752fdeaef8691e55d4c9804523f64a7385b7e6cb
7
+ data.tar.gz: 6fa9a70fa1d52549d53c4dfb6b68009a02578c3e9264d50538a096b2817343b8612e3a8ab48678b2ba6f09ce5daab73445c076f6752c59016e2f7df89df25fcd
data/lib/mikoshi/cli.rb CHANGED
@@ -35,6 +35,8 @@ module Mikoshi
35
35
  update_task_definition(@options[:config][:task_definition] || @argv[1])
36
36
  when :update_service
37
37
  update_service(@options[:config][:service] || @argv[1])
38
+ when :runtask
39
+ runtask(@options[:config][:task_definition] || @argv[1], @options[:config][:cluster])
38
40
  when :deploy
39
41
  deploy
40
42
  when :version
@@ -54,6 +56,7 @@ module Mikoshi
54
56
  opt.on('-g', '--group=GROUP') { |v| @options[:config][:group] = v }
55
57
  opt.on('-h', '--help') { |v| @options[:config][:help] = v }
56
58
  opt.on('-v', '--version') { |v| @options[:config][:version] = v }
59
+ opt.on('--cluster=CLUSTER') { |v| @options[:config][:cluster] = v }
57
60
 
58
61
  opt.permute!(@argv)
59
62
  @options[:command] = @argv.first.to_sym unless @argv.first.nil?
@@ -83,6 +86,13 @@ module Mikoshi
83
86
  --potdr
84
87
  Acronym of the "Print Only Task Definition Revision".
85
88
 
89
+ runtask
90
+ Invoke new task using specified task definition.
91
+
92
+ Option
93
+ --cluster
94
+ Set cluster to run task. (required)
95
+
86
96
  update_service
87
97
  Update service to given service yaml file.
88
98
  Wait for success to update the service. (Maximum 300 min)
@@ -125,6 +135,22 @@ module Mikoshi
125
135
  puts ENV['TASK_DEF_REVISION'] if potdr
126
136
  end
127
137
 
138
+ def runtask(task_def_name, cluster)
139
+ if task_def_name.nil?
140
+ warn '--task-definition=TASK_DEFINITION is require option.'
141
+ abort
142
+ end
143
+
144
+ task = ::Mikoshi::Plan::TaskDefinition.new(
145
+ yaml_path: File.join(TASK_DEFINITION_PATH, task_def_name + PLAN_EXT),
146
+ client: aws_client,
147
+ )
148
+
149
+ puts "Run task: #{task_def_name}"
150
+ task.runtask(cluster: cluster)
151
+ puts "Invoked task: #{task_def_name}"
152
+ end
153
+
128
154
  def update_service(service_name)
129
155
  if service_name.nil?
130
156
  warn '--service=SERVICE is require option.'
@@ -23,6 +23,12 @@ module Mikoshi
23
23
  raise e
24
24
  end
25
25
 
26
+ def runtask(cluster: nil)
27
+ raise ArgumentError, 'cluster name is required.' if cluster.nil?
28
+
29
+ resp = @client.run_task(task_definition: @data[:task_definition][:family], cluster: cluster)
30
+ end
31
+
26
32
  private
27
33
 
28
34
  %w[before after].each do |step|
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mikoshi
4
- VERSION = '0.5.1'
4
+ VERSION = '0.6.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mikoshi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yusuke Nakamura
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-06-07 00:00:00.000000000 Z
11
+ date: 2017-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport