Skip to contentSkip to conversation

deploy docs to qemu-project.org from GitLab CI

PATCH In review Paolo Bonzini 3 participants 3 messages Jan 19, 2021

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 deploy docs to qemu-project.org from GitLab CI

Currently, the website is rebuilt on qemu-project.org using a separate container (https://github.com/stefanha/qemu-docs/)
cron job hook. We can instead reuse the GitLab's CI artifacts.

To do so, we use the same mechanism that is already in place for qemu-web.git.

---

        v1->v2: use same image and before_script as qemu-web.git
 .gitlab-ci.yml | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
.gitlab-ci.yml +24 -0
index fd0162ad29..d9afc79b30 100644
@@ -6,6 +6,7 @@ stages:
   - containers-layer2
   - build
   - test
+  - update
 
 include:
   - local: '/.gitlab-ci.d/edk2.yml'
@@ -627,3 +628,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-docs && rsync -az docs/ new-docs"
+    - rsync -avz --delete public/ $SSH_DEPLOY_DESTINATION:/var/www/qemu-project.org/new-docs
+    - ssh $SSH_DEPLOY_DESTINATION "cd /var/www/qemu-project.org && rm -rf old-docs && mv docs old-docs && mv new-docs docs"
+  only:
+    refs:
+      - master
+    variables:
+      - $SSH_PRIVATE_KEY_FILE
+      - $SSH_DEPLOY_DESTINATION
Signature · 1 line
2.29.2
Reviewed-by on v2 1/1
#1 lore raw
Quoted 43 lines · Paolo Bonzini

Currently, the website is rebuilt on qemu-project.org using a separate container (https://github.com/stefanha/qemu-docs/)
cron job hook. We can instead reuse the GitLab's CI artifacts.

To do so, we use the same mechanism that is already in place for qemu-web.git.

---

        v1->v2: use same image and before_script as qemu-web.git
 .gitlab-ci.yml | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
.gitlab-ci.yml +14 -0
index fd0162ad29..d9afc79b30 100644
@@ -6,6 +6,7 @@ stages:
   - containers-layer2
   - build
   - test
+  - update
 
 include:
   - local: '/.gitlab-ci.d/edk2.yml'
@@ -627,3 +628,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'

.gitlab-ci.yml pages: · line 653

Quoted 10 lines
.gitlab-ci.yml +10 -0
+  script:
+    - ssh $SSH_DEPLOY_DESTINATION "cd /var/www/qemu-project.org && mkdir new-docs && rsync -az docs/ new-docs"
+    - rsync -avz --delete public/ $SSH_DEPLOY_DESTINATION:/var/www/qemu-project.org/new-docs
+    - ssh $SSH_DEPLOY_DESTINATION "cd /var/www/qemu-project.org && rm -rf old-docs && mv docs old-docs && mv new-docs docs"
+  only:
+    refs:
+      - master
+    variables:
+      - $SSH_PRIVATE_KEY_FILE
+      - $SSH_DEPLOY_DESTINATION

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#2 lore raw
In reply to Paolo Bonzini
Quoted 19 lines · Paolo Bonzini

Currently, the website is rebuilt on qemu-project.org using a separate container (https://github.com/stefanha/qemu-docs/)
cron job hook. We can instead reuse the GitLab's CI artifacts.

To do so, we use the same mechanism that is already in place for qemu-web.git.

---

         v1->v2: use same image and before_script as qemu-web.git
  .gitlab-ci.yml | 24 ++++++++++++++++++++++++
  1 file changed, 24 insertions(+)
.gitlab-ci.yml +0 -0
index fd0162ad29..d9afc79b30 100644

.gitlab-ci.yml stages: · line 9

Quoted 4 lines
.gitlab-ci.yml +1 -0
@@ -6,6 +6,7 @@ stages:
    - containers-layer2
    - build
    - test
+  - update

Could you please also update the comment at the very top of the yml file? It currently says that there are only two stages after the container stage, but now you're adding a third one.

Thanks,
Thomas