From nobody Fri Jan 24 06:24:35 2025
Delivered-To: importer@patchew.org
Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied
 by domain of lists.libvirt.org) client-ip=8.43.85.245;
 envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org;
Authentication-Results: mx.zohomail.com;
	spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain
 of lists.libvirt.org)  smtp.mailfrom=devel-bounces@lists.libvirt.org;
	dmarc=fail(p=none dis=none)  header.from=redhat.com
Return-Path: <devel-bounces@lists.libvirt.org>
Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by
 mx.zohomail.com
	with SMTPS id 1704893676764271.8036123074445;
 Wed, 10 Jan 2024 05:34:36 -0800 (PST)
Received: by lists.libvirt.org (Postfix, from userid 996)
	id A71C01BC1; Wed, 10 Jan 2024 08:34:35 -0500 (EST)
Received: from lists.libvirt.org (localhost [IPv6:::1])
	by lists.libvirt.org (Postfix) with ESMTP id 57B771C34;
	Wed, 10 Jan 2024 08:30:42 -0500 (EST)
Received: by lists.libvirt.org (Postfix, from userid 996)
	id 5E8B61AEC; Wed, 10 Jan 2024 08:30:33 -0500 (EST)
Received: from us-smtp-delivery-124.mimecast.com
 (us-smtp-delivery-124.mimecast.com [170.10.129.124])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by lists.libvirt.org (Postfix) with ESMTPS id DFF761BAD
	for <devel@lists.libvirt.org>; Wed, 10 Jan 2024 08:30:29 -0500 (EST)
Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com
 [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS
 (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id
 us-mta-75-sDbo_pF5O7ysUPCIOQX9Tg-1; Wed, 10 Jan 2024 08:30:28 -0500
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com
 [10.11.54.4])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest
 SHA256)
	(No client certificate requested)
	by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3934A185A783
	for <devel@lists.libvirt.org>; Wed, 10 Jan 2024 13:30:28 +0000 (UTC)
Received: from speedmetal.lan (unknown [10.45.242.9])
	by smtp.corp.redhat.com (Postfix) with ESMTP id A60452026D66
	for <devel@lists.libvirt.org>; Wed, 10 Jan 2024 13:30:27 +0000 (UTC)
X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org
X-Spam-Level: 
X-Spam-Status: No,
 score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,
	MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,
	RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE
	autolearn=unavailable autolearn_force=no version=3.4.4
X-MC-Unique: sDbo_pF5O7ysUPCIOQX9Tg-1
From: Peter Krempa <pkrempa@redhat.com>
To: devel@lists.libvirt.org
Subject: [PATCH 1/4] gitlab-ci: Configure website build to be published via
 gitlab pages
Date: Wed, 10 Jan 2024 14:30:22 +0100
Message-ID: 
 <b8194f0046141ba8057b59c832327ed19035d492.1704892703.git.pkrempa@redhat.com>
In-Reply-To: <cover.1704892703.git.pkrempa@redhat.com>
References: <cover.1704892703.git.pkrempa@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Message-ID-Hash: 2TM3I7QYXGA5FQM5OPNM5YREM4GNJBI5
X-Message-ID-Hash: 2TM3I7QYXGA5FQM5OPNM5YREM4GNJBI5
X-MailFrom: pkrempa@redhat.com
X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency;
 loop; banned-address; member-moderation; header-match-config-1;
 header-match-config-2; header-match-config-3;
 header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia;
 implicit-dest; max-recipients; max-size; news-moderation; no-subject;
 suspicious-header
X-Mailman-Version: 3.2.2
Precedence: list
List-Id: Development discussions about the libvirt library & tools
 <devel.lists.libvirt.org>
Archived-At: 
 <https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/message/2TM3I7QYXGA5FQM5OPNM5YREM4GNJBI5/>
List-Archive: 
 <https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/>
List-Help: <mailto:devel-request@lists.libvirt.org?subject=help>
List-Post: <mailto:devel@lists.libvirt.org>
List-Subscribe: <mailto:devel-join@lists.libvirt.org>
List-Unsubscribe: <mailto:devel-leave@lists.libvirt.org>
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-ZM-MESSAGEID: 1704893677548100001

Modify the build process of the web page to publish the contents of the
web page also via gitlab pages.

The current webpage job is renamed to 'website_prebuilt_env_legacy' but
preserves the naming of artifacts. This is needed to preserve the
current approach where libvirt.org is hosted from the old server by
pulling the artifacts.

New jobs are added, which use the new artifact naming scheme needed for
gitlab pages to host them.

Artifacts are named 'pages' and contain a 'public' directory now.

The new jobs are:

 - pages:
    - triggered on push to master

 - website_prebuilt_env:
    - triggered on any remaining trigger of 'gitlab_native_build_job_prebui=
