hako 2.5.0 → 2.5.1

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
  SHA256:
3
- metadata.gz: 767220800b5dfd1061a252661ffbcbc906add32e8530ff6a995c0a7bd0ca8638
4
- data.tar.gz: 2e55c3884f6fffd16c1be7c11d4d88bf25e92f8673d8879fe07bd0453fb60fb4
3
+ metadata.gz: 455bfab68b9704f5c88024b8b7cedf62e785c0402c7319a27cc7ad211d7469e5
4
+ data.tar.gz: 8e77ee272e621bd74313efa44fe3893a7ca321f70782a79080fcc93f565b0fe7
5
5
  SHA512:
6
- metadata.gz: 240ca907d82750a600bcb21b94df017fc4b10732b78ede4e0025042957a0b0eadb3636512a0a4c0fdb59cff31ebb0e541da067397bad6a8da0ffb3a3293cfbec
7
- data.tar.gz: c9949c11c16665d5efebe91e92acf30df5ae0c5cdd4d229e0f2b8711e503d5e43267aa233f6830ad6e24fba6f9bc8dbcd4c3a4e4efddb67c31d8861c8558cc4a
6
+ metadata.gz: baa10b71b8e5082c3349651f5497d2dd46bc67f66b88245c13e535b40c6253a68402232e9596b21133c781b31c893c4a7792139688fda4fd3af5412d051bd80f
7
+ data.tar.gz: e24e45b42ddad5852bf55696126155a6268c807fbaf079978677270c86eaa89bc4b6011907b1201e08c8285a231e9f3a91f5c11a311495054d2d1c4e5734cccb
@@ -1,3 +1,7 @@
1
+ # 2.5.1 (2018-11-29)
2
+ ## Bug fixes
3
+ - Check secrets existence in dry-run mode
4
+
1
5
  # 2.5.0 (2018-11-22)
2
6
  ## New features
3
7
  - Add `load_balancer_name` and `target_group_name` option to skip creating ELB
@@ -31,6 +31,7 @@ Gem::Specification.new do |spec|
31
31
  spec.add_dependency 'aws-sdk-elasticloadbalancingv2'
32
32
  spec.add_dependency 'aws-sdk-s3'
33
33
  spec.add_dependency 'aws-sdk-sns'
34
+ spec.add_dependency 'aws-sdk-ssm'
34
35
  spec.add_dependency 'jsonnet'
35
36
 
36
37
  spec.add_development_dependency 'bundler'
@@ -5,6 +5,7 @@ require 'aws-sdk-ec2'
5
5
  require 'aws-sdk-ecs'
6
6
  require 'aws-sdk-s3'
7
7
  require 'aws-sdk-sns'
8
+ require 'aws-sdk-ssm'
8
9
  require 'hako'
9
10
  require 'hako/error'
10
11
  require 'hako/scheduler'
@@ -104,6 +105,7 @@ module Hako
104
105
  end
105
106
  definitions.each do |d|
106
107
  print_definition_in_cli_format(d)
108
+ check_secrets(d)
107
109
  end
108
110
  if @autoscaling
109
111
  @autoscaling.apply(Aws::ECS::Types::Service.new(cluster_arn: @cluster, service_name: @app_id))
@@ -192,6 +194,7 @@ module Hako
192
194
  d[:command] = commands
193
195
  end
194
196
  print_definition_in_cli_format(d, additional_env: env)
197
+ check_secrets(d)
195
198
  end
196
199
  0
197
200
  else
@@ -337,6 +340,11 @@ module Hako
337
340
  @ec2_client ||= Aws::EC2::Client.new(region: @region)
338
341
  end
339
342
 
343
+ # @return [Aws::SSM::Client]
344
+ def ssm_client
345
+ @ssm_client ||= Aws::SSM::Client.new(region: @region)
346
+ end
347
+
340
348
  # @return [EcsElb, EcsElbV2]
341
349
  def ecs_elb_client
342
350
  @ecs_elb_client ||=
@@ -1221,6 +1229,27 @@ module Hako
1221
1229
  nil
1222
1230
  end
1223
1231
 
1232
+ # @param [Hash] container_definition
1233
+ # @return [nil]
1234
+ def check_secrets(container_definition)
1235
+ parameter_names = (container_definition[:secrets] || []).map { |secret| secret.fetch(:value_from) }
1236
+ invalid_parameter_names = parameter_names.each_slice(10).flat_map do |names|
1237
+ names = names.map do |name|
1238
+ if name.start_with?('arn:')
1239
+ name.slice(%r{:parameter(/.+)\z}, 1)
1240
+ else
1241
+ name
1242
+ end
1243
+ end
1244
+ ssm_client.get_parameters(names: names).invalid_parameters
1245
+ end
1246
+ unless invalid_parameter_names.empty?
1247
+ raise Error.new("Invalid parameters for secrets: #{invalid_parameter_names}")
1248
+ end
1249
+
1250
+ nil
1251
+ end
1252
+
1224
1253
  # @param [Aws::ECS::Types::Service] service
1225
1254
  # @return [nil]
1226
1255
  def warn_placement_policy_change(service)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Hako
4
- VERSION = '2.5.0'
4
+ VERSION = '2.5.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hako
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kohei Suzuki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-22 00:00:00.000000000 Z
11
+ date: 2018-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-applicationautoscaling
@@ -150,6 +150,20 @@ dependencies:
150
150
  - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: aws-sdk-ssm
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :runtime
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
153
167
  - !ruby/object:Gem::Dependency
154
168
  name: jsonnet
155
169
  requirement: !ruby/object:Gem::Requirement