qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [qemu-web PATCH] deploy to qemu-project.org from GitLab CI


From: Paolo Bonzini
Subject: Re: [qemu-web PATCH] deploy to qemu-project.org from GitLab CI
Date: Tue, 19 Jan 2021 11:02:35 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0

On 19/01/21 10:53, Daniel P. Berrangé wrote:
On Tue, Jan 19, 2021 at 10:37:46AM +0100, Paolo Bonzini wrote:
Currently, the website is rebuilt on qemu-project.org using
an update hook.  We can reuse instead the Jekyll output of
GitLab's CI.

Are there any files present on the qemu-project.org webroot
other than the published output of Jekyll ?  QEMU had the
good sense to use sub-domains git.qemu-project.org and
download.qemu-project.org for other content. So maybe you
just turn the root qemu-project.org and www.qemu-project.org
domains into CNAME records pointing to the gitlab pages site ?

There are other files in the webroot at https://www.qemu.org/docs/master/, even though they're handled server side with the httpd Alias directive.

Right now they are built outside CI, from a cron job, but the plan is to do the same as qemu-web and deploy them during the GitLab CI run.

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 5fa3041..08b6d20 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,6 +1,11 @@
+stages:
+  - build
+  - update
+
  pages:
    image: centos:8
+  stage: build
    cache:
      paths:
        - vendor
@@ -14,3 +19,26 @@ pages:
    artifacts:
      paths:
       - public
+
+deploy:
+  image: centos:8
+  stage: update
+  needs:
+    - job: pages
+      artifacts: true
+  before_script:
+    - dnf install -y openssh-clients rsync
+    - eval $(ssh-agent -s)
+    - cat "$SSH_PRIVATE_KEY_FILE" | tr -d '\r' | ssh-add -
+    - mkdir -m700 -p ~/.ssh
+    - - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" 
>> ~/.ssh/config'
+  script:
+    - ssh $SSH_DEPLOY_DESTINATION "cd /var/www/qemu-project.org && mkdir new && 
rsync -avz root/ new"

Why copy the old root into the new root ? This means that any time we delete
a file in git, it will never be removed from the live webroot.

To speed up the rsync below. The website is small, but it doesn't hurt. However, you're right that "--delete" must be added to the next line.

Paolo

+    - rsync -avz public/ $SSH_DEPLOY_DESTINATION:/var/www/qemu-project.org/new
+    - ssh $SSH_DEPLOY_DESTINATION "cd /var/www/qemu-project.org && rm -rf old && mv root 
old && mv new root"



Regards,
Daniel





reply via email to

[Prev in Thread] Current Thread [Next in Thread]