capistrano-nomad 0.10.0 → 0.10.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9993fb04b78b68b03c055faa66454360543c92108f2e410f7156bedf7158f763
4
- data.tar.gz: 20b4708abc11215f259bc46b8b4c7f4f0606fb0d2ff7e3c862c799b850ead5ee
3
+ metadata.gz: 76af53f1a2764deb4b91363674b6627d7b6017a30609e067d42b66cdbd5c9fc0
4
+ data.tar.gz: 64825bb8a9bdccf833f23cb36aeb10cba6f516bbac8e6690193eb1674339fb94
5
5
  SHA512:
6
- metadata.gz: 86d6750e7e181d120db5b56da6c5b7b083310901939e452aee8e7a6de12db22544f2c1accfe8fb9790c75c188644ed0108446a8281875566b0d6243ae8db6191
7
- data.tar.gz: f80d0003e093e3ed5e0fefc69b6b89db158064145c7c21573944b8fc88f8beb40a1cb0b40fbbbb956856bbc637f217a72001c5a1de10ed992ea46e6fd45b8809
6
+ metadata.gz: d359a15febd84d1303360f8d9c51faf026fa6388cf6a8b97edc7fa99cee59007c4999d040935bad0351ad1fa3bc1aca5908819b1cd1fc302d711b09a7d3a42e6
7
+ data.tar.gz: 5bf77756a9d1dc2bc28ded978f0523fff65059932154c1930545dd4b06930012d45ed646108f593802e606559b2aa4c2cae867f2012bef83245308b30d1a52dd
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- capistrano-nomad (0.10.0)
4
+ capistrano-nomad (0.10.1)
5
5
  activesupport (<= 7.0.8)
6
6
  byebug
7
7
  capistrano (~> 3.0)
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "capistrano-nomad"
5
- spec.version = "0.10.0"
5
+ spec.version = "0.10.1"
6
6
  spec.authors = ["James Hu"]
7
7
 
8
8
  spec.summary = "Capistrano plugin for deploying and managing Nomad jobs"
@@ -29,7 +29,7 @@ def capistrano_nomad_ensure_absolute_path(path)
29
29
  path[0] == "/" ? path : "/#{path}"
30
30
  end
31
31
 
32
- def capistrano_nomad_build_file_path(parent_path, basename, kind: nil, namespace: nil)
32
+ def capistrano_nomad_build_file_path(parent_path, basename, kind: nil, namespace: :default)
33
33
  segments = [parent_path]
34
34
 
35
35
  if namespace
@@ -132,7 +132,7 @@ def capistrano_nomad_capture_nomad_command(*args)
132
132
  output
133
133
  end
134
134
 
135
- def capistrano_nomad_find_job_task_details(name, namespace: nil, task: nil)
135
+ def capistrano_nomad_find_job_task_details(name, namespace: :default, task: nil)
136
136
  task = task.presence || name
137
137
 
138
138
  # Find alloc id that contains task
@@ -170,7 +170,7 @@ def capistrano_nomad_find_job_task_details(name, namespace: nil, task: nil)
170
170
  }
171
171
  end
172
172
 
173
- def capistrano_nomad_exec_within_job(name, command, namespace: nil, task: nil)
173
+ def capistrano_nomad_exec_within_job(name, command, namespace: :default, task: nil)
174
174
  capistrano_nomad_run_remotely do
175
175
  if (task_details = capistrano_nomad_find_job_task_details(name, namespace: namespace, task: task))
