capistrano-nomad 0.9.1 → 0.9.2

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: e70ce696bab8b3ef8545e9f4eff59e12aa8c39a9705da8ba92a9ae0516b2534b
4
- data.tar.gz: 8053ced9f62a0d56046cc7162f5efd20ddd9ab20e0d22a23b9e237a84db5f605
3
+ metadata.gz: '064875b4478852c18387c8084ff4b0e5c2cb4e9377a6854724f46119b416ecf5'
4
+ data.tar.gz: 15069bfd33db0a2b497a7e6a1adf816669df6ba0b508364fb8a26728e46ae329
5
5
  SHA512:
6
- metadata.gz: f861c87b67f797851738b1e0a29cab2286489b6067029f9314d55a2099e9e1751bd2e0f8df3ba3ba190545ddffecbe38e086515a2a520d7f39b5900299c783d3
7
- data.tar.gz: 62817162ccf5ed2e0c72464e5846bfcb3474964f9a3d3339565c66f58d154c53483341e955e067458398ac69c61aeeb8f698157b114c9802338468bf43d1c950
6
+ metadata.gz: eff94039fa9b7c506fbe139670639d326423c409813c4a10c97c15e79256f4bc5f65a181a2d8608af9bdd0aa51aeaeb999ad27e02836b2af8815b961999f8470
7
+ data.tar.gz: 255c76c93ba40a4fd35206b31d511a7a42e2954c4e4f072154effe68643e66a938fd0aacd3f029e7e5cfa37f13f82cb924606ab4bc2fc61be92234c5e3d7428d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- capistrano-nomad (0.9.1)
4
+ capistrano-nomad (0.9.2)
5
5
  activesupport (<= 7.0.8)
6
6
  byebug
7
7
  capistrano (~> 3.0)
data/README.md CHANGED
@@ -102,11 +102,14 @@ nomad_job :backend, docker_image_types: [:backend], var_files: [:rails]
102
102
  nomad_job :frontend
103
103
  nomad_job :postgres, docker_image_types: [:postgres]
104
104
  nomad_job :redis, docker_image_types: [:redis], tags: [:redis]
105
- nomad_job :"traefik-default", template: :traefik, erb_vars: { role: :default }, tags: [:traefik]
106
- nomad_job :"traefik-secondary", template: :traefik, erb_vars: { role: :secondary }, tags: [:traefik]
107
- nomad_job :"traefik-tertiary", template: :traefik, erb_vars: { role: :secondary }, tags: [:traefik]
108
-
109
- nomad_namespace :analytics do
105
+ nomad_job :"traefik-default", template: :admin,
106
+ erb_vars: { role: :default },
107
+ tags: [:traefik]
108
+ nomad_job :"traefik-secondary", template: :admin,
109
+ erb_vars: { role: :secondary },
110
+ tags: [:traefik]
111
+
112
+ nomad_namespace :analytics, tags: [:admin] do
110
113
  nomad_job :grafana
111
114
  end
112
115
 
@@ -137,9 +140,9 @@ Tasks can go by namespace or `all` namespaces, and can also be filtered by tags
137
140
  cap production nomad:analytics:deploy
138
141
  cap production nomad:analytics:upload_run
139
142
  cap production nomad:all:deploy
140
- cap production nomad:all:deploy TAG=traefik
143
+ cap production nomad:all:deploy TAG=admin
141
144
  cap production nomad:all:upload_run
142
- cap production nomad:all:upload_run TAGS=traefik,redis
145
+ cap production nomad:all:upload_run TAGS=admin,redis
143
146
  ```
144
147
 
145
148
  Open console
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "capistrano-nomad"
5
- spec.version = "0.9.1"
5
+ spec.version = "0.9.2"
6
6
  spec.authors = ["James Hu"]
7
7
 
8
8
  spec.summary = "Capistrano plugin for deploying and managing Nomad jobs"
@@ -36,6 +36,13 @@ def nomad_namespace(namespace, **options, &block)
36
36
  end
37
37
 
38
38
  def nomad_job(name, attributes = {})
39
+ attributes[:tags] ||= []
40
+
41
+ # Tags added to namespace should be added to all jobs within
42
+ if (nomad_namespace_options = capistrano_nomad_fetch_namespace_options(@nomad_namespace))
43
+ attributes[:tags] += nomad_namespace_options[:tags] || []
44
+ end
45
+
39
46
  nomad_jobs = fetch(:nomad_jobs) || Hash.new { |h, n| h[n] = {} }
40
47
  nomad_jobs[@nomad_namespace][name] = attributes
41
48
 
@@ -243,7 +243,7 @@ def capistrano_nomad_upload(local_path:, remote_path:, erb_vars: {})
243
243
  end
244
244
 
245
245
  def capistrano_nomad_fetch_namespace_options(namespace)
246
- fetch(:nomad_namespaces).dig(namespace)
246
+ fetch(:nomad_namespaces)&.dig(namespace)
247
247
  end
248
248
 
249
249
  def capistrano_nomad_fetch_job_options(name, *args, namespace: nil)
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.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Hu