capistrano-nomad 0.4.0 → 0.4.2
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 +9 -1
- data/capistrano-nomad.gemspec +1 -1
- data/lib/capistrano/nomad/helpers/docker.rb +3 -9
- data/lib/capistrano/nomad/helpers/dsl.rb +2 -2
- data/lib/capistrano/nomad/helpers/git.rb +2 -2
- data/lib/capistrano/nomad/helpers/nomad.rb +9 -3
- data/lib/capistrano/nomad/scm/git_local.rb +1 -1
- 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: 02c77eac2e5164a6644400d4eca6b03b57dffac252ad90d224f3b2c184bbda6c
|
4
|
+
data.tar.gz: da268efd0e1118b5fab7b1190469b3b3154221dfedf641a4f2fd41b416f9cb94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5b1c53a098c84fa455ed9774376fe646a154436e96d2807050b0cb510484073d7993040571ba231f547478e4a43ee3f105690d7899f8f6a38dac3992567e88f
|
7
|
+
data.tar.gz: a3936fbea10215f136ef8630d5ca0d8253991af7bf16d02b5a7d1615eeaaa11fc6ed38376608a0cfe21b301d34d245196adb5941749fad885f2d574bbd2f523d
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -42,7 +42,7 @@ nomad_namespace :analytics do
|
|
42
42
|
end
|
43
43
|
```
|
44
44
|
|
45
|
-
|
45
|
+
Deploy with
|
46
46
|
|
47
47
|
```shell
|
48
48
|
cap production nomad:app:deploy
|
@@ -50,6 +50,14 @@ cap production nomad:redis:purge
|
|
50
50
|
cap production nomad:analytics:grafana:deploy
|
51
51
|
```
|
52
52
|
|
53
|
+
Open console with
|
54
|
+
|
55
|
+
```shell
|
56
|
+
cap production nomad:app:console
|
57
|
+
cap production nomad:app:console TASK=custom-task-name
|
58
|
+
cap production nomad:analytics:grafana:console
|
59
|
+
```
|
60
|
+
|
53
61
|
## Development
|
54
62
|
|
55
63
|
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
@@ -76,19 +76,13 @@ def capistrano_nomad_build_docker_image_for_type(image_type)
|
|
76
76
|
"--platform linux/amd64",
|
77
77
|
]
|
78
78
|
|
79
|
-
build_args =
|
80
|
-
if attributes[:build_args].is_a?(Proc)
|
81
|
-
proc_args = attributes[:build_args].arity == 1 ? [capistrano_nomad_fetch_git_commit_id] : []
|
82
|
-
|
83
|
-
attributes[:build_args].call(*proc_args)
|
84
|
-
else
|
85
|
-
attributes[:build_args]
|
86
|
-
end
|
87
|
-
|
88
79
|
if (target = attributes[:target])
|
89
80
|
args << "--target #{target}"
|
90
81
|
end
|
91
82
|
|
83
|
+
build_args = attributes[:build_args]
|
84
|
+
build_args = build_args.call if build_args&.is_a?(Proc)
|
85
|
+
|
92
86
|
(build_args || []).each do |key, value|
|
93
87
|
args << "--build-arg #{key}=#{value}"
|
94
88
|
end
|
@@ -107,9 +107,9 @@ def nomad_job(name, attributes = {})
|
|
107
107
|
end
|
108
108
|
end
|
109
109
|
|
110
|
-
desc "Open console to #{description_name} job"
|
110
|
+
desc "Open console to #{description_name} job. Specify task by passing TASK environment variable"
|
111
111
|
task :console do
|
112
|
-
capistrano_nomad_exec_within_job(name, "/bin/bash", namespace: namespace)
|
112
|
+
capistrano_nomad_exec_within_job(name, "/bin/bash", namespace: namespace, task: ENV["TASK"].presence)
|
113
113
|
end
|
114
114
|
end
|
115
115
|
end
|
@@ -4,6 +4,6 @@ def capistrano_nomad_git
|
|
4
4
|
@capistrano_nomad_git ||= Git.open(".")
|
5
5
|
end
|
6
6
|
|
7
|
-
def
|
8
|
-
capistrano_nomad_git.log.first.sha
|
7
|
+
def capistrano_nomad_git_commit_id
|
8
|
+
@capistrano_nomad_git_commit_id ||= capistrano_nomad_git.log.first.sha
|
9
9
|
end
|
@@ -105,8 +105,14 @@ def capistrano_nomad_execute_nomad_command(*args)
|
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
108
|
-
def capistrano_nomad_exec_within_job(name, command, namespace: nil)
|
109
|
-
capistrano_nomad_execute_nomad_command(
|
108
|
+
def capistrano_nomad_exec_within_job(name, command, namespace: nil, task: nil)
|
109
|
+
capistrano_nomad_execute_nomad_command(
|
110
|
+
:alloc,
|
111
|
+
:exec,
|
112
|
+
{ namespace: namespace, task: task || name, job: true },
|
113
|
+
name,
|
114
|
+
command,
|
115
|
+
)
|
110
116
|
end
|
111
117
|
|
112
118
|
def capistrano_nomad_upload_file(local_path:, remote_path:, erb_vars: {})
|
@@ -122,7 +128,7 @@ def capistrano_nomad_upload_file(local_path:, remote_path:, erb_vars: {})
|
|
122
128
|
erb = ERB.new(File.open(local_path).read, trim_mode: "-")
|
123
129
|
|
124
130
|
final_erb_vars = {
|
125
|
-
git_commit_id: fetch(:current_revision) ||
|
131
|
+
git_commit_id: fetch(:current_revision) || capistrano_nomad_git_commit_id,
|
126
132
|
docker_image_types: docker_image_types,
|
127
133
|
}
|
128
134
|
|
@@ -6,7 +6,7 @@ class Capistrano::SCM::GitLocal < Capistrano::SCM::Plugin
|
|
6
6
|
namespace :git_local do
|
7
7
|
task :set_current_revision do
|
8
8
|
on release_roles :manager do
|
9
|
-
set :current_revision,
|
9
|
+
set :current_revision, capistrano_nomad_git_commit_id
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
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.4.
|
4
|
+
version: 0.4.2
|
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-10-
|
11
|
+
date: 2023-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|