capistrano-nomad 0.6.3 → 0.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +6 -0
- data/capistrano-nomad.gemspec +1 -1
- data/lib/capistrano/nomad/helpers/nomad.rb +2 -2
- data/lib/capistrano/nomad/tasks/nomad.rake +19 -0
- 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: 707ded6b01d5903708a362ef6e98f3c56d5e52fd1557bfad47f1844cb7d6c96e
|
4
|
+
data.tar.gz: 68ea61e7025400e99c97683b8f3390357a0f04cf5b173846bba378d8bdd5fa3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19a5ee3bcddf663ed3820245f10d0c35dee3cf2d1659b44f61947696c7ea24c263696c3c25d6dba032d14293706f0b9b68ee3e9cdbd41b66309e43eb92a0e297
|
7
|
+
data.tar.gz: b20019a85564cc4eee312bfaa17934becab4b73c2505c7a0b9511b1759b320c56fda3656b7f2b80b3cd090e347f05f5c0a2ef3e283a078850636c37ea58f20fb
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -90,6 +90,12 @@ cap production nomad:app:console TASK=custom-task-name
|
|
90
90
|
cap production nomad:analytics:grafana:console
|
91
91
|
```
|
92
92
|
|
93
|
+
Create missing and delete unused namespaces
|
94
|
+
|
95
|
+
```shell
|
96
|
+
cap production nomad:all:replace_namespaces
|
97
|
+
```
|
98
|
+
|
93
99
|
## Development
|
94
100
|
|
95
101
|
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/capistrano-nomad.gemspec
CHANGED
@@ -116,7 +116,7 @@ end
|
|
116
116
|
def capistrano_nomad_capture_nomad_command(*args)
|
117
117
|
output = nil
|
118
118
|
|
119
|
-
on(roles(:manager)) do |
|
119
|
+
on(roles(:manager)) do |_host|
|
120
120
|
output = capistrano_nomad_run_nomad_command(:capture, *args)
|
121
121
|
end
|
122
122
|
|
@@ -125,7 +125,7 @@ end
|
|
125
125
|
|
126
126
|
def capistrano_nomad_exec_within_job(name, command, namespace: nil, task: nil)
|
127
127
|
on(roles(:manager)) do
|
128
|
-
task
|
128
|
+
task ||= name
|
129
129
|
|
130
130
|
# Find alloc id that contains task
|
131
131
|
output = capistrano_nomad_capture_nomad_command(
|
@@ -53,6 +53,25 @@ namespace :nomad do
|
|
53
53
|
capistrano_nomad_purge_jobs(names, namespace: namespace)
|
54
54
|
end
|
55
55
|
end
|
56
|
+
|
57
|
+
desc "Create missing and remove unused namespaces"
|
58
|
+
task :replace_namespaces do
|
59
|
+
output = capistrano_nomad_capture_nomad_command(:namespace, :list, t: "'{{range .}}{{ .Name }}|{{end}}'")
|
60
|
+
current_namespaces = output.split("|").compact.map(&:to_sym)
|
61
|
+
desired_namespaces = fetch(:nomad_jobs).keys
|
62
|
+
missing_namespaces = desired_namespaces - current_namespaces
|
63
|
+
unused_namespaces = current_namespaces - desired_namespaces
|
64
|
+
|
65
|
+
# Remove unused namespaces
|
66
|
+
unused_namespaces.each do |namespace|
|
67
|
+
capistrano_nomad_execute_nomad_command(:namespace, :delete, namespace)
|
68
|
+
end
|
69
|
+
|
70
|
+
# Create missing namespaces
|
71
|
+
missing_namespaces.each do |namespace|
|
72
|
+
capistrano_nomad_execute_nomad_command(:namespace, :apply, namespace)
|
73
|
+
end
|
74
|
+
end
|
56
75
|
end
|
57
76
|
|
58
77
|
namespace :docker_images do
|
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.6.
|
4
|
+
version: 0.6.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: 2023-
|
11
|
+
date: 2023-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|