capistrano-nomad 0.12.2 → 0.13.0

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: 9ea1dce7c57651a12a7f34dae3d0451cb964500b28c5356b12fbe552b7811f0a
4
- data.tar.gz: 3f4a63bb2294ad4928faecd28f1bd0003d0f09b249ccf2649e5228918e562904
3
+ metadata.gz: 3e7e38b148a42c46f1dcb205584740556e289d962964e1e48c767f1dd67e1366
4
+ data.tar.gz: 015bb5b73e8e3d20f0ad79eb4275d7f99cb6bcfe3fd2121ec9cfb43b264325c0
5
5
  SHA512:
6
- metadata.gz: 168ea50bf0399fa51a796362555a2a29ebe0637f2d7896c2a1f1a83b451fd5d6b35eebb29907b9f6a80c675305ffd319a8acbcab28b5ffc2002c940dc49c1d31
7
- data.tar.gz: 0e7eed0ef654d2b945d9d2dd7b7089918aebaac61e3d71b9e8210a8f5038e5cf3baf938c849746da06f80dc97b32f6f0d1fc17cefa697d639221be137fef229c
6
+ metadata.gz: 1f1872dfe2feaf419611b6a7f5b5063d24101b97755b5b46d28377aa86101b686d5f497c7bdca9c9fabcdcb41313474acdb0c0f40f5d91073cc581e99170d069
7
+ data.tar.gz: 7683489fae1bafb6cb6b7b982a0ac32941923551949666d89be5bccdfad22ea20d176d1ca8ea95cb1482ccca1c0dcd5e2f1b1208613fa8a11f0a3cdb44af3cbf
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.13.0]
4
+
5
+ - Support for `NOMAD_TOKEN` environment variable authentication via `:nomad_token` configuration option
6
+
3
7
  ## [0.1.0] - 2023-09-09
4
8
 
5
9
  - Initial release
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- capistrano-nomad (0.12.2)
4
+ capistrano-nomad (0.13.0)
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
 
@@ -99,7 +102,7 @@ nomad_docker_image_type :restic,
99
102
 
100
103
  # Jobs
101
104
  nomad_job :backend, docker_image_types: [:backend], var_files: [:rails]
102
- nomad_job :frontend
105
+ nomad_job :frontend, console_command: "/bin/bash"
103
106
  nomad_job :postgres, docker_image_types: [:postgres]
104
107
  nomad_job :redis, docker_image_types: [:redis], tags: [:redis]
105
108
  nomad_job :"traefik-default", template: :admin,
@@ -150,7 +153,7 @@ Open console
150
153
  ```shell
151
154
  cap production nomad:app:console
152
155
  cap production nomad:app:console TASK=custom-task-name
153
- cap production nomad:analytics:grafana:console
156
+ cap production nomad:analytics:grafana:console CMD=/bin/bash
154
157
  ```
155
158
 
156
159
  Display logs
@@ -182,6 +185,12 @@ Create missing and delete unused namespaces
182
185
  cap production nomad:modify_namespaces
183
186
  ```
184
187
 
188
+ Show version
189
+
190
+ ```shell
191
+ cap production nomad:version
192
+ ```
193
+
185
194
  ## Development
186
195
 
187
196
  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.2"
5
+ spec.version = "0.13.0"
6
6
  spec.authors = ["James Hu"]
7
7
 
8
8
  spec.summary = "Capistrano plugin for deploying and managing Nomad jobs"
@@ -141,7 +141,8 @@ def nomad_job(name, attributes = {})
141
141
 
142
142
  desc("Open console to #{description_name} job. Specify task with TASK, command with CMD")
143
143
  task(:console) do
144
- command = ENV["CMD"].presence || "/bin/sh"
144
+ job_options = capistrano_nomad_fetch_job_options(name, namespace: namespace)
145
+ command = ENV["COMMAND"].presence || ENV["CMD"].presence || job_options[:console_command] || "/bin/sh"
145
146
 
146
147
  capistrano_nomad_exec_within_job(name, command, namespace: namespace, task: ENV["TASK"])
147
148
  end
@@ -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)
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.2
4
+ version: 0.13.0
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-14 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