[why]
for commit c725e0f022b7:
def each_jobs(&block)
each_job_init
- load_hosts_config
job = deepcopy(@job)
@job2 = {}
load_defaults
+ load_hosts_config
each_job_init
each_job(&block)
@jobs.each do |hash|
1. it exec load_defaults first, so it not load hosts file when start
exec load_defaults. load_defaults call expand_params, expand_params
maybe expand host params, but do not have load hosts file,
load_one_defaults can load host file, so exec load_one_defaults in advance.
2. load_one_defaults(file, @job) use @job is because load_hosts_file
is add host config to @job, so it should be executed before
"job=deepcopy(@job)"
Signed-off-by: Wei Jihui <weijihuiall(a)163.com>
---
lib/job.rb | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/job.rb b/lib/job.rb
index 14946f47..27c4bd93 100755
--- a/lib/job.rb
+++ b/lib/job.rb
@@ -400,6 +400,11 @@ class Job
@file_loaded ||= {}
end
+ Dir.glob(["/etc/compass-ci/defaults/*.yaml",
+ "#{ENV['HOME']}/.config/compass-ci/defaults/*.yaml"]).each do |file|
+ load_one_defaults(file, @job)
+ end
+
i = include_files
job = deepcopy(@job)
revise_hash(job, deepcopy(@job2), true)
@@ -418,11 +423,6 @@ class Job
end
@jobx = nil
- Dir.glob(["/etc/compass-ci/defaults/*.yaml",
- "#{ENV['HOME']}/.config/compass-ci/defaults/*.yaml"]).each do |file|
- load_one_defaults(file, job)
- end
-
for_each_in(job, i.keys) do |_pk, _h, k, v|
job['___'] = v
--
2.23.0