All of lore.kernel.org
 help / color / mirror / Atom feed
* [qemu-web PATCH v2] deploy to qemu-project.org from GitLab CI
@ 2021-01-19 10:15 Paolo Bonzini
  2021-01-19 10:47 ` Daniel P. Berrangé
  0 siblings, 1 reply; 2+ messages in thread
From: Paolo Bonzini @ 2021-01-19 10:15 UTC (permalink / raw)
  To: qemu-devel; +Cc: thuth

Currently, the website is rebuilt on qemu-project.org using
an update hook.  We can reuse instead the Jekyll output of
GitLab's CI.

To do so, a new user qemu-deploy has been created on qemu.org.
The private key is stored into a file variable SSH_PRIVATE_KEY_FILE
(be careful to include the trailing newline after "---END OPENSSH
PRIVATE KEY---"!).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 .gitlab-ci.yml | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 5fa3041..129b2ff 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 -az root/ new"
+    - rsync -avz --delete 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"
+  only:
+    refs:
+      - master
+    variables:
+      - $SSH_PRIVATE_KEY_FILE
+      - $SSH_DEPLOY_DESTINATION
-- 
2.29.2



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-19 10:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-19 10:15 [qemu-web PATCH v2] deploy to qemu-project.org from GitLab CI Paolo Bonzini
2021-01-19 10:47 ` Daniel P. Berrangé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.