capistrano-nomad 0.10.1 → 0.10.4
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/Gemfile.lock +1 -1
- data/capistrano-nomad.gemspec +1 -1
- data/lib/capistrano/nomad/helpers/dsl.rb +6 -2
- data/lib/capistrano/nomad/helpers/nomad.rb +8 -4
- 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: 44bb762da0b1f230e620bf5dded1c46fb791af7b3fa10bd55b8625bb378acf46
|
4
|
+
data.tar.gz: 3a9d575d16aeacd9cc6ffbd1b7c228eac10e8b158b8606da91afa8d10fe796ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb3ec9b2cb4977a3b0834f8ce7d856efaf74325d5079f086f29b06bb9a4658dfba067e137f32cf362d34884cce1d781ea688e40cb8a58d341c51dba477e23862
|
7
|
+
data.tar.gz: 1e4beb478de4f084f058b295aaeb08bf92cce4a03397ee1cdae2eb447a25c90804ac79baa758199c696a4479da928cfddc24680978854662d9d795315e32e3b3
|
data/Gemfile.lock
CHANGED
data/capistrano-nomad.gemspec
CHANGED
@@ -16,6 +16,8 @@ def nomad_docker_image_type(image_type, attributes = {})
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def nomad_namespace(namespace, **options, &block)
|
19
|
+
raise ArgumentError, "cannot define default nomad namespace" if namespace == :default
|
20
|
+
|
19
21
|
nomad_namespaces = fetch(:nomad_namespaces) || {}
|
20
22
|
nomad_namespaces[namespace] = options
|
21
23
|
set(:nomad_namespaces, nomad_namespaces)
|
@@ -53,7 +55,7 @@ def nomad_job(name, attributes = {})
|
|
53
55
|
|
54
56
|
define_tasks = lambda do |namespace: nil|
|
55
57
|
description_name = ""
|
56
|
-
description_name << "#{namespace}/" if namespace
|
58
|
+
description_name << "#{namespace}/" if namespace != :default
|
57
59
|
description_name << name.to_s
|
58
60
|
|
59
61
|
namespace(name) do
|
@@ -164,8 +166,10 @@ def nomad_job(name, attributes = {})
|
|
164
166
|
end
|
165
167
|
|
166
168
|
namespace(:nomad) do
|
167
|
-
# Define tasks for service
|
168
169
|
if @nomad_namespace
|
170
|
+
# Also define tasks without namespace for default Nomad namespace
|
171
|
+
define_tasks.call(namespace: @nomad_namespace) if @nomad_namespace == :default
|
172
|
+
|
169
173
|
namespace(@nomad_namespace) do
|
170
174
|
define_tasks.call(namespace: @nomad_namespace)
|
171
175
|
end
|
@@ -32,7 +32,7 @@ end
|
|
32
32
|
def capistrano_nomad_build_file_path(parent_path, basename, kind: nil, namespace: :default)
|
33
33
|
segments = [parent_path]
|
34
34
|
|
35
|
-
|
35
|
+
unless namespace == :default
|
36
36
|
case kind
|
37
37
|
|
38
38
|
# Always upload to namespace folder on remote
|
@@ -135,14 +135,18 @@ end
|
|
135
135
|
def capistrano_nomad_find_job_task_details(name, namespace: :default, task: nil)
|
136
136
|
task = task.presence || name
|
137
137
|
|
138
|
-
# Find alloc id that contains task
|
138
|
+
# Find alloc id that contains task that is also running
|
139
139
|
allocs_output = capistrano_nomad_capture_nomad_command(
|
140
140
|
:job,
|
141
141
|
:allocs,
|
142
|
-
{ namespace: namespace, t: "'{{range .}}{{ .ID }},{{ .TaskGroup }}|{{end}}'" },
|
142
|
+
{ namespace: namespace, t: "'{{range .}}{{ .ID }},{{ .ClientStatus }},{{ .TaskGroup }}|{{end}}'" },
|
143
143
|
name,
|
144
144
|
)
|
145
|
-
alloc_id = allocs_output
|
145
|
+
alloc_id = allocs_output
|
146
|
+
.split("|")
|
147
|
+
.map { |s| s.split(",") }
|
148
|
+
.find { |_, s, t| s == "running" && t == task.to_s }
|
149
|
+
&.first
|
146
150
|
|
147
151
|
# Can't continue if we can't choose an alloc id
|
148
152
|
return unless alloc_id
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-nomad
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Hu
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|