Skip to content

Commit 76bf9df

Browse files
committed
ci: reduce memory and disk usage in test-convert jobs
- Remove --tmpfs /tmp from the test container. The work directory created by cryptpilot-convert.sh inside /tmp can reach ~40 GB (rootfs.img + work qcow2), far exceeding the 7 GB RAM available on ubuntu-latest runners. Without the tmpfs flag /tmp uses Docker overlay storage backed by host disk, eliminating the OOM that caused encrypted test cases to fail after ~53 minutes. - Delete the pulled test docker image immediately after extracting the qcow2 file, freeing several GB of Docker layer cache. - In run_test_case, delete input.qcow2 and SOURCE_IMAGE right after conversion succeeds. output.qcow2 is a standalone image and does not reference these files, so they are safe to remove before the verify and QEMU boot steps. This reclaims ~20.5 GB of disk space during the most resource-intensive part of the test. - Add a disk/memory reporting step (df -h && free -h) before starting the test container to aid future debugging.
1 parent 8fd33a6 commit 76bf9df

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

.github/workflows/build-rpm.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,11 @@ jobs:
212212
docker cp temp-extract:/image.qcow2 ${{ github.workspace }}/test-images/test-image.qcow2
213213
docker rm temp-extract
214214
ls -lh ${{ github.workspace }}/test-images/test-image.qcow2
215+
echo "Removing pulled test image to reclaim disk space..."
216+
docker rmi "$TEST_IMAGE"
217+
218+
- name: Check available disk and memory
219+
run: df -h && echo "---" && free -h
215220

216221
- name: Start test container
217222
run: |
@@ -222,7 +227,6 @@ jobs:
222227
-v /dev:/dev \
223228
-v /run/udev/control:/run/udev/control \
224229
-v ${{ github.workspace }}:/workspace \
225-
--tmpfs /tmp:exec,size=20G \
226230
alibaba-cloud-linux-3-registry.cn-hangzhou.cr.aliyuncs.com/alinux3/alinux3:latest \
227231
sleep infinity
228232
@@ -273,7 +277,9 @@ jobs:
273277
274278
- name: Cleanup
275279
if: always()
276-
run: docker rm -f test-container || true
280+
run: |
281+
docker rm -f test-container || true
282+
rm -rf ${{ github.workspace }}/test-images
277283
278284
release:
279285
if: startsWith(github.ref, 'refs/tags/')

tests/test-convert.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,12 @@ run_test_case() {
624624
return 1
625625
fi
626626

627+
# Free input image and source immediately after conversion to reclaim disk space.
628+
# output.qcow2 is a standalone image that no longer depends on these files.
629+
log::info "Freeing input image and source to reclaim disk space..."
630+
rm -f "${input_image}"
631+
rm -f "${SOURCE_IMAGE}"
632+
627633
# Verify the result
628634
if ! verify_converted_image "${test_name}" "${output_image}" "${use_uki}" "${use_encryption}"; then
629635
return 1
@@ -634,9 +640,9 @@ run_test_case() {
634640
return 1
635641
fi
636642

637-
# Clean up test-specific files to save space
643+
# Clean up remaining test-specific files
638644
log::info "Cleaning up test files for: ${test_name}"
639-
rm -f "${input_image}" "${output_image}"
645+
rm -f "${output_image}"
640646

641647
log::success "Test case passed: ${test_name}"
642648
return 0

0 commit comments

Comments
 (0)