代码拉取完成,页面将自动刷新
同步操作将从 banzhuanxiaodoubi/wenjian 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/bin/bash
export VERSION=$1
export jobids=
exepath=$(dirname $0)
save_flag=0
case_num=0
passed_num=0
error_num=0
function run_testjob() {
local total_try_num=5
echo "start to connect openQA ,run test job"
declare -i index=0
while true; do
ids=$(python "${exepath}"/openeuler_at_operation.py start "${VERSION}")
if [ "x${ids}" == "xerror" ]; then
sleep 30
if [ $index -eq ${total_try_num} ]; then
echo "Failed to connect openQA to run test job"
exit 1
fi
index=$index+1
else
echo "connect to connect openQA ,run test job successfully!"
export jobids=${ids}
break
fi
done
}
function save_qcow() {
mkdir -p /var/www/html/hdd/
if [ "${VERSION}" == "openEuler-Mainline-aarch64-dvd" ]; then
scp root@172.168.131.95:/var/lib/openqa/factory/hdd/openEuler-Server-Mainline-aarch64.qcow2 /var/www/html/hdd/openEuler-Mainline-aarch64.qcow2
if [ $? -ne 0 ]; then
return 1
fi
elif [ "${VERSION}" == "openEuler-Mainline-x86_64-dvd" ]; then
scp root@172.168.131.95:/var/lib/openqa/factory/hdd/openEuler-Server-Mainline-x86_64.qcow2 /var/www/html/hdd/openEuler-Mainline-x86_64.qcow2
if [ $? -ne 0 ]; then
return 1
fi
elif [ "${VERSION}" == "openEuler-20.03-LTS-SP1-aarch64-dvd" ]; then
scp root@172.168.131.95:/var/lib/openqa/factory/hdd/openEuler-Server-20.03-LTS-SP1-aarch64.qcow2 /var/www/html/hdd/openEuler-20.03-LTS-SP1-aarch64.qcow2
if [ $? -ne 0 ]; then
return 1
fi
elif [ "${VERSION}" == "openEuler-20.03-LTS-SP1-x86_64-dvd" ]; then
scp root@172.168.131.95:/var/lib/openqa/factory/hdd/openEuler-Server-20.03-LTS-SP1-x86_64.qcow2 /var/www/html/hdd/openEuler-20.03-LTS-SP1-x86_64.qcow2
if [ $? -ne 0 ]; then
return 1
fi
elif [ "${VERSION}" == "openEuler-20.03-LTS-SP1-netinst-aarch64-dvd" ]; then
scp root@172.168.131.95:/var/lib/openqa/factory/hdd/openEuler-Server-20.03-LTS-SP1-netinst-aarch64.qcow2 /var/www/html/hdd/openEuler-20.03-LTS-SP1-netinst-aarch64.qcow2
if [ $? -ne 0 ]; then
return 1
fi
elif [ "${VERSION}" == "openEuler-20.03-LTS-SP1-netinst-x86_64-dvd" ]; then
scp root@172.168.131.95:/var/lib/openqa/factory/hdd/openEuler-Server-20.03-LTS-SP1-netinst-x86_64.qcow2 /var/www/html/hdd/openEuler-20.03-LTS-SP1-netinst-x86_64.qcow2
if [ $? -ne 0 ]; then
return 1
fi
elif [ "${VERSION}" == "openEuler-20.03-LTS-Next-aarch64-dvd" ]; then
scp root@172.168.131.95:/var/lib/openqa/factory/hdd/openEuler-Server-20.03-LTS-Next-aarch64.qcow2 /var/www/html/hdd/openEuler-20.03-LTS-Next-aarch64.qcow2
if [ $? -ne 0 ]; then
return 1
fi
elif [ "${VERSION}" == "openEuler-20.03-LTS-Next-x86_64-dvd" ]; then
scp root@172.168.131.95:/var/lib/openqa/factory/hdd/openEuler-Server-20.03-LTS-Next-x86_64.qcow2 /var/www/html/hdd/openEuler-20.03-LTS-Next-x86_64.qcow2
if [ $? -ne 0 ]; then
return 1
fi
elif [ "${VERSION}" == "openEuler-20.03-LTS-Next-netinst-aarch64-dvd" ]; then
scp root@172.168.131.95:/var/lib/openqa/factory/hdd/openEuler-Server-20.03-LTS-Next-netinst-aarch64.qcow2 /var/www/html/hdd/openEuler-20.03-LTS-Next-netinst-aarch64.qcow2
if [ $? -ne 0 ]; then
return 1
fi
elif [ "${VERSION}" == "openEuler-20.03-LTS-Next-netinst-x86_64-dvd" ]; then
scp root@172.168.131.95:/var/lib/openqa/factory/hdd/openEuler-Server-20.03-LTS-Next-netinst-x86_64.qcow2 /var/www/html/hdd/openEuler-20.03-LTS-Next-netinst-x86_64.qcow2
if [ $? -ne 0 ]; then
return 1
fi
elif [ "${VERSION}" == "openEuler-21.09-aarch64-dvd" ]; then
scp root@172.168.131.95:/var/lib/openqa/factory/hdd/openEuler-Server-21.09-aarch64.qcow2 /var/www/html/hdd/openEuler-21.09-aarch64.qcow2
if [ $? -ne 0 ]; then
return 1
fi
elif [ "${VERSION}" == "openEuler-21.09-x86_64-dvd" ]; then
scp root@172.168.131.95:/var/lib/openqa/factory/hdd/openEuler-Server-21.09-x86_64.qcow2 /var/www/html/hdd/openEuler-21.09-x86_64.qcow2
if [ $? -ne 0 ]; then
return 1
fi
elif [ "${VERSION}" == "openEuler-20.03-LTS-SP2-aarch64-dvd" ]; then
scp root@172.168.131.95:/var/lib/openqa/factory/hdd/openEuler-Server-20.03-LTS-SP2-aarch64.qcow2 /var/www/html/hdd/openEuler-20.03-LTS-SP2-aarch64.qcow2
if [ $? -ne 0 ]; then
return 1
fi
elif [ "${VERSION}" == "openEuler-20.03-LTS-SP2-x86_64-dvd" ]; then
scp root@172.168.131.95:/var/lib/openqa/factory/hdd/openEuler-Server-20.03-LTS-SP2-x86_64.qcow2 /var/www/html/hdd/openEuler-20.03-LTS-SP2-x86_64.qcow2
if [ $? -ne 0 ]; then
return 1
fi
elif [ "${VERSION}" == "openEuler-20.03-LTS-SP2-netinst-aarch64-dvd" ]; then
scp root@172.168.131.95:/var/lib/openqa/factory/hdd/openEuler-Server-20.03-LTS-SP2-netinst-aarch64.qcow2 /var/www/html/hdd/openEuler-20.03-LTS-SP2-netinst-aarch64.qcow2
if [ $? -ne 0 ]; then
return 1
fi
elif [ "${VERSION}" == "openEuler-20.03-LTS-SP2-netinst-x86_64-dvd" ]; then
scp root@172.168.131.95:/var/lib/openqa/factory/hdd/openEuler-Server-20.03-LTS-SP2-netinst-x86_64.qcow2 /var/www/html/hdd/openEuler-20.03-LTS-SP2-netinst-x86_64.qcow2
if [ $? -ne 0 ]; then
return 1
fi
elif [ "${VERSION}" == "openEuler-Mainline-netinst-aarch64-dvd" ]; then
scp root@172.168.131.95:/var/lib/openqa/factory/hdd/openEuler-Server-Mainline-netinst-aarch64.qcow2 /var/www/html/hdd/openEuler-Mainline-netinst-aarch64.qcow2
if [ $? -ne 0 ]; then
return 1
fi
elif [ "${VERSION}" == "openEuler-Mainline-netinst-x86_64-dvd" ]; then
scp root@172.168.131.95:/var/lib/openqa/factory/hdd/openEuler-Server-Mainline-netinst-x86_64.qcow2 /var/www/html/hdd/openEuler-Mainline-netinst-x86_64.qcow2
if [ $? -ne 0 ]; then
return 1
fi
elif [ "${VERSION}" == "openEuler-20.09-aarch64-dvd" ]; then
scp root@172.168.131.95:/var/lib/openqa/factory/hdd/openEuler-Server-20.09-aarch64.qcow2 /var/www/html/hdd/openEuler-20.09-aarch64.qcow2
if [ $? -ne 0 ]; then
return 1
fi
elif [ "${VERSION}" == "openEuler-20.09-x86_64-dvd" ]; then
scp root@172.168.131.95:/var/lib/openqa/factory/hdd/openEuler-Server-20.09-x86_64.qcow2 /var/www/html/hdd/openEuler-20.09-x86_64.qcow2
if [ $? -ne 0 ]; then
return 1
fi
elif [ "${VERSION}" == "openEuler-20.03-LTS-SP3-aarch64-dvd" ]; then
scp root@172.168.131.95:/var/lib/openqa/factory/hdd/openEuler-Server-20.03-LTS-SP3-aarch64.qcow2 /var/www/html/hdd/openEuler-20.03-LTS-SP3-aarch64.qcow2
if [ $? -ne 0 ]; then
return 1
fi
elif [ "${VERSION}" == "openEuler-20.03-LTS-SP3-x86_64-dvd" ]; then
scp root@172.168.131.95:/var/lib/openqa/factory/hdd/openEuler-Server-20.03-LTS-SP3-x86_64.qcow2 /var/www/html/hdd/openEuler-20.03-LTS-SP3-x86_64.qcow2
if [ $? -ne 0 ]; then
return 1
fi
elif [ "${VERSION}" == "openEuler-20.03-LTS-SP3-netinst-aarch64-dvd" ]; then
scp root@172.168.131.95:/var/lib/openqa/factory/hdd/openEuler-Server-20.03-LTS-SP3-netinst-aarch64.qcow2 /var/www/html/hdd/openEuler-20.03-LTS-SP3-netinst-aarch64.qcow2
if [ $? -ne 0 ]; then
return 1
fi
elif [ "${VERSION}" == "openEuler-20.03-LTS-SP3-netinst-x86_64-dvd" ]; then
scp root@172.168.131.95:/var/lib/openqa/factory/hdd/openEuler-Server-20.03-LTS-SP3-netinst-x86_64.qcow2 /var/www/html/hdd/openEuler-20.03-LTS-SP3-netinst-x86_64.qcow2
if [ $? -ne 0 ]; then
return 1
fi
elif [ "${VERSION}" == "openEuler-22.03-LTS-Next-aarch64-dvd" ]; then
scp root@172.168.131.95:/var/lib/openqa/factory/hdd/openEuler-Server-22.03-LTS-Next-aarch64.qcow2 /var/www/html/hdd/openEuler-22.03-LTS-Next-aarch64.qcow2
if [ $? -ne 0 ]; then
return 1
fi
elif [ "${VERSION}" == "openEuler-22.03-LTS-Next-x86_64-dvd" ]; then
scp root@172.168.131.95:/var/lib/openqa/factory/hdd/openEuler-Server-22.03-LTS-Next-x86_64.qcow2 /var/www/html/hdd/openEuler-22.03-LTS-Next-x86_64.qcow2
if [ $? -ne 0 ]; then
return 1
fi
elif [ "${VERSION}" == "openEuler-22.03-LTS-Next-netinst-aarch64-dvd" ]; then
scp root@172.168.131.95:/var/lib/openqa/factory/hdd/openEuler-Server-22.03-LTS-Next-netinst-aarch64.qcow2 /var/www/html/hdd/openEuler-22.03-LTS-Next-netinst-aarch64.qcow2
if [ $? -ne 0 ]; then
return 1
fi
elif [ "${VERSION}" == "openEuler-22.03-LTS-Next-netinst-x86_64-dvd" ]; then
scp root@172.168.131.95:/var/lib/openqa/factory/hdd/openEuler-Server-22.03-LTS-Next-netinst-x86_64.qcow2 /var/www/html/hdd/openEuler-22.03-LTS-Next-netinst-x86_64.qcow2
if [ $? -ne 0 ]; then
return 1
fi
elif [ "${VERSION}" == "openEuler-22.03-LTS-aarch64-dvd" ]; then
scp root@172.168.131.95:/var/lib/openqa/factory/hdd/openEuler-Server-22.03-LTS-aarch64.qcow2 /var/www/html/hdd/openEuler-22.03-LTS-aarch64.qcow2
if [ $? -ne 0 ]; then
return 1
fi
elif [ "${VERSION}" == "openEuler-22.03-LTS-x86_64-dvd" ]; then
scp root@172.168.131.95:/var/lib/openqa/factory/hdd/openEuler-Server-22.03-LTS-x86_64.qcow2 /var/www/html/hdd/openEuler-22.03-LTS-x86_64.qcow2
if [ $? -ne 0 ]; then
return 1
fi
elif [ "${VERSION}" == "openEuler-22.03-LTS-netinst-aarch64-dvd" ]; then
scp root@172.168.131.95:/var/lib/openqa/factory/hdd/openEuler-Server-22.03-LTS-netinst-aarch64.qcow2 /var/www/html/hdd/openEuler-22.03-LTS-netinst-aarch64.qcow2
if [ $? -ne 0 ]; then
return 1
fi
elif [ "${VERSION}" == "openEuler-22.03-LTS-netinst-x86_64-dvd" ]; then
scp root@172.168.131.95:/var/lib/openqa/factory/hdd/openEuler-Server-22.03-LTS-netinst-x86_64.qcow2 /var/www/html/hdd/openEuler-22.03-LTS-netinst-x86_64.qcow2
if [ $? -ne 0 ]; then
return 1
fi
elif [ "${VERSION}" == "openEuler-22.09-aarch64-dvd" ]; then
scp root@172.168.131.95:/var/lib/openqa/factory/hdd/openEuler-Server-22.09-aarch64.qcow2 /var/www/html/hdd/openEuler-22.09-aarch64.qcow2
if [ $? -ne 0 ]; then
return 1
fi
elif [ "${VERSION}" == "openEuler-22.09-x86_64-dvd" ]; then
scp root@172.168.131.95:/var/lib/openqa/factory/hdd/openEuler-Server-22.09-x86_64.qcow2 /var/www/html/hdd/openEuler-22.09-x86_64.qcow2
if [ $? -ne 0 ]; then
return 1
fi
elif [ "${VERSION}" == "openEuler-22.03-LTS-netinst-aarch64-dvd" ]; then
scp root@172.168.131.95:/var/lib/openqa/factory/hdd/openEuler-Server-22.09-netinst-aarch64.qcow2 /var/www/html/hdd/openEuler-22.09-netinst-aarch64.qcow2
if [ $? -ne 0 ]; then
return 1
fi
elif [ "${VERSION}" == "openEuler-Desktop-22.09-aarch64-dvd" ]; then
scp root@172.168.131.95:/var/lib/openqa/factory/hdd/openEuler-Server-Desktop-22.09-aarch64.qcow2 /var/www/html/hdd/openEuler-Desktop-22.09-aarch64.qcow2
if [ $? -ne 0 ]; then
return 1
fi
elif [ "${VERSION}" == "openEuler-Desktop-22.09-x86_64-dvd" ]; then
scp root@172.168.131.95:/var/lib/openqa/factory/hdd/openEuler-Server-Desktop-22.09-x86_64.qcow2 /var/www/html/hdd/openEuler-Desktop-22.09-x86_64.qcow2
if [ $? -ne 0 ]; then
return 1
fi
fi
return 0
}
function get_json_value() {
local json=$1
local key=$2
num=1
local value=$(echo "${json}" | awk -F"[,:}]" '{for(i=1;i<=NF;i++){if($i~/'${key}'\042/){print $(i+1)}}}' | tr -d '"' | sed -n ${num}p)
echo "${value}"
}
function get_status() {
result_str=
done_num=0
array=(${jobids//+/ })
for jobid in ${array[@]}; do
set -e
value=$(curl -s http://172.168.131.95/api/v1/jobs/$jobid/details)
set +e
if [ x"$value" == x ]; then
return 1
fi
job_state=$(get_json_value "${value}" "state")
job_result=$(get_json_value "${value}" "result")
job_test=$(get_json_value "${value}" "TEST")
if [ x"$result_str" == x ]; then
result_str="ids=$jobid,state=$job_state,result=$job_result,test=$job_test"
else
result_str="$result_str ; ids=$jobid,state=$job_state,result=$job_result,test=$job_test"
fi
if [ "$job_state" == "running" ]; then
date_now=$(date +%s)
if ! grep "$jobid" /tmp/"${jobids}"; then
echo "$jobid $date_now" >>/tmp/"${jobids}"
else
date_old=$(grep "$jobid" /tmp/"${jobids}" | awk -F ' ' '{print $2}')
if [ $((date_now - date_old)) -gt 2400 ]; then
set -xe
echo "$jobid timeout,restart job $jobid"
restart_ids=$(python "${exepath}"/openeuler_at_operation.py restart "${jobid}")
if [ "x${restart_ids}" == "xerror" ]; then
echo "restart job $jobid failed"
else
echo "restart job $jobid success,new job $restart_ids"
old_jobids=$jobids
export jobids=$(echo ${jobids/$jobid/$restart_ids})
echo "new jobids:$jobids"
mv /tmp/"${old_jobids}" /tmp/"${jobids}"
fi
set +xe
fi
fi
elif [ "$job_state" == "done" ]; then
if [ "$job_test" == "install_testsuite" -a "$job_result" == "passed" -a $save_flag -eq 0 ]; then
set -xe
save_qcow "${VERSION}"
if [ $? -eq 0 ]; then
save_flag=1
else
echo "save qcow ${VERSION} error"
fi
set +xe
fi
((done_num++))
fi
done
echo "${result_str}"
echo "${result_str}" >/tmp/"${jobids}""result"
}
function wait_job_finish() {
date_start=$(date +%s)
array=(${jobids//+/ })
case_num=${#array[*]}
while true; do
if [ ${error_num} -gt 15 ]; then
echo "get the job status error for 15 times, break"
break
fi
if ! get_status; then
echo "get the job status error, sleep 60s and continue to check"
((error_num++))
sleep 60
continue
fi
set -ex
if [ $case_num -eq $done_num ]; then
echo "The testjob has been done"
break
fi
date_new=$(date +%s)
if [ $((date_new - date_start)) -gt 10800 ]; then
echo "timeout"
break
fi
sleep 30
error_num=0
set +ex
done
}
function get_result() {
set +x
jobids_result=$(cat /tmp/"${jobids}""result")
echo "*****************************************************************************
all_result:
$jobids_result
*****************************************************************************"
array=(${jobids_result// ; / })
for jobid_result in ${array[@]}; do
if [ "$(echo ${jobid_result} | awk -F ',' '{print $3}')" == "result=passed" ]; then
passed_num=$(($passed_num + 1))
fi
done
if [ "x${case_num}" == "x${passed_num}" ]; then
echo "*****************************************************************************
All testcase success!
*****************************************************************************"
rm -rf /tmp/*result /tmp/"${jobids}" /tmp/livelog*
else
echo "*****************************************************************************
Some testcase failed!
*****************************************************************************"
rm -rf /tmp/*result /tmp/"${jobids}" /tmp/livelog*
exit 1
fi
}
run_testjob
echo "start to connect openQA ,run test job: ${jobids}"
#sleep 100
wait_job_finish
get_result
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。