[Why] Network users need to use sshr to login testbox. So testbox should set sshr. And testbox get sshr info from job content. Scheduler needs to add sshr info to job content
Signed-off-by: Wu Zhende wuzhende666@163.com --- container/scheduler/start | 6 ++++++ src/lib/job.cr | 9 +++++++++ 2 files changed, 15 insertions(+)
diff --git a/container/scheduler/start b/container/scheduler/start index 81e7139..305916e 100755 --- a/container/scheduler/start +++ b/container/scheduler/start @@ -24,10 +24,16 @@ names = Set.new %w[ GIT_SERVER FLUENTD_SERVER_HOST FLUENTD_SERVER_PORT + SSHR_PORT + SSHR_PORT_BASE + SSHR_PORT_LEN lab ]
defaults = relevant_defaults(names) +defaults['SSHR_PORT'] ||= 5050 +defaults['SSHR_PORT_BASE'] ||= 50000 +defaults['SSHR_PORT_LEN'] ||= 2000 env = docker_env(defaults)
CCI_REPOS = ENV['CCI_REPOS'] || '/c' diff --git a/src/lib/job.cr b/src/lib/job.cr index 15dc03e..12d3980 100644 --- a/src/lib/job.cr +++ b/src/lib/job.cr @@ -139,6 +139,7 @@ class Job set_kernel_append_root() set_kernel_params() set_lkp_server() + set_sshr_port() end
private def append_init_field @@ -168,6 +169,14 @@ class Job end end
+ private def set_sshr_port + return unless self["sshd"]? + + self["sshr_port"] = ENV["SSHR_PORT"] + self["sshr_port_base"] = ENV["SSHR_PORT_BASE"] + self["sshr_port_len"] = ENV["SSHR_PORT_LEN"] + end + private def set_os_dir self["os_dir"] = "#{os}/#{os_arch}/#{os_version}" end