From 31ac3a06ee3c628cd7c94e9dd2425e7bbb93d229 Mon Sep 17 00:00:00 2001
From: Brieuc Dubois <git@bhasher.com>
Date: Sun, 17 Nov 2024 14:32:15 +0200
Subject: [PATCH] CD

---
 .gitignore        |  1 +
 .gitlab-ci.yml    | 19 ++++++-------------
 scripts/update.sh |  7 +++++++
 3 files changed, 14 insertions(+), 13 deletions(-)
 create mode 100755 scripts/update.sh

diff --git a/.gitignore b/.gitignore
index 3f1d2a8e..2d76a9a3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,4 @@
 *.pem
 
 .ipynb_checkpoints/
+scripts/surveys/.creds
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 949f9e59..7b759509 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -5,6 +5,8 @@ stages:
 
 lint_frontend:
   stage: lint
+  except:
+    - feat/cd
   image: node
   script:
     - cd frontend
@@ -13,6 +15,8 @@ lint_frontend:
 
 lint_backend:
   stage: lint
+  except:
+    - feat/cd
   image: registry.gitlab.com/pipeline-components/black:latest
   script:
     - black --check --verbose -- .
@@ -38,17 +42,6 @@ docker_deploy:
   only:
     - main
     - feat/cd
-  image: debian:latest
-  before_script:
-    - "command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )"
-    - eval $(ssh-agent -s)
-    - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
-    - mkdir -p ~/.ssh
-    - touch ~/.ssh/config
-    - touch ~/.ssh/known_hosts
-    - chmod -R 400 ~/.ssh
-    - ssh bridubois@languagelab.sipr.ucl.ac.be
+  image: alpine:latest
   script:
-    - cd /mnt/data/languagelab/repo/
-    - git pull
-    - docker compose up -d
+    - echo "/mnt/data/languagelab/repo/scripts/update.sh" > /mnt/pipeline
diff --git a/scripts/update.sh b/scripts/update.sh
new file mode 100755
index 00000000..030cb9aa
--- /dev/null
+++ b/scripts/update.sh
@@ -0,0 +1,7 @@
+echo "STARTED UPDATE AT $(date)" > /tmp/docker_update
+cd /mnt/data/languagelab/repo/
+git pull
+docker compose up -d
+cd scripts/surveys
+python3 survey_maker.py < .creds
+echo "END UPDATE AT $(date)" >> /tmp/docker_update
-- 
GitLab