capistrano_multiconfig_parallel 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/capistrano_multiconfig_parallel/application.rb +20 -9
- data/lib/capistrano_multiconfig_parallel/base.rb +4 -1
- data/lib/capistrano_multiconfig_parallel/celluloid/bundler_worker.rb +18 -6
- data/lib/capistrano_multiconfig_parallel/celluloid/celluloid_worker.rb +2 -3
- data/lib/capistrano_multiconfig_parallel/helpers/core_helper.rb +1 -1
- data/lib/capistrano_multiconfig_parallel/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2699a6ed6f5e38540aa4bbbfc86c17842febbc9c
|
4
|
+
data.tar.gz: cd6b4acefa3ac596d711b6dab2c450f47f93a8f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9210b7536d87f6d17ba7f0f99a120947728dfd239074d99eb0e46f9a61f8b7c8cd99ae4a2f16f207e138f40a190697d55d2ead9ae595f3050b18398e59524ce4
|
7
|
+
data.tar.gz: ba98002b12565a804aff218cc24cc958a4af662eb86dbe684a1c416bf8032c78bb3544eeaa867a6653310b3604d0b64caea539daf52e8b2a398bdec05fe30948
|
@@ -12,6 +12,7 @@ module CapistranoMulticonfigParallel
|
|
12
12
|
CapistranoMulticonfigParallel.enable_logging
|
13
13
|
@stage_apps = multi_apps? ? app_names_from_stages : []
|
14
14
|
collect_command_line_tasks(CapistranoMulticonfigParallel.original_args)
|
15
|
+
@bundler_workers = []
|
15
16
|
@jobs = []
|
16
17
|
@checked_job_paths = []
|
17
18
|
@patched_job_paths = [] # for deploy
|
@@ -164,6 +165,9 @@ module CapistranoMulticonfigParallel
|
|
164
165
|
else
|
165
166
|
collect_jobs(options)
|
166
167
|
end
|
168
|
+
if configuration.check_app_bundler_dependencies.to_s.downcase == 'true'
|
169
|
+
sleep(0.1) until @jobs.size == @bundler_workers.size
|
170
|
+
end
|
167
171
|
process_jobs
|
168
172
|
end
|
169
173
|
|
@@ -225,21 +229,28 @@ module CapistranoMulticonfigParallel
|
|
225
229
|
path: job_path(options)
|
226
230
|
|
227
231
|
))
|
232
|
+
|
233
|
+
bundler_callback = lambda { |job|
|
234
|
+
raise "Please make sure you have a Gemfile in the project root directory #{job.job_path}" unless job.job_gemfile.present?
|
235
|
+
if job.find_capfile.blank?
|
236
|
+
raise "Please make sure you have a Capfile in the project root directory #{job.job_path}"
|
237
|
+
end
|
238
|
+
unless job.capistrano_sentinel_needs_updating?
|
239
|
+
raise "Please consider upgrading the gem #{job.capistrano_sentinel_name} to version #{job.loaded_capistrano_sentinel_version} from #{job.job_capistrano_sentinel_version} in #{job.job_path} "
|
240
|
+
end
|
241
|
+
job.application.jobs << job unless job.application.job_can_tag_staging?(job)
|
242
|
+
}
|
228
243
|
if configuration.check_app_bundler_dependencies.to_s.downcase == 'true' && job.job_gemfile.present?
|
229
244
|
if !@checked_job_paths.include?(job.job_path)
|
230
245
|
@checked_job_paths << job.job_path
|
231
246
|
bundler_worker = CapistranoMulticonfigParallel::BundlerWorker.new
|
232
|
-
|
247
|
+
@bundler_workers << {job: job, worker: bundler_worker }
|
248
|
+
bundler_worker.work(job, &bundler_callback) # make sure we have installed the dependencies first for this application
|
233
249
|
end
|
250
|
+
else
|
251
|
+
bundler_callback.call(job)
|
234
252
|
end
|
235
|
-
|
236
|
-
if job.find_capfile.blank?
|
237
|
-
raise "Please make sure you have a Capfile in the project root directory #{job.job_path}"
|
238
|
-
end
|
239
|
-
unless job.capistrano_sentinel_needs_updating?
|
240
|
-
raise "Please consider upgrading the gem #{job.capistrano_sentinel_name} to version #{job.loaded_capistrano_sentinel_version} from #{job.job_capistrano_sentinel_version} in #{job.job_path} "
|
241
|
-
end
|
242
|
-
@jobs << job unless job_can_tag_staging?(job)
|
253
|
+
|
243
254
|
end
|
244
255
|
|
245
256
|
def job_can_tag_staging?(job)
|
@@ -4,6 +4,9 @@ module CapistranoMulticonfigParallel
|
|
4
4
|
GITFLOW_CALCULATE_TAG_TASK = 'gitflow:calculate_tag'
|
5
5
|
GITFLOW_VERIFY_UPTODATE_TASK = 'gitflow:verify_up_to_date'
|
6
6
|
|
7
|
+
class TaskFailed < StandardError; end
|
8
|
+
|
9
|
+
|
7
10
|
class << self
|
8
11
|
attr_accessor :logger, :original_args, :config, :config_keys
|
9
12
|
include CapistranoMulticonfigParallel::Configuration
|
@@ -51,7 +54,7 @@ module CapistranoMulticonfigParallel
|
|
51
54
|
Celluloid.logger = logger
|
52
55
|
Celluloid.task_class = defined?(Celluloid::TaskThread) ? Celluloid::TaskThread : Celluloid::Task::Threaded
|
53
56
|
Celluloid.exception_handler do |ex|
|
54
|
-
unless ex.is_a?(Interrupt) || ex.is_a?(SystemExit) || ex.is_a?(CapistranoMulticonfigParallel::
|
57
|
+
unless ex.is_a?(Interrupt) || ex.is_a?(SystemExit) || ex.is_a?(CapistranoMulticonfigParallel::TaskFailed)
|
55
58
|
rescue_error(ex, 'stderr')
|
56
59
|
end
|
57
60
|
end
|
@@ -15,7 +15,7 @@ module CapistranoMulticonfigParallel
|
|
15
15
|
:show_bundler
|
16
16
|
]
|
17
17
|
|
18
|
-
def work(job)
|
18
|
+
def work(job, &callback)
|
19
19
|
@job = job
|
20
20
|
@job_id = job.id
|
21
21
|
@runner_status = nil
|
@@ -24,7 +24,7 @@ module CapistranoMulticonfigParallel
|
|
24
24
|
@total_dependencies = bundler_dependencies.size
|
25
25
|
@show_bundler = true
|
26
26
|
progress_bar
|
27
|
-
check_missing_deps
|
27
|
+
async.check_missing_deps
|
28
28
|
end
|
29
29
|
|
30
30
|
def progress_bar
|
@@ -41,7 +41,10 @@ module CapistranoMulticonfigParallel
|
|
41
41
|
def show_bundler_progress(data)
|
42
42
|
@show_bundler = false if data.to_s.include?("The Gemfile's dependencies are satisfied") || data.to_s.include?("Bundle complete")
|
43
43
|
gem_spec = bundler_dependencies.find{|spec| data.include?(spec.name) }
|
44
|
-
if
|
44
|
+
if data.include?("Error") && @show_bundler == true && gem_spec.present?
|
45
|
+
error_message = "Bundler worker #{@job_id} task failed for #{gem_spec.inspect}"
|
46
|
+
raise(CapistranoMulticonfigParallel::TaskFailed.new(error_message), error_message)
|
47
|
+
elsif @show_bundler == true && gem_spec.present?
|
45
48
|
@checked_bundler_deps = [gem_spec.name]
|
46
49
|
progress_bar.increment
|
47
50
|
elsif @show_bundler == false
|
@@ -57,11 +60,20 @@ module CapistranoMulticonfigParallel
|
|
57
60
|
|
58
61
|
def do_bundle_sync_command(command)
|
59
62
|
process_runner = CapistranoMulticonfigParallel::ProcessRunner.new
|
60
|
-
process_runner.work(@job, command, process_sync: :
|
61
|
-
sleep(0.1) until @runner_status.present?
|
62
|
-
@runner_status.output_text
|
63
|
+
process_runner.work(@job, command, process_sync: :async, actor: Actor.current, log_prefix: @log_prefix, runner_status_klass: CapistranoMulticonfigParallel::BundlerStatus)
|
63
64
|
end
|
64
65
|
|
66
|
+
def notify_finished(exit_status, runner_status)
|
67
|
+
@runner_status = runner_status
|
68
|
+
@exit_status = exit_status
|
69
|
+
progress_bar.finish
|
70
|
+
if exit_status == 0
|
71
|
+
callback.call(@job)
|
72
|
+
else
|
73
|
+
error_message = "Bundler worker #{@job_id} task failed with exit status #{exit_status.inspect}"
|
74
|
+
raise(CapistranoMulticonfigParallel::TaskFailed.new(error_message), error_message)
|
75
|
+
end
|
76
|
+
end
|
65
77
|
|
66
78
|
end
|
67
79
|
end
|
@@ -19,7 +19,6 @@ module CapistranoMulticonfigParallel
|
|
19
19
|
#
|
20
20
|
class CelluloidWorker
|
21
21
|
include CapistranoMulticonfigParallel::BaseActorHelper
|
22
|
-
class TaskFailed < StandardError; end
|
23
22
|
|
24
23
|
|
25
24
|
ATTRIBUTE_LIST = [
|
@@ -170,7 +169,7 @@ module CapistranoMulticonfigParallel
|
|
170
169
|
log_to_file("worker #{@job_id} triest to transition from #{@machine.state} to #{name}") unless options[:bundler]
|
171
170
|
@machine.go_to_transition(name.to_s, options)
|
172
171
|
error_message = "worker #{@job_id} task #{name} failed "
|
173
|
-
raise(CapistranoMulticonfigParallel::
|
172
|
+
raise(CapistranoMulticonfigParallel::TaskFailed.new(error_message), error_message) if job.failed? # force worker to rollback
|
174
173
|
end
|
175
174
|
|
176
175
|
def send_msg(channel, message = nil)
|
@@ -193,7 +192,7 @@ module CapistranoMulticonfigParallel
|
|
193
192
|
finish_worker(exit_status)
|
194
193
|
return if exit_status == 0
|
195
194
|
error_message = "worker #{@job_id} task failed with exit status #{exit_status.inspect} "
|
196
|
-
raise(CapistranoMulticonfigParallel::
|
195
|
+
raise(CapistranoMulticonfigParallel::TaskFailed.new(error_message), error_message)
|
197
196
|
end
|
198
197
|
|
199
198
|
# def inspect
|
@@ -49,7 +49,7 @@ module CapistranoMulticonfigParallel
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def error_filtered?(error)
|
52
|
-
[CapistranoMulticonfigParallel::
|
52
|
+
[CapistranoMulticonfigParallel::TaskFailed, SystemExit].find { |class_name| error.is_a?(class_name) }.present?
|
53
53
|
end
|
54
54
|
|
55
55
|
def development_debug?
|