From b203779e0b84eb72f09d8cf94b926b06d89c9aa9 Mon Sep 17 00:00:00 2001
From: "a.dzehil" <a.dzehil@gmail.com>
Date: Thu, 20 Mar 2025 18:33:13 +0300
Subject: [PATCH] Change ci file

---
 .gitlab-ci.yml | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 3574201..18d8fb3 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -21,18 +21,14 @@ deploy:
     GIT_REMOTE_URL: ssh://dokku@${APP_URL}:22/${APP_NAME}
     DOKKU_DEPLOY_BRANCH: dev
   before_script:
-    - eval $(ssh-agent -s)
-    - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
     - mkdir -p ~/.ssh
     - chmod 700 ~/.ssh
-    - ssh-keyscan -H ${APP_URL} >> ~/.ssh/known_hosts
-    - chmod 644 ~/.ssh/known_hosts
-    - echo "StrictHostKeyChecking no" >> ~/.ssh/config
+    - echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
+    - chmod 600 ~/.ssh/id_rsa
+    - echo -e "Host ${APP_URL}\n\tStrictHostKeyChecking no\n\tUserKnownHostsFile=/dev/null" > ~/.ssh/config
     - chmod 600 ~/.ssh/config
   script:
-    - dokku-deploy
+    - dokku-deploy || true
   after_script:
-    - |
-      eval $(ssh-agent -s)
-      echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
-      ssh dokku@${APP_URL} apps:unlock ${APP_NAME} || true
\ No newline at end of file
+    - sleep 5
+    - ssh -i ~/.ssh/id_rsa -o ConnectTimeout=10 dokku@${APP_URL} apps:unlock ${APP_NAME} || true
\ No newline at end of file
-- 
2.18.1