+############ 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}"
dirty and complexed. Better use cmdline options on submit job.
Good! I forgot that. I'll modify here.
-------- Thanks Yu Chuan
Thanks, Fengguang
- 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"
+}