hako 2.15.0 → 2.17.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
  SHA256:
3
- metadata.gz: 1c1298dda5d9e120f1856ed3a559c520451b1023384d1a56bd921f66c70f6da5
4
- data.tar.gz: 833a89a305a9e075df8016e90a7d4ad45f18c29ad208197e3ebdacba5a60848b
3
+ metadata.gz: 39056ee36a91a2e24c9dc59cfe7e5a0fef62c55578c31cf6aa2243d29d89ca8e
4
+ data.tar.gz: ca5ecea7f27470068cf6d69d925363fa43dfcde5bba28764e51df11e9e57cfb2
5
5
  SHA512:
6
- metadata.gz: bfba96a068f38a760e7760188574e7b5afe2dd5400ce745905f3611f71fe18f87d2cbe446878c2d00ee55e56b423ac0185baa96c91737b10847f3f77442d5035
7
- data.tar.gz: cfa5202766106d88e125cba58011fcccff3954a843c2fdc56a301e62d476239b1ae955b627de3dfbcf185e08bfb721418669c6f86548f68d55765f164e969e56
6
+ metadata.gz: 99c17719f1f60db1bd9c5413f6cb02005464f90bda67f5f543b6537d71796f0fe8ea9e32a267bf1000bcc48e1b98ef03c03cf4a0878cc1d8b2107e9fb405b362
7
+ data.tar.gz: 23f57698cb4d2cdf7fd59bed1c25977fefbea9868fcbd4179d860729ca0ebf372d177dd8d25d5205e6814b7edd77450837054da96d232f8844c604e743324264
@@ -0,0 +1,37 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ pull_request:
7
+
8
+ jobs:
9
+ rspec:
10
+ name: RSpec
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ fail-fast: false
14
+ matrix:
15
+ ruby:
16
+ - '2.6'
17
+ - '2.7'
18
+ - '3.0'
19
+ - '3.1'
20
+ steps:
21
+ - uses: actions/checkout@v2
22
+ - uses: ruby/setup-ruby@v1
23
+ with:
24
+ ruby-version: ${{ matrix.ruby }}
25
+ bundler-cache: true
26
+ - run: bundle exec rspec
27
+ rubocop:
28
+ name: RuboCop
29
+ runs-on: ubuntu-latest
30
+ steps:
31
+ - uses: actions/checkout@v2
32
+ - uses: ruby/setup-ruby@v1
33
+ with:
34
+ # Use the same version with .rubocop.yml
35
+ ruby-version: 2.6
36
+ bundler-cache: true
37
+ - run: bundle exec rubocop
data/.rubocop.yml CHANGED
@@ -2,7 +2,7 @@ inherit_from: .rubocop_todo.yml
2
2
 
3
3
  AllCops:
4
4
  DisplayCopNames: true
5
- TargetRubyVersion: 2.5
5
+ TargetRubyVersion: 2.6
6
6
  NewCops: disable
7
7
 
8
8
  Layout/FirstArgumentIndentation:
@@ -36,6 +36,8 @@ Style/PercentLiteralDelimiters:
36
36
  '%i': '[]'
37
37
  Style/RaiseArgs:
38
38
  EnforcedStyle: compact
39
+ Style/RedundantCondition:
40
+ Enabled: false
39
41
  Style/SignalException:
40
42
  Enabled: false
41
43
  Style/SoleNestedConditional:
data/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ # 2.17.0 (2022-05-31)
2
+ ## New features
3
+ - Support runtime_platform option
4
+
5
+ # 2.16.0 (2022-05-02)
6
+ ## New features
7
+ - Support ephemeral_storage option in ECS scheduler
8
+
9
+ ## Bug fixes
10
+ - Fix keyword arguments for Ruby 3.0
11
+
12
+ ## Changes
13
+ - Drop support for Ruby 2.5 (EOL on 2021-04-05)
14
+
15
+ # 2.15.1 (2021-08-06)
16
+ ## Bug fixes
17
+ - Fix keyword arguments for Ruby 3.0
18
+
1
19
  # 2.15.0 (2020-11-02)
2
20
  ## New features
