[Why] The produced dailybuild rootfs needs further testing by submit a job.
[How] 1. Configure lkp env by {LKP_SRC}/sbin/install-dependencies.sh
2. Generate global compass-ci yaml. - The path of yaml: - /etc/compass-ci/defaults/sparrow.yaml - The yaml have two necessary fields: - SCHED_HOST - SCHED_PORT - The value of these two fields are consistent with the value in job.yaml of iso2rootfs.
3. Modify job.yaml of rootfs test job. - Add the required fields of job.yaml of rootfs test job to job.yaml of iso2rootfs; - os - os_arch - os_version - os_mount - testbox - Replace/insert them before submit the rootfs test job.
4. Submit the job.yaml of rootfs test job.
Signed-off-by: Yu Chuan 13186087857@163.com --- jobs/iso2rootfs.yaml | 6 ++++ tests/iso2rootfs | 72 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 77 insertions(+), 1 deletion(-)
diff --git a/jobs/iso2rootfs.yaml b/jobs/iso2rootfs.yaml index f413c9cee1f0..644c64be06b4 100644 --- a/jobs/iso2rootfs.yaml +++ b/jobs/iso2rootfs.yaml @@ -11,3 +11,9 @@ iso2rootfs: rootfs_path: initrd_http_host: initrd_http_port: + test_yaml: + test_os: + test_os_arch: + test_os_version: + test_os_mount: + test_testbox: diff --git a/tests/iso2rootfs b/tests/iso2rootfs index bf1f995e78df..5f56f5c21db9 100755 --- a/tests/iso2rootfs +++ b/tests/iso2rootfs @@ -53,6 +53,12 @@ check_yaml_vars() "rootfs_path" "initrd_http_host" "initrd_http_port" + "test_yaml" + "test_os" + "test_os_arch" + "test_os_version" + "test_os_mount" + "test_testbox" )
local yaml_t @@ -404,6 +410,69 @@ test_rootfs() EOF }
+############ submit test job yaml ############ +generate_global_yaml() +{ + local config_yaml="/etc/compass-ci/defaults/sparrow.yaml" + + mkdir -p "$(dirname "${config_yaml}")" + echo "SCHED_HOST: ${SCHED_HOST}" >> "${config_yaml}" + echo "SCHED_PORT: ${SCHED_PORT}" >> "${config_yaml}" +} + +assign_var() +{ + local var_name=$1 + local var_value=$2 + + if grep -qw "${var_name}:" "${test_yaml}" + then + sed -i "s/^( *${var_name}:).*/\1 ${var_value}/g" "${test_yaml}" + else + echo "${var_name}: ${var_value}" >> "${test_yaml}" + fi +} + +modify_test_job_yaml() +{ + log_info "starting prepare ${test_yaml}" + + [ -f "${test_yaml}" ] || die "test yaml(${test_yaml}) exist in {LKP_SRC}/jobs !!!" + + local wait_add_vars=( + "os" + "os_arch" + "os_version" + "os_mount" + "testbox" + ) + for vt in "${wait_add_vars[@]}" + do + assign_var "$vt" "$(eval echo "$test_${vt}")" + done +} + +submit_test_job_yaml() +{ + log_info "starting submit ${test_yaml} ..." + + [ -d "${LKP_SRC}" ] || die "no LKP_SRC !!!" + + cd "${LKP_SRC}" && { + chmod +x ./sbin/install-dependencies.sh + ./sbin/install-dependencies.sh + + generate_global_yaml + } + + cd "${LKP_SRC}/jobs" && { + modify_test_job_yaml + "${LKP_SRC}/sbin/submit" "${test_yaml}" + } + + log_info "submit ${test_yaml} finished" +} + ############ post works ############ post_works() { @@ -414,7 +483,7 @@ post_works() local soft_link="${iso_version}-dailybuild" cd "${ROOTFS_LOCAL_PATH}" && rm -f "${soft_link}" && - ln -s "$(basename ${ROOTFS_DES_DIR})" "${soft_link}" + ln -s "$(basename "${ROOTFS_DES_DIR}")" "${soft_link}"
cd / && umount "${ROOTFS_LOCAL_PATH}"
@@ -433,6 +502,7 @@ main() run_qcow2rootfs
test_rootfs + submit_test_job_yaml
post_works }