[Why] split compass-ci/container/srv-http to 6 service pre dir pre service with a port
[How] SRV_HTTP_PORT => SRV_HTTP_RESULT_HOST/PORT, user: compass-ci/lib/mail_job_result.rb compass-ci/container/extract-stats SRV_HTTP_OS_HOST/PORT, user: compass-ci/sbin/download-rootfs SRV_HTTP_GIT_HOST/PORT, user: compass-ci/lib/mail_bisect_result.rb SRV_HTTP_CCI_HOST/PORT, user: compass-ci/lib/compass-ci/src/scheduler/find_job_boot.cr compass-ci/providers/lib/domain.rb add them(HOST/PORT) to: compass-ci/lib/constants.rb compass-ci/sparrow/3-code/dev-env
Signed-off-by: Lu Weitao luweitaobe@163.com --- container/extract-stats/start | 12 ++++++------ container/scheduler/start | 6 +++--- lib/constants.rb | 8 ++++++-- lib/mail_job_result.rb | 2 +- providers/lib/domain.rb | 4 ++-- sbin/download-rootfs | 2 +- sparrow/3-code/dev-env | 24 ++++++++++++++++++------ src/scheduler/constants.cr | 4 ++-- src/scheduler/find_job_boot.cr | 4 ++-- 9 files changed, 41 insertions(+), 25 deletions(-)
diff --git a/container/extract-stats/start b/container/extract-stats/start index c158977..5033754 100755 --- a/container/extract-stats/start +++ b/container/extract-stats/start @@ -14,8 +14,8 @@ names = Set.new %w[ ES_PORT SEND_MAIL_HOST SEND_MAIL_PORT - SRV_HTTP_HOST - SRV_HTTP_PORT + SRV_HTTP_RESULT_HOST + SRV_HTTP_RESULT_PORT lab ]
@@ -24,8 +24,8 @@ env = docker_env(defaults)
DEFAULT_LKP = '/c/lkp-tests' DEFAULT_CCI = '/c/compass-ci' -SRV_HTTP_HOST = defaults['SRV_HTTP_HOST'] || Open3.capture3('curl ip.sb')[0].chomp -SRV_HTTP_PORT = defaults['SRV_HTTP_PORT'] || '11300' +SRV_HTTP_RESULT_HOST = defaults['SRV_HTTP_RESULT_HOST'] || Open3.capture3('curl ip.sb')[0].chomp +SRV_HTTP_RESULT_PORT = defaults['SRV_HTTP_RESULT_PORT'] || '11300' docker_rm "extract-stats"
cmd = %w[ @@ -36,8 +36,8 @@ cmd = %w[ ] + env + %W[ -e LKP_SRC=#{DEFAULT_LKP} -e CCI_SRC=#{DEFAULT_CCI} - -e SRV_HTTP_HOST=#{SRV_HTTP_HOST} - -e SRV_HTTP_PORT=#{SRV_HTTP_PORT} + -e SRV_HTTP_RESULT_HOST=#{SRV_HTTP_RESULT_HOST} + -e SRV_HTTP_RESULT_PORT=#{SRV_HTTP_RESULT_PORT} -v #{ENV['LKP_SRC']}:#{DEFAULT_LKP} -v /etc/localtime:/etc/localtime:ro -v #{ENV['CCI_SRC']}:#{DEFAULT_CCI} diff --git a/container/scheduler/start b/container/scheduler/start index 4aaa71d..d83fcc2 100755 --- a/container/scheduler/start +++ b/container/scheduler/start @@ -25,8 +25,8 @@ names = Set.new %w[ SSHR_PORT SSHR_PORT_BASE SSHR_PORT_LEN - SRV_HTTP_HOST - SRV_HTTP_PORT + SRV_HTTP_CCI_HOST + SRV_HTTP_CCI_PORT lab ]
@@ -37,7 +37,7 @@ defaults['SSHR_PORT_LEN'] ||= 2000 defaults['SCHED_PORT'] ||= '3000' defaults['SCHED_HOST'] ||= '172.17.0.1' defaults['MASTER_FLUENTD_PORT'] ||= '24224' -defaults['SRV_HTTP_PORT'] ||= '11300' +defaults['SRV_HTTP_CCI_PORT'] ||= '11306' env = docker_env(defaults)
CCI_REPOS = ENV['CCI_REPOS'] || '/c' diff --git a/lib/constants.rb b/lib/constants.rb index 5ed4d57..8d8e488 100644 --- a/lib/constants.rb +++ b/lib/constants.rb @@ -11,8 +11,12 @@ ES_PORT ||= config['ES_PORT'] || 9200 SEND_MAIL_HOST ||= config['SEND_MAIL_HOST'] || '172.17.0.1' SEND_MAIL_PORT ||= config['SEND_MAIL_PORT'] || 49000
-SRV_HTTP_HOST ||= config['SRV_HTTP_HOST'] || ENV['SRV_HTTP_HOST'] || '172.17.0.1' -SRV_HTTP_PORT ||= config['SRV_HTTP_PORT'] || ENV['SRV_HTTP_PORT'] || 11300 +SRV_HTTP_RESULT_HOST ||= config['SRV_HTTP_RESULT_HOST'] || ENV['SRV_HTTP_RESULT_HOST'] || '172.17.0.1' +SRV_HTTP_OS_HOST ||= config['SRV_HTTP_OS_HOST'] || ENV['SRV_HTTP_OS_HOST'] || '172.17.0.1' +SRV_HTTP_GIT_HOST ||= config['SRV_HTTP_GIT_HOST'] || ENV['SRV_HTTP_GIT_HOST'] || '172.17.0.1' +SRV_HTTP_RESULT_PORT ||= config['SRV_HTTP_RESULT_PORT'] || ENV['SRV_HTTP_RESULT_PORT'] || 11300 +SRV_HTTP_OS_PORT ||= config['SRV_HTTP_OS_PORT'] || ENV['SRV_HTTP_OS_PORT'] || 11304 +SRV_HTTP_GIT_PORT ||= config['SRV_HTTP_GIT_PORT'] || ENV['SRV_HTTP_GIT_PORT'] || 11305
SRV_HTTP_DOMAIN ||= config['SRV_HTTP_DOMAIN'] || ENV['SRV_HTTP_DOMAIN'] || 'api.compass-ci.openeuler.org'
diff --git a/lib/mail_job_result.rb b/lib/mail_job_result.rb index 796a4f3..e588470 100644 --- a/lib/mail_job_result.rb +++ b/lib/mail_job_result.rb @@ -9,7 +9,7 @@ require 'json'
# compose and send email for job result class MailJobResult - def initialize(job_id, result_host = SRV_HTTP_HOST, result_port = SRV_HTTP_PORT) + def initialize(job_id, result_host = SRV_HTTP_RESULT_HOST, result_port = SRV_HTTP_RESULT_PORT) @job_id = job_id @result_host = result_host @result_port = result_port diff --git a/providers/lib/domain.rb b/providers/lib/domain.rb index 8df9c06..318e68d 100644 --- a/providers/lib/domain.rb +++ b/providers/lib/domain.rb @@ -46,8 +46,8 @@ class Domain end
def load_xml_file(filepath) - host = @context.info['SRV_HTTP_HOST'] - port = @context.info['SRV_HTTP_PORT'] + host = @context.info['SRV_HTTP_CCI_HOST'] + port = @context.info['SRV_HTTP_CCI_PORT'] system "wget --timestamping --progress=bar:force http://#%7Bhost%7D:#%7Bport%7D/cci/libvirt-xml/#%7Bfilepath%7D" %x(basename #{filepath}).chomp end diff --git a/sbin/download-rootfs b/sbin/download-rootfs index e1d4091..74afbf6 100755 --- a/sbin/download-rootfs +++ b/sbin/download-rootfs @@ -25,7 +25,7 @@ download_os_rootfs() mkdir -p $rootfs_dir cd $rootfs_dir
- download_url="http://api.compass-ci.openeuler.org:$%7BSRV_HTTP_PORT%7D/os/$%7Bos%7D/$%7Bos..." + download_url="http://api.compass-ci.openeuler.org:$%7BSRV_HTTP_OS_PORT%7D/os/$%7Bos%7D/$%7..." wget $download_url
[ "$?" -ne 0 ] && { diff --git a/sparrow/3-code/dev-env b/sparrow/3-code/dev-env index cc94e01..698a4a2 100755 --- a/sparrow/3-code/dev-env +++ b/sparrow/3-code/dev-env @@ -16,8 +16,14 @@ server_name=$(hostname | cut -f1 -d.) : ${OS_HTTP_HOST:=$server_ip} : ${SEND_MAIL_HOST:=$server_ip} : ${SEND_MAIL_PORT:=49000} -: ${SRV_HTTP_HOST:=$server_ip} -: ${SRV_HTTP_PORT:=11300} +: ${SRV_HTTP_RESULT_HOST:=$server_ip} +: ${SRV_HTTP_OS_HOST:=$server_ip} +: ${SRV_HTTP_GIT_HOST:=$server_ip} +: ${SRV_HTTP_CCI_HOST:=$server_ip} +: ${SRV_HTTP_RESULT_PORT:=11300} +: ${SRV_HTTP_OS_PORT:=11304} +: ${SRV_HTTP_GIT_PORT:=11305} +: ${SRV_HTTP_CCI_PORT:=11306} : ${LOGGING_ES_HOST:=$server_ip} : ${LOGGING_ES_PORT:=9202} : ${INITRD_HTTP_HOST:=$server_ip} @@ -49,8 +55,14 @@ GIT_SERVER: $GIT_SERVER OS_HTTP_HOST: $OS_HTTP_HOST GITCACHE_HOST: $gitcache_host GITCACHE_PORT: $gitcache_port -SRV_HTTP_HOST: $SRV_HTTP_HOST -SRV_HTTP_PORT: $SRV_HTTP_PORT +SRV_HTTP_RESULT_HOST: $SRV_HTTP_RESULT_HOST +SRV_HTTP_OS_HOST: $SRV_HTTP_OS_HOST +SRV_HTTP_GIT_HOST: $SRV_HTTP_GIT_HOST +SRV_HTTP_CCI_HOST: $SRV_HTTP_CCI_HOST +SRV_HTTP_RESULT_PORT: $SRV_HTTP_RESULT_PORT +SRV_HTTP_OS_PORT: $SRV_HTTP_OS_PORT +SRV_HTTP_GIT_PORT: $SRV_HTTP_GIT_PORT +SRV_HTTP_CCI_PORT: $SRV_HTTP_CCI_PORT TASKQUEUE_HOST: $sched_host SEND_MAIL_HOST: $SEND_MAIL_HOST SEND_MAIL_PORT: $SEND_MAIL_PORT @@ -77,8 +89,8 @@ LKP_SERVER: GIT_SERVER: GITCACHE_HOST: GITCACHE_PORT: -SRV_HTTP_HOST: -SRV_HTTP_PORT: +SRV_HTTP_CCI_HOST: +SRV_HTTP_CCI_PORT: SEND_MAIL_HOST: SEND_MAIL_PORT: INITRD_HTTP_HOST: diff --git a/src/scheduler/constants.cr b/src/scheduler/constants.cr index 668da6d..d7d7a9a 100644 --- a/src/scheduler/constants.cr +++ b/src/scheduler/constants.cr @@ -23,8 +23,8 @@ INITRD_HTTP_PORT = (ENV.has_key?("INITRD_HTTP_PORT") ? ENV["INITRD_HTTP_PORT"] : OS_HTTP_HOST = (ENV.has_key?("OS_HTTP_HOST") ? ENV["OS_HTTP_HOST"] : "172.17.0.1") OS_HTTP_PORT = (ENV.has_key?("OS_HTTP_PORT") ? ENV["OS_HTTP_PORT"] : 8000).to_i32
-SRV_HTTP_HOST = (ENV.has_key?("SRV_HTTP_HOST") ? ENV["SRV_HTTP_HOST"] : "172.17.0.1") -SRV_HTTP_PORT = (ENV.has_key?("SRV_HTTP_PORT") ? ENV["SRV_HTTP_PORT"] : "11300") +SRV_HTTP_CCI_HOST = (ENV.has_key?("SRV_HTTP_CCI_HOST") ? ENV["SRV_HTTP_CCI_HOST"] : "172.17.0.1") +SRV_HTTP_CCI_PORT = (ENV.has_key?("SRV_HTTP_CCI_PORT") ? ENV["SRV_HTTP_CCI_PORT"] : "11306")
CCI_REPOS = (ENV.has_key?("CCI_REPOS") ? ENV["CCI_REPOS"] : "/c") LAB_REPO = "lab-z9" diff --git a/src/scheduler/find_job_boot.cr b/src/scheduler/find_job_boot.cr index 8dd22a8..3323d4d 100644 --- a/src/scheduler/find_job_boot.cr +++ b/src/scheduler/find_job_boot.cr @@ -191,8 +191,8 @@ class Sched "LKP_SERVER" => job["LKP_SERVER"]?, "vt" => _vt, "RESULT_WEBDAV_PORT" => job["RESULT_WEBDAV_PORT"]? || "3080", - "SRV_HTTP_HOST" => SRV_HTTP_HOST, - "SRV_HTTP_PORT" => SRV_HTTP_PORT, + "SRV_HTTP_CCI_HOST" => SRV_HTTP_CCI_HOST, + "SRV_HTTP_CCI_PORT" => SRV_HTTP_CCI_PORT, }.to_json end