3
21
  - Support protocol_version and matcher option of ALB target groups
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Hako
2
2
  [![Gem Version](https://badge.fury.io/rb/hako.svg)](http://badge.fury.io/rb/hako)
3
- [![Build Status](https://travis-ci.org/eagletmt/hako.svg)](https://travis-ci.org/eagletmt/hako)
3
+ ![CI](https://github.com/eagletmt/hako/workflows/CI/badge.svg)
4
4
 
5
5
  Deploy Docker container.
6
6
 
@@ -7,6 +7,9 @@
7
7
  execution_role_arn: 'arn:aws:iam::012345678901:role/ecsTaskExecutionRole',
8
8
  cpu: '1024',
9
9
  memory: '2048',
10
+ ephemeral_storage: {
11
+ size_in_gi_b: '25',
12
+ },
10
13
  requires_compatibilities: ['FARGATE'],
11
14
  network_mode: 'awsvpc',
12
15
  launch_type: 'FARGATE',
@@ -51,6 +51,9 @@ local awslogs = {
51
51
  execution_role_arn: 'arn:aws:iam::012345678901:role/ecsTaskExecutionRole',
52
52
  cpu: '1024',
53
53
  memory: '2048',
54
+ ephemeral_storage: {
55
+ size_in_gi_b: '25',
56
+ },
54
57
  requires_compatibilities: ['FARGATE'],
55
58
  network_mode: 'awsvpc',
56
59
  launch_type: 'FARGATE',
data/hako.gemspec CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.bindir = 'exe'
20
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  spec.require_paths = ['lib']
22
- spec.required_ruby_version = '>= 2.5.0'
22
+ spec.required_ruby_version = '>= 2.6.0'
23
23
 
24
24
  spec.add_dependency 'aws-sdk-applicationautoscaling'
25
25
  spec.add_dependency 'aws-sdk-autoscaling'
@@ -36,7 +36,6 @@ Gem::Specification.new do |spec|
36
36
  spec.add_dependency 'jsonnet'
37
37
 
38
38
  spec.add_development_dependency 'bundler'
39
- spec.add_development_dependency 'coveralls'
40
39
  spec.add_development_dependency 'rake'
41
40
  spec.add_development_dependency 'rspec'
42
41
  spec.add_development_dependency 'rubocop', '>= 0.53.0'
data/lib/hako/cli.rb CHANGED
@@ -73,7 +73,7 @@ module Hako
73
73
  else
74
74
  {}
75
75
  end
76
- Commander.new(Application.new(@definition_path, options)).deploy(force: @force, tag: @tag, dry_run: @dry_run, timeout: @timeout)
76
+ Commander.new(Application.new(@definition_path, **options)).deploy(force: @force, tag: @tag, dry_run: @dry_run, timeout: @timeout)
77
77
  end
78
78
 
79
79
  DEFAULT_TIMEOUT = 1200 # 20 minutes
@@ -121,7 +121,7 @@ module Hako
121
121
  else
122
122
  {}
123
123
  end
124
- Commander.new(Application.new(@definition_path, options)).rollback(dry_run: @dry_run)
124
+ Commander.new(Application.new(@definition_path, **options)).rollback(dry_run: @dry_run)
125
125
  end
126
126
 
127
127
  def parse!(argv)
@@ -164,7 +164,7 @@ module Hako
164
164
  else
165
165
  {}
166
166
  end
167
- Commander.new(Application.new(@definition_path, options)).oneshot(@argv, tag: @tag, containers: @containers, env: @env, dry_run: @dry_run, no_wait: @no_wait, overrides: @overrides)
167
+ Commander.new(Application.new(@definition_path, **options)).oneshot(@argv, tag: @tag, containers: @containers, env: @env, dry_run: @dry_run, no_wait: @no_wait, overrides: @overrides)
168
168
  end
169
169
 
170
170
  def parse!(argv)
@@ -72,7 +72,22 @@ module Hako
72
72
  @execution_role_arn = options.fetch('execution_role_arn', nil)
73
73
  @cpu = options.fetch('cpu', nil)
74
74
  @memory = options.fetch('memory', nil)
75
+ if options.key?('ephemeral_storage')
76
+ ephemeral_storage = options.fetch('ephemeral_storage')
77
+ if ephemeral_storage.key?('size_in_gi_b')
78
+ @ephemeral_storage = {
79
+ size_in_gi_b: ephemeral_storage.fetch('size_in_gi_b')
80
+ }
81
+ end
82
+ end
75
83
  @requires_compatibilities = options.fetch('requires_compatibilities', nil)
84
+ if options.key?('runtime_platform')
85
+ runtime_platform = options.fetch('runtime_platform')
86
+ @runtime_platform = {
87
+ cpu_architecture: runtime_platform.fetch('cpu_architecture', nil),
88
+ operating_system_family: runtime_platform.fetch('operating_system_family', nil),
89
+ }
90
+ end
76
91
  @launch_type = options.fetch('launch_type', nil)
77
92
  if options.key?('capacity_provider_strategy')
78
93
  @capacity_provider_strategy = options.fetch('capacity_provider_strategy').map do |strategy|
@@ -515,6 +530,12 @@ module Hako
515
530
  if actual_definition.requires_compatibilities != @requires_compatibilities
516
531
  return true
517
532
  end
533
+ if actual_definition.runtime_platform != @runtime_platform
534
+ return true
535
+ end
536
+ if actual_definition.ephemeral_storage != @ephemeral_storage
537
+ return true
538
+ end
518
539
 
519
540
  actual_tags_set = Set.new(actual_tags.map { |t| { key: t.key, value: t.value } })
520
541
  tags_set = Set.new(@tags)
@@ -555,8 +576,10 @@ module Hako
555
576
  container_definitions: definitions,
556
577
  volumes: volumes_definition,
557
578
  requires_compatibilities: @requires_compatibilities,
579
+ runtime_platform: @runtime_platform,
558
580
  cpu: @cpu,
559
581
  memory: @memory,
582
+ ephemeral_storage: @ephemeral_storage,
560
583
  tags: @tags.empty? ? nil : @tags,
561
584
  ).task_definition
562
585
  [true, new_task_definition]
@@ -591,8 +614,10 @@ module Hako
591
614
  container_definitions: definitions,
592
615
  volumes: volumes_definition,
593
616
  requires_compatibilities: @requires_compatibilities,
617
+ runtime_platform: @runtime_platform,
594
618
  cpu: @cpu,
595
619
  memory: @memory,
620
+ ephemeral_storage: @ephemeral_storage,
596
621
  tags: @tags.empty? ? nil : @tags,
597
622
  ).task_definition
598
623
  return [true, new_task_definition]
@@ -916,7 +941,7 @@ module Hako
916
941
  warn_placement_policy_change(current_service)
917
942
  warn_service_registries_change(current_service)
918
943
  if service_changed?(current_service, params)
919
- ecs_client.update_service(params).service
944
+ ecs_client.update_service(**params).service
920
945
  else
921
946
  :noop
922
947
  end
@@ -952,7 +977,7 @@ module Hako
952
977
  @service_discovery.apply
953
978
  params[:service_registries] = @service_discovery.service_registries
954
979
  end
955
- ecs_client.create_service(params).service
980
+ ecs_client.create_service(**params).service
956
981
  end
957
982
 
958
983
  # @param [Aws::ECS::Types::Service] service
@@ -1322,7 +1347,7 @@ module Hako
1322
1347
  when 'NONE'
1323
1348
  cmd << '--no-healthcheck'
1324
1349
  when 'CMD', 'CMD-SHELL'
1325
- health_check_command = definition[:health_check][:command][1..-1].join(' ')
1350
+ health_check_command = definition[:health_check][:command][1..].join(' ')
1326
1351
  cmd << '--health-cmd' << health_check_command.inspect
1327
1352
  else
1328
1353
  raise "Health check command type #{health_check_command_type} is not supported. CMD, CMD-SHELL and NONE are supported."
@@ -127,7 +127,7 @@ module Hako
127
127
  end
128
128
 
129
129
  unless listener_ports.include?(params[:port])
130
- listener = elb_client.create_listener(params).listeners[0]
130
+ listener = elb_client.create_listener(**params).listeners[0]
131
131
  Hako.logger.info("Created listener #{listener.listener_arn}")
132
132
  end
133
133
  end
@@ -134,7 +134,7 @@ module Hako
134
134
  condition: 'EQ',
135
135
  ],
136
136
  }
137
- services = service_discovery_client.list_services(params).flat_map(&:services)
137
+ services = service_discovery_client.list_services(**params).flat_map(&:services)
138
138
  services.find { |service| service.name == service_name }
139
139
  end
140
140
 
@@ -146,7 +146,7 @@ module Hako
146
146
  # @param [Hash] service
147
147
  # @return [Aws::ServiceDiscovery::Types::Service]
148
148
  def create_service(service)
149
- service_discovery_client.create_service(create_service_params(service)).service
149
+ service_discovery_client.create_service(**create_service_params(service)).service
150
150
  end
151
151
 
152
152
  # @param [Hash] service
@@ -107,7 +107,7 @@ module Hako
107
107
 
108
108
  # @return [String]
109
109
  def render
110
- ERB.new(File.read(nginx_conf_erb), nil, '-').result(binding)
110
+ ERB.new(File.read(nginx_conf_erb), trim_mode: '-').result(binding)
111
111
  end
112
112
 
113
113
  private
@@ -150,7 +150,7 @@ module Hako
150
150
  # @param [Location] location
151
151
  # @return [String]
152
152
  def render_location(listen_spec, location)
153
- ERB.new(File.read(nginx_location_conf_erb), nil, '-').result(binding).each_line.map do |line|
153
+ ERB.new(File.read(nginx_location_conf_erb), trim_mode: '-').result(binding).each_line.map do |line|
154
154
  " #{line}"
155
155
  end.join('')
156
156
  end
data/lib/hako/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Hako
4
- VERSION = '2.15.0'
4
+ VERSION = '2.17.0'
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.15.0
4
+ version: 2.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kohei Suzuki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-11-02 00:00:00.000000000 Z
11
+ date: 2022-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-applicationautoscaling
@@ -206,20 +206,6 @@ dependencies:
206
206
  - - ">="
207
207
  - !ruby/object:Gem::Version
208
208
  version: '0'
209
- - !ruby/object:Gem::Dependency
210
- name: coveralls
211
- requirement: !ruby/object:Gem::Requirement
212
- requirements:
213
- - - ">="
214
- - !ruby/object:Gem::Version
215
- version: '0'
216
- type: :development
217
- prerelease: false
218
- version_requirements: !ruby/object:Gem::Requirement
219
- requirements:
220
- - - ">="
221
- - !ruby/object:Gem::Version
222
- version: '0'
223
209
  - !ruby/object:Gem::Dependency
224
210
  name: rake
225
211
  requirement: !ruby/object:Gem::Requirement
@@ -298,11 +284,11 @@ executables:
298
284
  extensions: []
299
285
  extra_rdoc_files: []
300
286
  files:
287
+ - ".github/workflows/ci.yml"
301
288
  - ".gitignore"
302
289
  - ".rspec"
303
290
  - ".rubocop.yml"
304
291
  - ".rubocop_todo.yml"
305
- - ".travis.yml"
306
292
  - ".yardopts"
307
293
  - CHANGELOG.md
308
294
  - Gemfile
@@ -391,14 +377,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
391
377
  requirements:
392
378
  - - ">="
393
379
  - !ruby/object:Gem::Version
394
- version: 2.5.0
380
+ version: 2.6.0
395
381
  required_rubygems_version: !ruby/object:Gem::Requirement
396
382
  requirements:
397
383
  - - ">="
398
384
  - !ruby/object:Gem::Version
399
385
  version: '0'
400
386
  requirements: []
401
- rubygems_version: 3.1.4
387
+ rubygems_version: 3.2.32
402
388
  signing_key:
403
389
  specification_version: 4
404
390
  summary: Deploy Docker container
data/.travis.yml DELETED
@@ -1,10 +0,0 @@
1
- language: ruby
2
- sudo: false
3
- rvm:
4
- - 2.5.8
5
- - 2.6.6
6
- - 2.7.2
7
- - ruby-head
8
- matrix:
9
- allow_failures:
10
- - rvm: ruby-head