Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ stages:
- meson build -Ddriver_libvirtd=disabled "--prefix=$VROOT" "--libdir=$LIBDIR"
- ninja -C build install
- popd
- $PYTHON -m build
- $PYTHON -m build -n -x
- $PYTHON -m venv test-venv --system-site-packages --symlinks
- test-venv/bin/python -m pip install dist/libvirt_python*.whl
- test-venv/bin/python -m pytest tests
Expand All @@ -44,7 +44,25 @@ stages:
script:
- export MAKEFLAGS="-j$(getconf _NPROCESSORS_ONLN)"
- export CFLAGS="-Werror"
- $PYTHON -m build
- $PYTHON -m build -n -x
- $PYTHON -m venv test-venv --system-site-packages --symlinks
- test-venv/bin/python -m pip install dist/libvirt_python*.whl
- test-venv/bin/python -m pytest tests
- if test -x /usr/bin/rpmbuild && test "$RPM" != "skip" ;
then
unset CFLAGS ;
rpmbuild --clean --nodeps --define "_topdir $PWD/rpmbuild" -ta dist/libvirt-python*tar.gz ;
mv rpmbuild/RPMS/x86_64/ libvirt-python-rpms ;
fi

.native_setuppy_build_job:
extends:
- .gitlab_native_build_job
script:
- export MAKEFLAGS="-j$(getconf _NPROCESSORS_ONLN)"
- export CFLAGS="-Werror"
- $PYTHON setup.py bdist_wheel
- $PYTHON setup.py sdist
- $PYTHON -m venv test-venv --system-site-packages --symlinks
- test-venv/bin/python -m pip install dist/libvirt_python*.whl
- test-venv/bin/python -m pytest tests
Expand Down
1 change: 1 addition & 0 deletions ci/buildenv/centos-stream-9.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ function install_buildenv() {
python3-pip \
python3-pytest \
python3-setuptools \
python3-wheel \
rpm-build
rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED
rpm -qa | sort > /packages.txt
Expand Down
3 changes: 2 additions & 1 deletion ci/buildenv/debian-12.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ function install_buildenv() {
python3-pip \
python3-pytest \
python3-setuptools \
python3-venv
python3-venv \
python3-wheel
sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen
dpkg-reconfigure locales
rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED
Expand Down
3 changes: 2 additions & 1 deletion ci/buildenv/debian-sid.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ function install_buildenv() {
python3-pip \
python3-pytest \
python3-setuptools \
python3-venv
python3-venv \
python3-wheel
sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen
dpkg-reconfigure locales
rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED
Expand Down
1 change: 1 addition & 0 deletions ci/buildenv/fedora-38.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ function install_buildenv() {
python3-pip \
python3-pytest \
python3-setuptools \
python3-wheel \
rpm-build
rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED
rpm -qa | sort > /packages.txt
Expand Down
1 change: 1 addition & 0 deletions ci/buildenv/fedora-39.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ function install_buildenv() {
python3-pip \
python3-pytest \
python3-setuptools \
python3-wheel \
rpm-build
rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED
rpm -qa | sort > /packages.txt
Expand Down
1 change: 1 addition & 0 deletions ci/buildenv/fedora-rawhide.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ function install_buildenv() {
python3-pip \
python3-pytest \
python3-setuptools \
python3-wheel \
rpm-build
rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED
rpm -qa | sort > /packages.txt
Expand Down
1 change: 1 addition & 0 deletions ci/buildenv/opensuse-tumbleweed.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ function install_buildenv() {
python3-pip \
python3-pytest \
python3-setuptools \
python3-wheel \
rpm-build
rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED
rpm -qa | sort > /packages.txt
Expand Down
1 change: 1 addition & 0 deletions ci/containers/centos-stream-9.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ RUN dnf distro-sync -y && \
python3-pip \
python3-pytest \
python3-setuptools \
python3-wheel \
rpm-build && \
dnf autoremove -y && \
dnf clean all -y && \
Expand Down
3 changes: 2 additions & 1 deletion ci/containers/debian-12.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
python3-pip \
python3-pytest \
python3-setuptools \
python3-venv && \
python3-venv \
python3-wheel && \
eatmydata apt-get autoremove -y && \
eatmydata apt-get autoclean -y && \
sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \
Expand Down
3 changes: 2 additions & 1 deletion ci/containers/debian-sid.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
python3-pip \
python3-pytest \
python3-setuptools \
python3-venv && \
python3-venv \
python3-wheel && \
eatmydata apt-get autoremove -y && \
eatmydata apt-get autoclean -y && \
sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \
Expand Down
1 change: 1 addition & 0 deletions ci/containers/fedora-38.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ exec "$@"\n' > /usr/bin/nosync && \
python3-pip \
python3-pytest \
python3-setuptools \
python3-wheel \
rpm-build && \
nosync dnf autoremove -y && \
nosync dnf clean all -y && \
Expand Down
1 change: 1 addition & 0 deletions ci/containers/fedora-39.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ exec "$@"\n' > /usr/bin/nosync && \
python3-pip \
python3-pytest \
python3-setuptools \
python3-wheel \
rpm-build && \
nosync dnf autoremove -y && \
nosync dnf clean all -y && \
Expand Down
1 change: 1 addition & 0 deletions ci/containers/fedora-rawhide.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ exec "$@"\n' > /usr/bin/nosync && \
python3-pip \
python3-pytest \
python3-setuptools \
python3-wheel \
rpm-build && \
nosync dnf autoremove -y && \
nosync dnf clean all -y && \
Expand Down
1 change: 1 addition & 0 deletions ci/containers/opensuse-tumbleweed.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ RUN zypper dist-upgrade -y && \
python3-pip \
python3-pytest \
python3-setuptools \
python3-wheel \
rpm-build && \
zypper clean --all && \
rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED && \
Expand Down
81 changes: 40 additions & 41 deletions ci/gitlab/build-templates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
variables:
IMAGE: $CI_REGISTRY/$RUN_UPSTREAM_NAMESPACE/libvirt-python/ci-$NAME:latest
rules:
### Rules where we expect to use pre-built container images
### PUSH events

# upstream: pushes to the default branch
- if: '$CI_PROJECT_NAMESPACE == $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $JOB_OPTIONAL'
Expand All @@ -53,90 +53,89 @@
- if: '$CI_PROJECT_NAMESPACE != $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE == "push" && $RUN_PIPELINE_UPSTREAM_ENV'
when: on_success

# upstream: other web/api/scheduled pipelines targeting the default branch
- if: '$CI_PROJECT_NAMESPACE == $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE =~ /(web|api|schedule)/ && $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH && $JOB_OPTIONAL'
# forks: pushes to branches with pipeline requested
- if: '$CI_PROJECT_NAMESPACE != $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE == "push" && $RUN_PIPELINE && $JOB_OPTIONAL'
when: manual
allow_failure: true
- if: '$CI_PROJECT_NAMESPACE == $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE =~ /(web|api|schedule)/ && $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH'
variables:
IMAGE: $TARGET_BASE_IMAGE
- if: '$CI_PROJECT_NAMESPACE != $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE == "push" && $RUN_PIPELINE'
when: on_success
variables:
IMAGE: $TARGET_BASE_IMAGE

# upstream+forks: merge requests targeting the default branch, without CI changes
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH'

### MERGE REQUEST events

# upstream+forks: merge requests targeting the default branch, with CI changes
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH && $JOB_OPTIONAL'
changes:
- ci/gitlab/container-templates.yml
- ci/containers/$NAME.Dockerfile
when: never
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH && $JOB_OPTIONAL'
when: manual
allow_failure: true
variables:
IMAGE: $TARGET_BASE_IMAGE
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH'
changes:
- ci/gitlab/container-templates.yml
- ci/containers/$NAME.Dockerfile
when: on_success
variables:
IMAGE: $TARGET_BASE_IMAGE


### Rules where we need to use the target base container image

# forks: pushes to branches with pipeline requested
- if: '$CI_PROJECT_NAMESPACE != $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE == "push" && $RUN_PIPELINE && $JOB_OPTIONAL'
# upstream+forks: merge requests targeting the default branch
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH && $JOB_OPTIONAL'
when: manual
allow_failure: true
variables:
IMAGE: $TARGET_BASE_IMAGE
- if: '$CI_PROJECT_NAMESPACE != $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE == "push" && $RUN_PIPELINE'
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH'
when: on_success
variables:
IMAGE: $TARGET_BASE_IMAGE

# upstream: other web/api/scheduled pipelines targeting non-default branches
- if: '$CI_PROJECT_NAMESPACE == $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE =~ /(web|api|schedule)/ && $CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH && $JOB_OPTIONAL'
# upstream+forks: merge requests targeting non-default branches
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME != $CI_DEFAULT_BRANCH && $JOB_OPTIONAL'
when: manual
allow_failure: true
variables:
IMAGE: $TARGET_BASE_IMAGE
- if: '$CI_PROJECT_NAMESPACE == $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE =~ /(web|api|schedule)/ && $CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH'
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME != $CI_DEFAULT_BRANCH'
when: on_success
variables:
IMAGE: $TARGET_BASE_IMAGE

# forks: other web/api/scheduled pipelines
- if: '$CI_PROJECT_NAMESPACE != $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE =~ /(web|api|schedule)/ && $JOB_OPTIONAL'

### WEB / API / SCHEDULED events

# upstream: other web/api/scheduled pipelines targeting the default branch
- if: '$CI_PROJECT_NAMESPACE == $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE =~ /(web|api|schedule)/ && $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH && $JOB_OPTIONAL'
when: manual
allow_failure: true
variables:
IMAGE: $TARGET_BASE_IMAGE
- if: '$CI_PROJECT_NAMESPACE != $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE =~ /(web|api|schedule)/'
- if: '$CI_PROJECT_NAMESPACE == $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE =~ /(web|api|schedule)/ && $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH'
when: on_success
variables:
IMAGE: $TARGET_BASE_IMAGE

# upstream+forks: merge requests targeting the default branch, with CI changes
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH && $JOB_OPTIONAL'
changes:
- ci/gitlab/container-templates.yml
- ci/containers/$NAME.Dockerfile
# upstream: other web/api/scheduled pipelines targeting non-default branches
- if: '$CI_PROJECT_NAMESPACE == $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE =~ /(web|api|schedule)/ && $CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH && $JOB_OPTIONAL'
when: manual
allow_failure: true
variables:
IMAGE: $TARGET_BASE_IMAGE
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH'
changes:
- ci/gitlab/container-templates.yml
- ci/containers/$NAME.Dockerfile
- if: '$CI_PROJECT_NAMESPACE == $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE =~ /(web|api|schedule)/ && $CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH'
when: on_success
variables:
IMAGE: $TARGET_BASE_IMAGE

# upstream+forks: merge requests targeting non-default branches
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME != $CI_DEFAULT_BRANCH && $JOB_OPTIONAL'
# forks: other web/api/scheduled pipelines on any branches
- if: '$CI_PROJECT_NAMESPACE != $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE =~ /(web|api|schedule)/ && $JOB_OPTIONAL'
when: manual
allow_failure: true
variables:
IMAGE: $TARGET_BASE_IMAGE
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME != $CI_DEFAULT_BRANCH'
- if: '$CI_PROJECT_NAMESPACE != $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE =~ /(web|api|schedule)/'
when: on_success
variables:
IMAGE: $TARGET_BASE_IMAGE

### Neither prebuilt or local container images

### Catch all unhandled events

# upstream+forks: that's all folks
- when: never
2 changes: 1 addition & 1 deletion ci/gitlab/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# Native build jobs

x86_64-centos-stream-8:
extends: .native_build_job
extends: .native_setuppy_build_job
needs:
- job: x86_64-centos-stream-8-container
optional: true
Expand Down
1 change: 1 addition & 0 deletions ci/lcitool/projects/libvirt-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ packages:
- python3-pip
- python3-pytest
- python3-setuptools
- python3-wheel
- python3-venv
- rpmbuild
1 change: 1 addition & 0 deletions ci/manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ targets:
centos-stream-8:
jobs:
- arch: x86_64
template: .native_setuppy_build_job
artifacts:
expire_in: 1 hour
paths:
Expand Down
2 changes: 1 addition & 1 deletion examples/consolecallback.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def error_handler(unused, error) -> None:
# The console stream errors on VM shutdown; we don't care
if error[0] == libvirt.VIR_ERR_RPC and error[1] == libvirt.VIR_FROM_STREAMS:
return
logging.warn(error)
logging.warning(error)


class Console(object):
Expand Down