lt_env'
      except for the push to master
    - artifact naming uses the new scheme
 - website_local_env:
    - triggered same way as gitlab_native_build_job_local_env
    - uses new naming scheme

Doing the above allows us to have gitlab pages coexist with the old
setup until etiher switching to gitlab pages completely (once the remote
redirects feature gets enabled for the main instance) or changing the
old server to pull data from the new job artifact location:

  https://gitlab.com/libvirt/libvirt/-/jobs/artifacts/master/download?job=
=3Dpages

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 .gitlab-ci.yml | 86 +++++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 81 insertions(+), 5 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 8bad761b32..6c7d54c311 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -78,7 +78,8 @@ include:
     - .cross_build_job
     - .gitlab_cross_build_job_local_env

-
+# LEGACY web page build
+#
 # 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?j=
ob=3Dwebsite
@@ -97,7 +98,7 @@ include:
     paths:
       - website

-website_prebuilt_env:
+website_prebuilt_env_legacy:
   extends:
     - .website_job
     - .gitlab_native_build_job_prebuilt_env
@@ -107,13 +108,88 @@ website_prebuilt_env:
   variables:
     NAME: almalinux-8

+
+# 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 l=
ibvirt project
+#     - 'website_local_env'
+#       - when run in locally-rebuilt environment
+#
+# The job exposes artifacts containing a directory named 'public'.
+#
+.pages_job:
+  script:
+    - source ci/jobs.sh
+    - run_website_build
+  after_script:
+    - test "$CI_JOB_STATUS" !=3D "success" && exit 1;
+    - mv install/usr/share/doc/libvirt/html/ public
+  artifacts:
+    expose_as: 'pages'
+    name: 'pages'
+    paths:
+      - public
+
+pages:
+  extends:
+    - .pages_job
+  needs:
+    - job: x86_64-fedora-39-container
+      optional: true
+  variables:
+    NAME: fedora-39
+  stage: builds
+  image: $CI_REGISTRY/$RUN_UPSTREAM_NAMESPACE/libvirt/ci-$NAME:latest
+  before_script:
+    - cat /packages.txt
+  rules:
+    - if: '$CI_PROJECT_NAMESPACE =3D=3D $RUN_UPSTREAM_NAMESPACE && $CI_PIP=
ELINE_SOURCE =3D=3D "push" && $CI_COMMIT_BRANCH =3D=3D $CI_DEFAULT_BRANCH'
+      when: on_success
+    - when: never
+
+website_prebuilt_env:
+  extends:
+    - .pages_job
+    - .gitlab_native_build_job_prebuilt_env
+  needs:
+    - job: x86_64-fedora-39-container
+      optional: true
+  variables:
+    NAME: fedora-39
+  rules:
+    # forks: pushes to a branch when a pipeline run in upstream env is exp=
licitly requested
+    - if: '$CI_PROJECT_NAMESPACE !=3D $RUN_UPSTREAM_NAMESPACE && $CI_PIPEL=
INE_SOURCE =3D=3D "push" && $RUN_PIPELINE_UPSTREAM_ENV'
+      when: on_success
+
+    # upstream: other web/api/scheduled pipelines targeting the default br=
anch
+    - if: '$CI_PROJECT_NAMESPACE =3D=3D $RUN_UPSTREAM_NAMESPACE && $CI_PIP=
ELINE_SOURCE =3D~ /(web|api|schedule)/ && $CI_COMMIT_REF_NAME =3D=3D $CI_DE=
FAULT_BRANCH'
+      when: on_success
+
+    # upstream+forks: merge requests targeting the default branch, without=
 CI changes
+    - if: '$CI_PIPELINE_SOURCE =3D=3D "merge_request_event" && $CI_MERGE_R=
EQUEST_TARGET_BRANCH_NAME =3D=3D $CI_DEFAULT_BRANCH'
+      changes:
+        - ci/gitlab/container-templates.yml
+        - ci/containers/$NAME.Dockerfile
+      when: never
+    - if: '$CI_PIPELINE_SOURCE =3D=3D "merge_request_event" && $CI_MERGE_R=
EQUEST_TARGET_BRANCH_NAME =3D=3D $CI_DEFAULT_BRANCH'
+      when: on_success
+
+    # upstream+forks: that's all folks
+    - when: never
+
 website_local_env:
   extends:
-    - .website_job
+    - .pages_job
     - .gitlab_native_build_job_local_env
   variables:
-    IMAGE: docker.io/library/almalinux:8
-    NAME: almalinux-8
+    IMAGE: registry.fedoraproject.org/fedora:39
+    NAME: fedora-39


 .codestyle_job:
--=20
2.43.0
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org