[libvirt-appdev-guide-python PATCH] gitlab: introduce CI jobs for building content

Daniel P. Berrangé berrange at redhat.com
Thu Apr 30 18:05:38 UTC 2020


This generates the HTML docs using publican and publishes the
result as an artifact which are then browseable online via
GitLab pages.

Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
---
 .gitlab-ci.yml                  | 40 ++++++++++++++++++++++++++
 Makefile                        |  7 +++--
 ci/libvirt-fedora-32.Dockerfile | 50 +++++++++++++++++++++++++++++++++
 ci/refresh                      | 17 +++++++++++
 4 files changed, 111 insertions(+), 3 deletions(-)
 create mode 100644 ci/libvirt-fedora-32.Dockerfile
 create mode 100755 ci/refresh

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 50dae92..0e48e12 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,6 +1,34 @@
 
 stages:
   - prebuild
+  - containers
+  - docs
+
+.container_job_template: &container_job_definition
+  image: docker:stable
+  stage: containers
+  services:
+    - docker:dind
+  before_script:
+    - export TAG="$CI_REGISTRY_IMAGE/ci-$NAME:latest"
+    - export COMMON_TAG="$CI_REGISTRY/libvirt/libvirt-perl/ci-$NAME:latest"
+    - docker info
+    - docker login registry.gitlab.com -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD"
+  script:
+    - docker pull "$TAG" || docker pull "$COMMON_TAG" || true
+    - docker build --cache-from "$TAG" --cache-from "$COMMON_TAG" --tag "$TAG" -f "ci/libvirt-$NAME.Dockerfile" ci
+    - docker push "$TAG"
+  after_script:
+    - docker logout
+
+.docs_job_template: &docs_job_definition
+  stage: docs
+  before_script:
+    - export MAKEFLAGS="-j$(getconf _NPROCESSORS_ONLN)"
+  script:
+    - git clone --depth 1 https://gitlab.com/libvirt/libvirt-publican.git brand
+    - $MAKE branddir=$PWD/brand
+    - mv tmp/en-US/html public
 
 # Check that all commits are signed-off for the DCO.
 # Skip on "libvirt" namespace, since we only need to run
@@ -14,3 +42,15 @@ check-dco:
   except:
     variables:
       - $CI_PROJECT_NAMESPACE == 'libvirt'
+
+fedora-32-container:
+  <<: *container_job_definition
+  variables:
+    NAME: fedora-32
+
+pages:
+  <<: *docs_job_definition
+  image: $CI_REGISTRY_IMAGE/ci-fedora-32:latest
+  artifacts:
+    paths:
+      - public
diff --git a/Makefile b/Makefile
index 85935a1..237961a 100644
--- a/Makefile
+++ b/Makefile
@@ -3,17 +3,18 @@ prefix=/usr
 datadir=$(prefix)/share
 pkgdatadir=$(datadir)/publican
 contentdir=$(pkgdatadir)/Common_Content
+branddir=$(contentdir)
 
 all: html pdf
 
 html:
-	publican build --langs=en-US --formats=html --common_content=$(contentdir)
+	publican build --langs=en-US --formats=html --common_content=$(contentdir) --brand_dir=$(branddir)
 
 pdf:
-	publican build --langs=en-US --formats=pdf --common_content=$(contentdir)
+	publican build --langs=en-US --formats=pdf --common_content=$(contentdir) --brand_dir=$(branddir)
 
 rpm:
-	publican package --lang=en-US --binary --desktop --common_content=$(contentdir)
+	publican package --lang=en-US --binary --desktop --common_content=$(contentdir) --brand_dir=$(branddir)
 
 clean:
 	publican clean --common_content=$(contentdir)
diff --git a/ci/libvirt-fedora-32.Dockerfile b/ci/libvirt-fedora-32.Dockerfile
new file mode 100644
index 0000000..8539d7d
--- /dev/null
+++ b/ci/libvirt-fedora-32.Dockerfile
@@ -0,0 +1,50 @@
+FROM fedora:32
+
+RUN dnf update -y && \
+    dnf install -y \
+        autoconf \
+        automake \
+        bash \
+        bash-completion \
+        ca-certificates \
+        ccache \
+        chrony \
+        cppi \
+        gcc \
+        gdb \
+        gettext \
+        gettext-devel \
+        git \
+        glibc-devel \
+        glibc-langpack-en \
+        libtool \
+        lsof \
+        make \
+        meson \
+        net-tools \
+        ninja-build \
+        patch \
+        perl \
+        pkgconfig \
+        publican \
+        python3 \
+        python3-setuptools \
+        python3-wheel \
+        rpm-build \
+        screen \
+        strace \
+        sudo \
+        vim && \
+    dnf autoremove -y && \
+    dnf clean all -y && \
+    mkdir -p /usr/libexec/ccache-wrappers && \
+    ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc && \
+    ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/$(basename /usr/bin/gcc)
+
+ENV LANG "en_US.UTF-8"
+
+ENV MAKE "/usr/bin/make"
+ENV NINJA "/usr/bin/ninja"
+ENV PYTHON "/usr/bin/python3"
+
+ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers"
diff --git a/ci/refresh b/ci/refresh
new file mode 100755
index 0000000..ce0c20a
--- /dev/null
+++ b/ci/refresh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+if test -z "$1"
+then
+    echo "syntax: $0 PATH-TO-LCITOOL"
+    exit 1
+fi
+
+LCITOOL=$1
+
+if ! test -x "$LCITOOL"
+then
+    echo "$LCITOOL is not executable"
+    exit 1
+fi
+
+$LCITOOL dockerfile libvirt-fedora-32 libvirt-publican > libvirt-fedora-32.Dockerfile
-- 
2.25.4




More information about the libvir-list mailing list