mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-21 05:31:05 +02:00
ci-automation: Only store compressed images
The new build pipeline compresses images already but uploaded both the compressed and uncompressed files because the whole build folder gets uploaded. Add a new flag "--only_store_compressed" to the image generation which deletes the uncompressed file after compression is done. Uncompressed images are still supported if specified in the flag "image_compression_formats". Closes https://github.com/flatcar-linux/Flatcar/issues/793
This commit is contained in:
parent
5516e4948d
commit
ef9b0ff820
@ -42,6 +42,8 @@ DEFINE_string sign_digests "" \
|
|||||||
"Sign image DIGESTS files with the given GPG key."
|
"Sign image DIGESTS files with the given GPG key."
|
||||||
DEFINE_string image_compression_formats "${DEFAULT_IMAGE_COMPRESSION_FORMAT}" \
|
DEFINE_string image_compression_formats "${DEFAULT_IMAGE_COMPRESSION_FORMAT}" \
|
||||||
"Compress the resulting images using thise formats. This option acceps a list of comma separated values. Options are: none, bz2, gz, zip, zst"
|
"Compress the resulting images using thise formats. This option acceps a list of comma separated values. Options are: none, bz2, gz, zip, zst"
|
||||||
|
DEFINE_boolean only_store_compressed ${FLAGS_TRUE} \
|
||||||
|
"Delete input file when compressing, except when 'none' is part of the compression formats or the generic image is the input"
|
||||||
|
|
||||||
|
|
||||||
compress_file() {
|
compress_file() {
|
||||||
@ -113,6 +115,14 @@ compress_disk_images() {
|
|||||||
processed_format["${format}"]=1
|
processed_format["${format}"]=1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
# If requested, delete the input file after compression (only if 'none' is not part of the formats)
|
||||||
|
# Exclude the generic image and update payload because they are needed for generating other formats
|
||||||
|
if [ "${FLAGS_only_store_compressed}" -eq "${FLAGS_TRUE}" ] &&
|
||||||
|
[ "${filename##*/}" != "flatcar_production_image.bin" ] &&
|
||||||
|
[ "${filename##*/}" != "flatcar_production_update.bin" ] &&
|
||||||
|
! echo "${FORMATS[@]}" | grep -q "none"; then
|
||||||
|
rm "${filename}"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
local_extra_files+=( "${filename}" )
|
local_extra_files+=( "${filename}" )
|
||||||
fi
|
fi
|
||||||
|
@ -93,6 +93,7 @@ function _image_build_impl() {
|
|||||||
-v "${vernum}" \
|
-v "${vernum}" \
|
||||||
./build_image --board="${arch}-usr" --group="${channel}" \
|
./build_image --board="${arch}-usr" --group="${channel}" \
|
||||||
--output_root="${CONTAINER_IMAGE_ROOT}" \
|
--output_root="${CONTAINER_IMAGE_ROOT}" \
|
||||||
|
--only_store_compressed \
|
||||||
--torcx_root="${CONTAINER_TORCX_ROOT}" prodtar container
|
--torcx_root="${CONTAINER_TORCX_ROOT}" prodtar container
|
||||||
|
|
||||||
# copy resulting images + push to buildcache
|
# copy resulting images + push to buildcache
|
||||||
@ -102,6 +103,8 @@ function _image_build_impl() {
|
|||||||
-v "${vernum}" \
|
-v "${vernum}" \
|
||||||
mv "${CONTAINER_IMAGE_ROOT}/${arch}-usr/" "./${images_out}/"
|
mv "${CONTAINER_IMAGE_ROOT}/${arch}-usr/" "./${images_out}/"
|
||||||
|
|
||||||
|
# Delete uncompressed generic image before signing and upload
|
||||||
|
rm "images/latest/flatcar_production_image.bin" "images/latest/flatcar_production_update.bin"
|
||||||
sign_artifacts "${SIGNER}" "images/latest/"*
|
sign_artifacts "${SIGNER}" "images/latest/"*
|
||||||
copy_to_buildcache "images/${arch}/${vernum}/" "images/latest/"*
|
copy_to_buildcache "images/${arch}/${vernum}/" "images/latest/"*
|
||||||
|
|
||||||
|
@ -25,7 +25,9 @@ if [ -f "${QEMU_IMAGE_NAME}" ] ; then
|
|||||||
echo "++++ ${CIA_TESTSCRIPT}: Using existing ./${QEMU_IMAGE_NAME} for testing ${CIA_VERNUM} (${CIA_ARCH}) ++++"
|
echo "++++ ${CIA_TESTSCRIPT}: Using existing ./${QEMU_IMAGE_NAME} for testing ${CIA_VERNUM} (${CIA_ARCH}) ++++"
|
||||||
else
|
else
|
||||||
echo "++++ ${CIA_TESTSCRIPT}: downloading ${QEMU_IMAGE_NAME} for ${CIA_VERNUM} (${CIA_ARCH}) ++++"
|
echo "++++ ${CIA_TESTSCRIPT}: downloading ${QEMU_IMAGE_NAME} for ${CIA_VERNUM} (${CIA_ARCH}) ++++"
|
||||||
copy_from_buildcache "images/${CIA_ARCH}/${CIA_VERNUM}/${QEMU_IMAGE_NAME}" .
|
rm -f "${QEMU_IMAGE_NAME}.bz2"
|
||||||
|
copy_from_buildcache "images/${CIA_ARCH}/${CIA_VERNUM}/${QEMU_IMAGE_NAME}.bz2" .
|
||||||
|
lbunzip2 "${QEMU_IMAGE_NAME}.bz2"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
bios="${QEMU_BIOS}"
|
bios="${QEMU_BIOS}"
|
||||||
|
@ -101,6 +101,7 @@ function _vm_build_impl() {
|
|||||||
local images_in="images-in/"
|
local images_in="images-in/"
|
||||||
rm -rf "${images_in}"
|
rm -rf "${images_in}"
|
||||||
copy_dir_from_buildcache "images/${arch}/${vernum}/" "${images_in}"
|
copy_dir_from_buildcache "images/${arch}/${vernum}/" "${images_in}"
|
||||||
|
lbunzip2 "${images_in}/flatcar_production_image.bin.bz2"
|
||||||
./run_sdk_container -x ./ci-cleanup.sh -n "${vms_container}" -C "${packages_image}" \
|
./run_sdk_container -x ./ci-cleanup.sh -n "${vms_container}" -C "${packages_image}" \
|
||||||
-v "${vernum}" \
|
-v "${vernum}" \
|
||||||
mkdir -p "${CONTAINER_IMAGE_ROOT}/${arch}-usr/latest"
|
mkdir -p "${CONTAINER_IMAGE_ROOT}/${arch}-usr/latest"
|
||||||
@ -119,7 +120,8 @@ function _vm_build_impl() {
|
|||||||
./image_to_vm.sh --format "${format}" --board="${arch}-usr" \
|
./image_to_vm.sh --format "${format}" --board="${arch}-usr" \
|
||||||
--from "${CONTAINER_IMAGE_ROOT}/${arch}-usr/latest-input" \
|
--from "${CONTAINER_IMAGE_ROOT}/${arch}-usr/latest-input" \
|
||||||
--to "${CONTAINER_IMAGE_ROOT}/${arch}-usr/latest" \
|
--to "${CONTAINER_IMAGE_ROOT}/${arch}-usr/latest" \
|
||||||
--image_compression_formats="${COMPRESSION_FORMAT}"
|
--image_compression_formats="${COMPRESSION_FORMAT}" \
|
||||||
|
--only_store_compressed
|
||||||
done
|
done
|
||||||
|
|
||||||
# copy resulting images + push to buildcache
|
# copy resulting images + push to buildcache
|
||||||
|
Loading…
x
Reference in New Issue
Block a user