floe 0.6.0 → 0.6.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 +4 -4
- data/CHANGELOG.md +9 -1
- data/lib/floe/version.rb +1 -1
- data/lib/floe/workflow/runner/docker.rb +17 -10
- data/lib/floe/workflow/runner/kubernetes.rb +13 -11
- data/lib/floe/workflow/runner/podman.rb +1 -6
- 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: b92b3c488e49ea77447b370e9152c49e11036e8295c6a781feda666662927f9e
|
4
|
+
data.tar.gz: c553deab6491c9876e28a816cb2422a1318ac6f91a9f9f75cbfc5a144a84d248
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f5c210d2a745aaed8e3419e228465203dcebb02ee678c1d2b47285083e1f154118c25864e51360d3d062ca0cfade9baa84f5a932804b586f26607a195acc710
|
7
|
+
data.tar.gz: 238fd469915e8682c449abd26e1950f68fd4b032a32fcace11130109d46dc6962b29e4ce381734d167f5328ef16ee2fdd4bb250f844644abebc571fc001ab2dd
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,13 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
4
4
|
|
5
5
|
## [Unreleased]
|
6
6
|
|
7
|
+
## [0.6.1] - 2023-11-21
|
8
|
+
### Fixed
|
9
|
+
- Return an error payload if run_async! fails ([#143](https://github.com/ManageIQ/floe/pull/143))
|
10
|
+
|
11
|
+
### Changed
|
12
|
+
- Extract run_container_params for docker/podman ([#142](https://github.com/ManageIQ/floe/pull/142))
|
13
|
+
|
7
14
|
## [0.6.0] - 2023-11-09
|
8
15
|
### Added
|
9
16
|
- Prefix pod names with 'floe-' ([#132](https://github.com/ManageIQ/floe/pull/132))
|
@@ -99,7 +106,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
99
106
|
### Added
|
100
107
|
- Initial release
|
101
108
|
|
102
|
-
[Unreleased]: https://github.com/ManageIQ/floe/compare/v0.6.
|
109
|
+
[Unreleased]: https://github.com/ManageIQ/floe/compare/v0.6.1...HEAD
|
110
|
+
[0.6.1]: https://github.com/ManageIQ/floe/compare/v0.6.0...v0.6.1
|
103
111
|
[0.6.0]: https://github.com/ManageIQ/floe/compare/v0.5.0...v0.6.0
|
104
112
|
[0.5.0]: https://github.com/ManageIQ/floe/compare/v0.4.1...v0.5.0
|
105
113
|
[0.4.1]: https://github.com/ManageIQ/floe/compare/v0.4.0...v0.4.1
|
data/lib/floe/version.rb
CHANGED
@@ -30,12 +30,11 @@ module Floe
|
|
30
30
|
|
31
31
|
begin
|
32
32
|
runner_context["container_ref"] = run_container(image, env, runner_context["secrets_ref"])
|
33
|
-
|
33
|
+
runner_context
|
34
|
+
rescue AwesomeSpawn::CommandResultError => err
|
34
35
|
cleanup(runner_context)
|
35
|
-
|
36
|
+
{"Error" => "States.TaskFailed", "Cause" => err.to_s}
|
36
37
|
end
|
37
|
-
|
38
|
-
runner_context
|
39
38
|
end
|
40
39
|
|
41
40
|
def cleanup(runner_context)
|
@@ -46,11 +45,13 @@ module Floe
|
|
46
45
|
end
|
47
46
|
|
48
47
|
def status!(runner_context)
|
48
|
+
return if runner_context.key?("Error")
|
49
|
+
|
49
50
|
runner_context["container_state"] = inspect_container(runner_context["container_ref"]).first&.dig("State")
|
50
51
|
end
|
51
52
|
|
52
53
|
def running?(runner_context)
|
53
|
-
runner_context.dig("container_state", "Running")
|
54
|
+
!!runner_context.dig("container_state", "Running")
|
54
55
|
end
|
55
56
|
|
56
57
|
def success?(runner_context)
|
@@ -58,6 +59,8 @@ module Floe
|
|
58
59
|
end
|
59
60
|
|
60
61
|
def output(runner_context)
|
62
|
+
return runner_context.slice("Error", "Cause") if runner_context.key?("Error")
|
63
|
+
|
61
64
|
output = docker!("logs", runner_context["container_ref"], :combined_output => true).output
|
62
65
|
runner_context["output"] = output
|
63
66
|
end
|
@@ -67,6 +70,15 @@ module Floe
|
|
67
70
|
attr_reader :network
|
68
71
|
|
69
72
|
def run_container(image, env, secrets_file)
|
73
|
+
params = run_container_params(image, env, secrets_file)
|
74
|
+
|
75
|
+
logger.debug("Running #{AwesomeSpawn.build_command_line("docker", params)}")
|
76
|
+
|
77
|
+
result = docker!(*params)
|
78
|
+
result.output
|
79
|
+
end
|
80
|
+
|
81
|
+
def run_container_params(image, env, secrets_file)
|
70
82
|
params = ["run"]
|
71
83
|
params << :detach
|
72
84
|
params += env.map { |k, v| [:e, "#{k}=#{v}"] }
|
@@ -75,11 +87,6 @@ module Floe
|
|
75
87
|
params << [:v, "#{secrets_file}:/run/secrets:z"] if secrets_file
|
76
88
|
params << [:name, container_name(image)]
|
77
89
|
params << image
|
78
|
-
|
79
|
-
logger.debug("Running docker: #{AwesomeSpawn.build_command_line("docker", params)}")
|
80
|
-
|
81
|
-
result = docker!(*params)
|
82
|
-
result.output
|
83
90
|
end
|
84
91
|
|
85
92
|
def inspect_container(container_id)
|
@@ -56,15 +56,16 @@ module Floe
|
|
56
56
|
|
57
57
|
begin
|
58
58
|
create_pod!(name, image, env, secret)
|
59
|
-
|
59
|
+
runner_context
|
60
|
+
rescue Kubeclient::HttpError => err
|
60
61
|
cleanup(runner_context)
|
61
|
-
|
62
|
+
{"Error" => "States.TaskFailed", "Cause" => err.to_s}
|
62
63
|
end
|
63
|
-
|
64
|
-
runner_context
|
65
64
|
end
|
66
65
|
|
67
66
|
def status!(runner_context)
|
67
|
+
return if runner_context.key?("Error")
|
68
|
+
|
68
69
|
runner_context["container_state"] = pod_info(runner_context["container_ref"]).to_h.deep_stringify_keys["status"]
|
69
70
|
end
|
70
71
|
|
@@ -83,13 +84,14 @@ module Floe
|
|
83
84
|
end
|
84
85
|
|
85
86
|
def output(runner_context)
|
86
|
-
runner_context
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
87
|
+
if runner_context.key?("Error")
|
88
|
+
runner_context.slice("Error", "Cause")
|
89
|
+
elsif container_failed?(runner_context)
|
90
|
+
failed_state = failed_container_states(runner_context).first
|
91
|
+
{"Error" => failed_state["reason"], "Cause" => failed_state["message"]}
|
92
|
+
else
|
93
|
+
runner_context["output"] = kubeclient.get_pod_log(runner_context["container_ref"], namespace).body
|
94
|
+
end
|
93
95
|
end
|
94
96
|
|
95
97
|
def cleanup(runner_context)
|
@@ -30,7 +30,7 @@ module Floe
|
|
30
30
|
|
31
31
|
private
|
32
32
|
|
33
|
-
def
|
33
|
+
def run_container_params(image, env, secret)
|
34
34
|
params = ["run"]
|
35
35
|
params << :detach
|
36
36
|
params += env.map { |k, v| [:e, "#{k}=#{v}"] }
|
@@ -39,11 +39,6 @@ module Floe
|
|
39
39
|
params << [:secret, secret] if secret
|
40
40
|
params << [:name, container_name(image)]
|
41
41
|
params << image
|
42
|
-
|
43
|
-
logger.debug("Running podman: #{AwesomeSpawn.build_command_line("podman", params)}")
|
44
|
-
|
45
|
-
result = podman!(*params)
|
46
|
-
result.output
|
47
42
|
end
|
48
43
|
|
49
44
|
def create_secret(secrets)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: floe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ManageIQ Developers
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-11-
|
11
|
+
date: 2023-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awesome_spawn
|