Modify the build process of the web page to publish the contents of the
web page also via gitlab pages.
This is achieved by the following steps:
- the artifact is now named 'pages'
- on push to the default branch a new job 'pages' is used
- otherwise the old job names are used
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
.gitlab-ci.yml | 69 +++++++++++++++++++++++++++++++++++++++++++-------
1 file changed, 60 insertions(+), 9 deletions(-)
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 3a36c0ef18..df1074c518 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -69,22 +69,53 @@ include:
- .gitlab_cross_build_job_local_env
-# 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=w...
+# This job builds the website and publishes it in the following ways:
+# - 'pages'
+# - publishing for gitlab pages
+# - done only on push to the default branch
+# - 'website*'
+# - for CI purposes
+# - job name based on how it was invoked:
+# - 'website_prebuilt_env'
+# - when the CI runs on the container images build by the upstream libvirt project
+# - 'website_local_env'
+# - when run in locally-rebuilt environment
+#
+# The job exposes artifacts containing a directory named 'public'.
+#
+# 'libvirt.org' is currently populated from content got from:
+#
+#
https://gitlab.com/libvirt/libvirt/-/jobs/artifacts/master/download?job=p...
+#
+# which is unpacked and deployed to the web root.
.website_job:
script:
- *script_variables
- meson setup build --werror -Dsystem=true || (cat build/meson-logs/meson-log.txt
&& exit 1)
- DESTDIR=$(pwd)/install ninja -C build install-web
- - mv install/usr/share/doc/libvirt/html/ website
+ - mv install/usr/share/doc/libvirt/html/ public
artifacts:
- expose_as: 'Website'
- name: 'website'
- when: on_success
- expire_in: 30 days
+ expose_as: 'pages'
+ name: 'pages'
paths:
- - website
+ - public
+
+pages:
+ extends:
+ - .website_job
+ needs:
+ - job: x86_64-almalinux-8-container
+ optional: true
+ variables:
+ NAME: almalinux-8
+ stage: builds
+ image: $CI_REGISTRY/$RUN_UPSTREAM_NAMESPACE/libvirt/ci-$NAME:latest
+ before_script:
+ - cat /packages.txt
+ rules:
+ - if: '$CI_PROJECT_NAMESPACE == $RUN_UPSTREAM_NAMESPACE &&
$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH ==
$CI_DEFAULT_BRANCH'
+ when: on_success
+ - when: never
website_prebuilt_env:
extends:
@@ -95,6 +126,26 @@ website_prebuilt_env:
optional: true
variables:
NAME: almalinux-8
+ rules:
+ # forks: pushes to a branch when a pipeline run in upstream env is explicitly
requested
+ - 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'
+ when: on_success
+
+ # 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'
+ 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'
+ when: on_success
+
+ # upstream+forks: that's all folks
+ - when: never
website_local_env:
extends:
--
2.40.0