Before:
Search account info from ES.
After:
Use secrets field to get the my_token.
Signed-off-by: Cao Xueliang <caoxl78320(a)163.com>
---
src/delimiter.rb | 8 ++++++++
src/delimiter/utils.rb | 18 ++++--------------
2 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/src/delimiter.rb b/src/delimiter.rb
index 1ea5de5..cb43cb4 100644
--- a/src/delimiter.rb
+++ b/src/delimiter.rb
@@ -5,8 +5,16 @@
require_relative './delimiter/delimiter'
require_relative '../lib/config_account'
+def config_secrets_yaml
+ account = YAML.load_file "#{ENV['HOME']}/.config/compass-ci/defaults/account.yaml"
+ lab = YAML.load_file "#{ENV['HOME']}/.config/compass-ci/include/lab/#{account['lab']}.yaml"
+ secrets = Hash["secrets" => lab]
+ File.open("#{ENV['HOME']}/.config/compass-ci/defaults/secrets.yaml", "w") { |f| YAML.dump(secrets, f) }
+end
+
begin
config_yaml('delimiter')
+ config_secrets_yaml
delimiter = Delimiter.new
delimiter.start_delimit
rescue StandardError => e
diff --git a/src/delimiter/utils.rb b/src/delimiter/utils.rb
index 0930dd7..dbc42ef 100644
--- a/src/delimiter/utils.rb
+++ b/src/delimiter/utils.rb
@@ -125,30 +125,20 @@ module Utils
File.open(commit_jobs, 'a+') { |f| f.puts content }
end
- def get_account_info
- ESQuery.new(index: 'accounts').query_by_id(DELIMITER_EMAIL)
- end
-
def init_job_content(job_id)
job_yaml = AssistResult.new.get_job_yaml(job_id)
raise "get job yaml failed, job id: #{job_id}" unless job_yaml
job = JSON.parse job_yaml
-
- account_info = get_account_info
- raise "query delimiter account info failed: #{DELIMITER_EMAIL}" unless account_info
-
record_jobs(job['id'], job['upstream_commit'])
job['suite'] = 'bisect'
- job['my_name'] = account_info['my_name']
- job['my_email'] = account_info['my_email']
- job['my_token'] = account_info['my_token']
+ job['my_name'] = ENV['my_name']
+ job['my_email'] = ENV['my_email']
+ job['my_token'] = ENV['secrets_my_token']
job['bad_job_id'] = job_id
+ job['queue'] = "#{job['testbox'].split('.')[0]}-bisect"
- job.delete('tboxgroup')
- job.delete('subqueue')
- job.delete('queue')
job.delete('id')
return job
--
2.23.0