libvirt/.gitlab-ci.yml
Peter Krempa 8d39dd0082 ci: Always run 'pages' job
When the 'pages' job is configured to run 'on_success' it's skipped if
any other pipeline fails. This is bad in cases such as if an external
service runs out of CI minutes as the web stops being updated.

Since the 'artifacts' of the 'website_job' are generated only if that
phase succeeds this will update the web when the web part is buildable.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2024-05-31 15:19:50 +02:00

176 lines
4.9 KiB
YAML

variables:
GIT_DEPTH: 100
stages:
- containers
- builds
- integration_tests
- sanity_checks
- pages
.script_variables: &script_variables |
export CCACHE_BASEDIR="$(pwd)"
export CCACHE_DIR="$CCACHE_BASEDIR/ccache"
export CCACHE_MAXSIZE="500M"
export PATH="$CCACHE_WRAPPERSDIR:$PATH"
export VIR_TEST_VERBOSE="1"
export VIR_TEST_DEBUG="1"
include:
- '/ci/gitlab.yml'
- '/ci/integration.yml'
.native_build_job:
extends: .gitlab_native_build_job
cache:
paths:
- ccache/
key: "$CI_JOB_NAME"
script:
- source ci/jobs.sh
- if test -x /usr/bin/rpmbuild && test "$RPM" != "skip";
then
run_rpmbuild;
else
run_build;
run_test;
fi
after_script:
- test "$CI_JOB_STATUS" != "success" && exit 1;
- if test -x /usr/bin/rpmbuild && test "$RPM" != "skip";
then
mv "$HOME"/rpmbuild/RPMS/x86_64/ libvirt-rpms/;
fi
.cross_build_job:
extends: .gitlab_cross_build_job
cache:
paths:
- ccache/
key: "$CI_JOB_NAME"
script:
- source ci/jobs.sh
- if test -x /usr/bin/rpmbuild && test "$RPM" != "skip";
then
run_rpmbuild;
else
run_build;
if test "$CROSS" = "i686";
then
run_test;
fi;
fi
# This artifact published by this job is downloaded by libvirt.org to
# be deployed to the web root:
# https://gitlab.com/libvirt/libvirt/-/jobs/artifacts/master/download?job=website
website_job:
extends: .gitlab_native_build_job
needs:
- job: x86_64-almalinux-9-container
optional: true
script:
- source ci/jobs.sh
- run_website_build
after_script:
- test "$CI_JOB_STATUS" != "success" && exit 1;
- mv install/usr/share/doc/libvirt/html/ website
artifacts:
expose_as: 'Website'
name: 'website'
when: on_success
expire_in: 30 days
paths:
- website
variables:
NAME: almalinux-9
TARGET_BASE_IMAGE: docker.io/library/almalinux:9
# On push to master publish the website from 'website_job' via gitlab pages
pages:
stage: pages
script:
- mv website public
- cp .gitlab_pages_redirects public/_redirects
dependencies:
- website_job
rules:
- if: '$CI_PROJECT_NAMESPACE == $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
when: always
- when: never
artifacts:
expose_as: 'pages'
name: 'pages'
paths:
- public
.codestyle_job:
stage: sanity_checks
needs:
- job: x86_64-opensuse-leap-15-container
optional: true
script:
- source ci/jobs.sh
- run_codestyle
variables:
NAME: opensuse-leap-15
TARGET_BASE_IMAGE: registry.opensuse.org/opensuse/leap:15.5
# This artifact published by this job is downloaded to push to Weblate
# for translation usage:
# https://gitlab.com/libvirt/libvirt/-/jobs/artifacts/master/download?job=potfile
potfile:
image: $CI_REGISTRY/$RUN_UPSTREAM_NAMESPACE/libvirt/ci-$NAME:latest
stage: builds
variables:
NAME: almalinux-9
before_script:
- cat /packages.txt
needs:
- job: x86_64-almalinux-9-container
optional: true
rules:
- if: '$CI_PROJECT_NAMESPACE == $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
when: on_success
- when: never
before_script:
- *script_variables
script:
- source ci/jobs.sh
- run_potfile
after_script:
- test "$CI_JOB_STATUS" != "success" && exit 1;
- cp po/libvirt.pot libvirt.pot
artifacts:
expose_as: 'Potfile'
name: 'potfile'
when: on_success
expire_in: 30 days
paths:
- libvirt.pot
# Coverity job that is run only by schedules
coverity:
image: $CI_REGISTRY/$RUN_UPSTREAM_NAMESPACE/libvirt/ci-$NAME:latest
stage: builds
needs:
- job: x86_64-almalinux-9-container
optional: true
before_script:
- cat /packages.txt
script:
- curl https://scan.coverity.com/download/cxx/linux64 --form project=$COVERITY_SCAN_PROJECT_NAME --form token=$COVERITY_SCAN_TOKEN -o /tmp/cov-analysis-linux64.tgz
- tar xfz /tmp/cov-analysis-linux64.tgz
- meson setup build --werror || (cat build/meson-logs/meson-log.txt && exit 1)
- cov-analysis-linux64-*/bin/cov-build --dir cov-int meson compile -C build
- tar cfz cov-int.tar.gz cov-int
- curl https://scan.coverity.com/builds?project=$COVERITY_SCAN_PROJECT_NAME --form token=$COVERITY_SCAN_TOKEN --form email=$GITLAB_USER_EMAIL --form file=@cov-int.tar.gz --form version="$(git describe --tags)" --form description="$(git describe --tags) / $CI_COMMIT_TITLE / $CI_COMMIT_REF_NAME:$CI_PIPELINE_ID"
variables:
NAME: almalinux-9
rules:
- if: '$COVERITY_SCAN_PROJECT_NAME == null || $COVERITY_SCAN_TOKEN == null'
when: never
- if: '$CI_PROJECT_NAMESPACE == $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE == "schedule" && $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH'
when: on_success
- when: never