ecs_oneshot 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b0cfac0339722cc6435602b20ce69e5e9f5a1430e92b2d4f4e6d48a8fd3bb6f4
4
- data.tar.gz: ae42c0b13212d467f86435c130fcd1c0a20a19b2975ee712cbcad9e813b53db0
3
+ metadata.gz: 6d35d3d137141ecc4b2bac0e823a5ca74d598b80093f0e6e87deb50e9ad7f492
4
+ data.tar.gz: 40d2a17b0f05018d506cf715a21f8799b2af1386b764c1d886368d53e71623d4
5
5
  SHA512:
6
- metadata.gz: 44a8facfad2c7c490e93eee9fa445287bd6544ab4ad4db12267b0f5c22170efa765aaeb2f596cab8124faf5497e743f724825b3d8f61b985a050405d17eefac1
7
- data.tar.gz: 53c135308e463e910ed298e8a5370af6ecd34cde721db1bc7b1539004c36d4df9d90c7003f66d322f9b2deb76330e4d8d39d99acd6206a71ef47e22a460ba8fe
6
+ metadata.gz: a03c2b215c42c42a29a50a4c229009db52a8f493226bc7c902adacb5645540ceac3a1b60cebf85906270cdb31c997cdea3ca5a1dfcbba293e0c4df4b4eaafbca
7
+ data.tar.gz: 9a54537e2bf20043ebf739908eb7cdf3a6460f547d65b3b39d59403ad1804b9bf898e7fae68d9d9dba4b0a2f7aad6db6fe8d6f485a230ba54f199afb75f593df
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ecs_oneshot (0.1.0)
4
+ ecs_oneshot (0.1.1)
5
5
  aws-sdk-cloudwatchlogs
6
6
  aws-sdk-ecs
7
7
 
@@ -12,16 +12,16 @@ GEM
12
12
  public_suffix (>= 2.0.2, < 5.0)
13
13
  ast (2.4.1)
14
14
  aws-eventstream (1.1.0)
15
- aws-partitions (1.357.0)
16
- aws-sdk-cloudwatchlogs (1.34.0)
15
+ aws-partitions (1.359.0)
16
+ aws-sdk-cloudwatchlogs (1.36.0)
17
17
  aws-sdk-core (~> 3, >= 3.99.0)
18
18
  aws-sigv4 (~> 1.1)
19
- aws-sdk-core (3.104.3)
19
+ aws-sdk-core (3.105.0)
20
20
  aws-eventstream (~> 1, >= 1.0.2)
21
21
  aws-partitions (~> 1, >= 1.239.0)
22
22
  aws-sigv4 (~> 1.1)
23
23
  jmespath (~> 1.0)
24
- aws-sdk-ecs (1.67.0)
24
+ aws-sdk-ecs (1.68.0)
25
25
  aws-sdk-core (~> 3, >= 3.99.0)
26
26
  aws-sigv4 (~> 1.1)
27
27
  aws-sigv4 (1.2.2)
data/README.md CHANGED
@@ -1,8 +1,9 @@
1
1
  # EcsOneshot
2
2
 
3
3
  ![Ruby](https://github.com/sinsoku/ecs_oneshot/workflows/Ruby/badge.svg)
4
+ [![Gem Version](https://badge.fury.io/rb/ecs_oneshot.svg)](https://badge.fury.io/rb/ecs_oneshot)
4
5
 
5
- A CLI tool that simply executes tasks on AWS Fargate.
6
+ A CLI tool that simply executes tasks on AWS ECS.
6
7
 
7
8
  ## Installation
8
9
 
@@ -27,6 +27,8 @@ module EcsOneshot
27
27
  end
28
28
 
29
29
  def each_log(&block)
30
+ return unless log_configuration
31
+
30
32
  last_event = nil
31
33
 
32
34
  loop do
@@ -45,15 +47,15 @@ module EcsOneshot
45
47
 
46
48
  attr_reader :id, :arn, :config, :ecs, :logs
47
49
 
48
- def log_options
49
- @log_options ||= task_definition.container_definitions
50
- .find { |c| c.name == config.container }
51
- .log_configuration.options
50
+ def log_configuration
51
+ @log_configuration ||= task_definition.container_definitions
52
+ .find { |c| c.name == config.container }
53
+ .log_configuration
52
54
  end
53
55
 
54
56
  def get_log_events(start_time:)
55
- awslogs_group = log_options["awslogs-group"]
56
- awslogs_stream_prefix = log_options["awslogs-stream-prefix"]
57
+ awslogs_group = log_configuration.options["awslogs-group"]
58
+ awslogs_stream_prefix = log_configuration.options["awslogs-stream-prefix"]
57
59
 
58
60
  resp = logs.get_log_events(
59
61
  log_group_name: awslogs_group,
@@ -77,17 +79,16 @@ module EcsOneshot
77
79
  .services[0]
78
80
  end
79
81
 
80
- def run_task
81
- awsvpc = service.network_configuration.awsvpc_configuration
82
- ecs.run_task(
82
+ def run_task # rubocop:disable Metrics/AbcSize
83
+ options = {
83
84
  cluster: config.cluster,
84
- launch_type: "FARGATE",
85
- network_configuration: {
86
- awsvpc_configuration: { subnets: awsvpc.subnets, security_groups: awsvpc.security_groups }
87
- },
85
+ launch_type: service.launch_type,
88
86
  overrides: { container_overrides: [{ name: config.container, command: config.command }] },
89
87
  task_definition: task_definition.task_definition_arn
90
- )
88
+ }
89
+ options[:network_configuration] = service.network_configuration.to_h if service.network_configuration
90
+
91
+ ecs.run_task(options)
91
92
  end
92
93
  end
93
94
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EcsOneshot
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecs_oneshot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takumi Shotoku
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-08-20 00:00:00.000000000 Z
11
+ date: 2020-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-cloudwatchlogs