[Why] We can only generate the rootfs of dailybuild, so decouple the code related to dailybuild.
[How] Use 'iso_url_file' as a switch. - If this field is specified, so generate the rootfs of dailybuild; - If not, generate the rootfs of the official iso of the target version.
Signed-off-by: Yu Chuan 13186087857@163.com --- jobs/iso2rootfs.yaml | 4 +++- tests/iso2rootfs | 24 +++++++++++++----------- 2 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/jobs/iso2rootfs.yaml b/jobs/iso2rootfs.yaml index d4f0ffc0e80c..4e8729997a00 100644 --- a/jobs/iso2rootfs.yaml +++ b/jobs/iso2rootfs.yaml @@ -2,7 +2,6 @@ suite: iso2rootfs category: benchmark iso2rootfs: iso2rootfs_cgz: - iso_url_file: iso_os: iso_arch: iso_version: @@ -12,6 +11,9 @@ iso2rootfs: initrd_http_host: initrd_http_port:
+ # dailybuild related fields + iso_url_file: + # submit test yaml related fields test_yaml: test_os: diff --git a/tests/iso2rootfs b/tests/iso2rootfs index 9c71b8427d90..d42c38909f68 100755 --- a/tests/iso2rootfs +++ b/tests/iso2rootfs @@ -44,7 +44,6 @@ check_yaml_vars() "os_arch" "os_version" "iso2rootfs_cgz" - "iso_url_file" "iso_os" "iso_arch" "iso_version" @@ -149,8 +148,6 @@ mount_rootfs()
get_cache_iso_checksum() { - mount_rootfs - CHECKSUM_FILE_CACHE="${ROOTFS_LOCAL_PATH}/${iso_version}-latest.sha256sum" [ ! -f "${CHECKSUM_FILE_CACHE}" ] || SHA256SUM_CACHE=$(awk '{print $1}' "$CHECKSUM_FILE_CACHE") @@ -243,7 +240,10 @@ config_iso2rootfs() pre_works() { check_yaml_vars - check_sha256sum_update + + mount_rootfs + [ -n "${iso_url_file}" ] && check_sha256sum_update + check_os
config_iso2rootfs @@ -286,7 +286,7 @@ config_iso2qcow2()
config_pip_proxy config_iso_conf - config_iso_url + [ -n "${iso_url_file}" ] && config_iso_url }
run_iso2qcow2() @@ -332,7 +332,7 @@ config_qcow2rootfs() run_qcow2rootfs() { log_info "starting run qcow2rootfs ..." - local qcow2_path="${I2Q_SRC}/output/${ISO_NAME%.iso}.qcow2" + local qcow2_path="$(ls ${I2Q_SRC}/output/*.qcow2)"
cd "${CCI_SRC}/container/qcow2rootfs" ./run "${qcow2_path}" "${ROOTFS_DES_DIR}" @@ -501,12 +501,14 @@ post_works() { log_info "starting post works ..."
- mv "${CHECKSUM_FILE_CACHE}.tmp" "${CHECKSUM_FILE_CACHE}" + [ -n "${iso_url_file}" ] && { + mv "${CHECKSUM_FILE_CACHE}.tmp" "${CHECKSUM_FILE_CACHE}"
- local soft_link="${iso_version}-dailybuild" - cd "${ROOTFS_LOCAL_PATH}" && - rm -f "${soft_link}" && - ln -s "$(basename "${ROOTFS_DES_DIR}")" "${soft_link}" + local soft_link="${iso_version}-dailybuild" + cd "${ROOTFS_LOCAL_PATH}" && + rm -f "${soft_link}" && + ln -s "$(basename "${ROOTFS_DES_DIR}")" "${soft_link}" + }
cd / && umount "${ROOTFS_LOCAL_PATH}"