176
176
  capistrano_nomad_execute_nomad_command(
@@ -246,7 +246,7 @@ def capistrano_nomad_fetch_namespace_options(namespace)
246
246
  fetch(:nomad_namespaces)&.dig(namespace)
247
247
  end
248
248
 
249
- def capistrano_nomad_fetch_job_options(name, *args, namespace: nil)
249
+ def capistrano_nomad_fetch_job_options(name, *args, namespace: :default)
250
250
  fetch(:nomad_jobs).dig(namespace, name.to_sym, *args)
251
251
  end
252
252
 
@@ -254,7 +254,7 @@ def capistrano_nomad_fetch_job_var_files(name, *args)
254
254
  capistrano_nomad_fetch_job_options(name, :var_files, *args) || []
255
255
  end
256
256
 
257
- def capistrano_nomad_fetch_jobs_names_by_namespace(namespace: nil)
257
+ def capistrano_nomad_fetch_jobs_names_by_namespace(namespace: :default)
258
258
  # Can pass tags via command line (e.g. TAG=foo or TAGS=foo,bar)
259
259
  tags =
260
260
  [ENV["TAG"], ENV["TAGS"]].map do |tag_args|
@@ -277,11 +277,11 @@ def capistrano_nomad_fetch_jobs_names_by_namespace(namespace: nil)
277
277
  end
278
278
  end
279
279
 
280
- def capistrano_nomad_fetch_jobs_docker_image_types(names, namespace: nil)
280
+ def capistrano_nomad_fetch_jobs_docker_image_types(names, namespace: :default)
281
281
  names.map { |n| fetch(:nomad_jobs).dig(namespace, n.to_sym, :docker_image_types) }.flatten.compact.uniq
282
282
  end
283
283
 
284
- def capistrano_nomad_define_group_tasks(namespace: nil)
284
+ def capistrano_nomad_define_group_tasks(namespace:)
285
285
  define_tasks = lambda do |nomad_namespace: nil|
286
286
  desc "Build #{nomad_namespace} job Docker images"
287
287
  task :build do
@@ -429,7 +429,7 @@ def capistrano_nomad_plan_jobs(names, *args)
429
429
  end
430
430
  end
431
431
 
432
- def capistrano_nomad_run_jobs(names, namespace: nil, is_detached: true)
432
+ def capistrano_nomad_run_jobs(names, namespace: :default, is_detached: true)
433
433
  names.each do |name|
434
434
  run_options = {
435
435
  namespace: namespace,
@@ -501,7 +501,7 @@ def capistrano_nomad_stop_jobs(names, **options)
501
501
  end
502
502
  end
503
503
 
504
- def capistrano_nomad_purge_jobs(names, namespace: nil, is_detached: true)
504
+ def capistrano_nomad_purge_jobs(names, namespace: :default, is_detached: true)
505
505
  names.each do |name|
506
506
  capistrano_nomad_execute_nomad_command(:stop, { namespace: namespace, purge: true, detach: is_detached }, name)
507
507
  end
@@ -511,7 +511,7 @@ def capistrano_nomad_display_job_status(name, **options)
511
511
  capistrano_nomad_execute_nomad_command(:status, options, name)
512
512
  end
513
513
 
514
- def capistrano_nomad_display_job_logs(name, namespace: nil, **options)
514
+ def capistrano_nomad_display_job_logs(name, namespace: :default, **options)
515
515
  if (task_details = capistrano_nomad_find_job_task_details(name, namespace: namespace, task: ENV["TASK"]))
516
516
  capistrano_nomad_execute_nomad_command(
517
517
  :alloc,
@@ -534,7 +534,7 @@ def capistrano_nomad_tail_job_logs(*args, **options)
534
534
  capistrano_nomad_display_job_logs(*args, **options.merge(tail: true, n: 50))
535
535
  end
536
536
 
537
- def capistrano_nomad_open_job_ui(name, namespace: nil)
537
+ def capistrano_nomad_open_job_ui(name, namespace: :default)
538
538
  run_locally do
539
539
  url = "#{fetch(:nomad_ui_url)}/ui/jobs/#{name}"
540
540
  url += "@#{namespace}" if namespace
@@ -1,6 +1,6 @@
1
1
  namespace :nomad do
2
2
  # Define tasks for all jobs
3
- capistrano_nomad_define_group_tasks
3
+ capistrano_nomad_define_group_tasks(namespace: nil)
4
4
 
5
5
  desc "Create missing and remove unused namespaces"
6
6
  task :modify_namespaces do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-nomad
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Hu