capistrano-nomad 0.12.3 → 0.13.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: 89b75d3c252d55a0e4c8f9ffcca21f49092bbdbd35a0bdb4c7f382b8a6a2e9f0
4
- data.tar.gz: 753c67433f965fb35550c8c61e0bf3102b20bf29aba48de00757a19068310aae
3
+ metadata.gz: d6c0aa853bd7a0975c5c8e83471539df99720c0cd444a69982ac33ac2dcac8d6
4
+ data.tar.gz: cbd4c9689e2dce072d016cf2b06f33677a975205a532c7a823453d87290351aa
5
5
  SHA512:
6
- metadata.gz: dc425ee048f8c90dc9fe962815689eafc8edce97ae3523c3c53586f377825cd660cd15e68a35d343c51f520502f3f93a2880570dd8f9c2c46f1f99c96634db9d
7
- data.tar.gz: 4ddf88946fd7dbbde8fcd9e3420c2b044957e1d9a16d353e29ea3050108ce1db648a918ec588a5c3af1c6f33bd749124b1ad7c9416db12317569281a74d4825d
6
+ metadata.gz: 1e70086e37b646337b16d9fb52a26df4535de60bce269ce079c24ff166b2d230a0e271d37c119af909bc7c76cb2450952bc821701eda0888442e56d257d5c54f
7
+ data.tar.gz: c1bad508f6ed7172b406d9cc77abe4340f1d5013d08407db68c625e331c94d81e86ee20f798742db1b83796873099bfaf5fba08440a23988c7a0cce603027612
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.13.1]
4
+
5
+ - Support for starting jobs (e.g. `cap production nomad:app:start`)
6
+
7
+ ## [0.13.0]
8
+
9
+ - Support for `NOMAD_TOKEN` environment variable authentication via `:nomad_token` configuration option
10
+
3
11
  ## [0.1.0] - 2023-09-09
4
12
 
5
13
  - Initial release
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- capistrano-nomad (0.12.3)
4
+ capistrano-nomad (0.13.1)
5
5
  activesupport (<= 7.0.8)
6
6
  byebug
7
7
  capistrano (~> 3.0)
data/README.md CHANGED
@@ -37,6 +37,9 @@ Within `deploy.rb`
37
37
  set :nomad_jobs_path, "nomad/jobs"
38
38
  set :nomad_var_files_path, "nomad/vars"
39
39
 
40
+ # Set token
41
+ set :nomad_token, "abc123"
42
+
40
43
  # Determines base URL to use when opening job in web UI
41
44
  set :nomad_ui_url, "http://localhost:4646"
42
45
 
@@ -128,6 +131,7 @@ cap production nomad:analytics:grafana:deploy
128
131
  Manage jobs
129
132
 
130
133
  ```shell
134
+ cap production nomad:app:start
131
135
  cap production nomad:app:stop
132
136
  cap production nomad:redis:purge
133
137
  cap production nomad:analytics:grafana:restart
@@ -182,6 +186,12 @@ Create missing and delete unused namespaces
182
186
  cap production nomad:modify_namespaces
183
187
  ```
184
188
 
189
+ Show version
190
+
191
+ ```shell
192
+ cap production nomad:version
193
+ ```
194
+
185
195
  ## Development
186
196
 
187
197
  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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "capistrano-nomad"
5
- spec.version = "0.12.3"
5
+ spec.version = "0.13.1"
6
6
  spec.authors = ["James Hu"]
7
7
 
8
8
  spec.summary = "Capistrano plugin for deploying and managing Nomad jobs"
@@ -112,8 +112,17 @@ def capistrano_nomad_run_nomad_command(kind, *args)
112
112
  end
113
113
  end
114
114
 
115
- # Ignore errors
116
- public_send(kind, :nomad, *converted_args, raise_on_non_zero_exit: false)
115
+ env_vars = {}
116
+
117
+ # Pass Nomad token as environment variable if set
118
+ if (nomad_token = fetch(:nomad_token))
119
+ env_vars[:nomad_token] = nomad_token
120
+ end
121
+
122
+ with(env_vars) do
123
+ # Ignore errors
124
+ public_send(kind, :nomad, *converted_args, raise_on_non_zero_exit: false)
125
+ end
117
126
  end
118
127
 
119
128
  def capistrano_nomad_execute_nomad_command(*args, **options)
@@ -375,6 +384,13 @@ def capistrano_nomad_define_group_tasks(namespace:)
375
384
  end
376
385
  end
377
386
 
387
+ desc("Start #{nomad_namespace} jobs")
388
+ task(:start) do
389
+ capistrano_nomad_fetch_jobs_names_by_namespace(namespace: nomad_namespace).each do |jobs_namespace, names|
390
+ capistrano_nomad_start_jobs(names, namespace: jobs_namespace)
391
+ end
392
+ end
393
+
378
394
  desc("Stop #{nomad_namespace} jobs")
379
395
  task(:stop) do
380
396
  capistrano_nomad_fetch_jobs_names_by_namespace(namespace: nomad_namespace).each do |jobs_namespace, names|
@@ -530,6 +546,14 @@ def capistrano_nomad_restart_jobs(names, **options)
530
546
  end
531
547
  end
532
548
 
549
+ def capistrano_nomad_start_jobs(names, **options)
550
+ capistrano_nomad_ensure_options!(options)
551
+
552
+ names.each do |name|
553
+ capistrano_nomad_execute_nomad_command(:job, :start, options, name)
554
+ end
555
+ end
556
+
533
557
  def capistrano_nomad_stop_jobs(names, **options)
534
558
  capistrano_nomad_ensure_options!(options)
535
559
 
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.12.3
4
+ version: 0.13.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Hu
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-03-15 00:00:00.000000000 Z
11
+ date: 2025-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport