ecs_oneshot 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +5 -5
- data/README.md +2 -1
- data/lib/ecs_oneshot/task.rb +15 -14
- data/lib/ecs_oneshot/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d35d3d137141ecc4b2bac0e823a5ca74d598b80093f0e6e87deb50e9ad7f492
|
4
|
+
data.tar.gz: 40d2a17b0f05018d506cf715a21f8799b2af1386b764c1d886368d53e71623d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a03c2b215c42c42a29a50a4c229009db52a8f493226bc7c902adacb5645540ceac3a1b60cebf85906270cdb31c997cdea3ca5a1dfcbba293e0c4df4b4eaafbca
|
7
|
+
data.tar.gz: 9a54537e2bf20043ebf739908eb7cdf3a6460f547d65b3b39d59403ad1804b9bf898e7fae68d9d9dba4b0a2f7aad6db6fe8d6f485a230ba54f199afb75f593df
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ecs_oneshot (0.1.
|
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.
|
16
|
-
aws-sdk-cloudwatchlogs (1.
|
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.
|
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.
|
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
|
6
|
+
A CLI tool that simply executes tasks on AWS ECS.
|
6
7
|
|
7
8
|
## Installation
|
8
9
|
|
data/lib/ecs_oneshot/task.rb
CHANGED
@@ -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
|
49
|
-
@
|
50
|
-
|
51
|
-
|
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 =
|
56
|
-
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
|
-
|
82
|
-
ecs.run_task(
|
82
|
+
def run_task # rubocop:disable Metrics/AbcSize
|
83
|
+
options = {
|
83
84
|
cluster: config.cluster,
|
84
|
-
launch_type:
|
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
|
data/lib/ecs_oneshot/version.rb
CHANGED
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.
|
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-
|
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
|