libvirt/ci/integration-template.yml
Peter Krempa 7a1285216b ci: Regenerate with latest 'lcitool' and fix manual job definitions
The latest lcitool merged the 'prebuilt-env' and 'local-env' jobs into
one which use variables to pick up the right environment and steps
rather than duplicating everything.

Regenerate the generated job definitions, fix the helper definitions
and also fix the manually defined jobs (website-job).

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2024-01-19 14:48:21 +01:00

82 lines
2.6 KiB
YAML

.qemu-build-template: &qemu-build-template
- pushd "$SCRATCH_DIR"
- git clone --depth 1 https://gitlab.com/qemu-project/qemu.git
- cd qemu
#
# inspired by upstream QEMU's buildtest-template.yml
- export JOBS="$(expr $(nproc) + 1)"
- mkdir build
- cd build
- ../configure --prefix=/usr
--enable-werror
--disable-tcg
--disable-docs
--target-list=x86_64-softmmu || (cat config.log meson-logs/meson-log.txt && exit 1)
- make -j"$JOBS"
- if test -n "$MAKE_CHECK_ARGS";
then
make -j"$JOBS" check-build;
fi
# we need the following since the fix for CVE-2022-24765 now causes a fatal
# error if a user issues a git command from within a directory owned by some
# other user
- sudo git config --global --add safe.directory "$SCRATCH_DIR/qemu"
- sudo make install
- sudo restorecon -R /usr
- popd
.collect-logs: &collect-logs
- set +e
- shopt -s nullglob
- mkdir logs
- test -d "$SCRATCH_DIR"/avocado && mkdir logs/avocado
- sudo coredumpctl &>/dev/null && sudo coredumpctl info --no-pager > logs/coredumpctl.txt
- sudo mv /var/log/libvirt logs/libvirt
# filter only the failed tests, omitting successful job logs
- for test_log in "$SCRATCH_DIR"/avocado/latest/test-results/by-status/{ERROR,FAIL}/*;
do
sudo mv "$(realpath $test_log)" logs/avocado;
done;
- sudo chown -R $(whoami):$(whoami) logs
# rename all Avocado stderr/stdout logs to *.log so that GitLab's web UI doesn't mangle the MIME type
- find logs/avocado/ -type f ! -name "*.log" -exec
sh -c 'DIR=$(dirname {}); NAME=$(basename {}); mv $DIR/$NAME{,.log}' \;
.integration_tests:
stage: integration_tests
rules:
- if: '$LIBVIRT_CI_INTEGRATION == null'
when: never
- !reference [.gitlab_native_build_job, rules]
before_script:
- mkdir "$SCRATCH_DIR"
- sudo dnf install -y libvirt-rpms/* libvirt-perl-rpms/* libvirt-python-rpms/*
script:
- source ci/jobs.sh
- run_integration
after_script:
- test "$CI_JOB_STATUS" = "success" && exit 0;
- *collect-logs
variables:
SCRATCH_DIR: "/tmp/scratch"
artifacts:
name: logs
expire_in: 1 day
paths:
- logs
when: on_failure
# YAML anchors don't work with Shell conditions so we can't use a variable
# to conditionally build+install QEMU from source.
# Instead, create a new test job template for this scenario.
.integration_tests_upstream_qemu:
extends:
- .integration_tests
before_script:
- !reference [.integration_tests, before_script]
- *qemu-build-template