From 648cec167fc46721e692ca268ca59129bfee43ef Mon Sep 17 00:00:00 2001 From: Alexander Hosking Date: Wed, 20 Apr 2022 13:19:25 +0000 Subject: [PATCH 1/5] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6f9b2ca..9312062 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,7 @@ stages: - build - test + - deploy buiild job: stage: build @@ -32,3 +33,12 @@ test job: when: always reports: junit: report.xml + +deploy-period: + stage: deploy + environment: production + script: + - ssh ahosking@192.168.1.19 "cd /home/ahosking/period && git pull origin master && exit" + only: + - master + From e3d6e37fde3c0d42ad048a8f5058c37ddd03b06d Mon Sep 17 00:00:00 2001 From: Alexander Hosking Date: Wed, 20 Apr 2022 13:23:31 +0000 Subject: [PATCH 2/5] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9312062..1255595 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -37,6 +37,7 @@ test job: deploy-period: stage: deploy environment: production + image: debian:buster script: - ssh ahosking@192.168.1.19 "cd /home/ahosking/period && git pull origin master && exit" only: From 51acf0926384b015feecf46b5781b64b7878bbfe Mon Sep 17 00:00:00 2001 From: Alexander Hosking Date: Wed, 20 Apr 2022 14:18:01 +0000 Subject: [PATCH 3/5] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1255595..b07fc88 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -38,6 +38,12 @@ deploy-period: stage: deploy environment: production image: debian:buster + 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 + - chmod 700 ~/.ssh script: - ssh ahosking@192.168.1.19 "cd /home/ahosking/period && git pull origin master && exit" only: From 2122c5b0099c66c8ad11087aa63d890d221bf85f Mon Sep 17 00:00:00 2001 From: Alexander Hosking Date: Wed, 20 Apr 2022 14:23:41 +0000 Subject: [PATCH 4/5] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b07fc88..d72be17 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -44,6 +44,7 @@ deploy-period: - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - - mkdir -p ~/.ssh - chmod 700 ~/.ssh + - ssh-keyscan 192.168.1.19 script: - ssh ahosking@192.168.1.19 "cd /home/ahosking/period && git pull origin master && exit" only: From 806d9f307b23c49ca8b4b3093455e8c15ff20823 Mon Sep 17 00:00:00 2001 From: Alexander Hosking Date: Wed, 20 Apr 2022 14:27:17 +0000 Subject: [PATCH 5/5] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d72be17..7234555 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -44,7 +44,8 @@ deploy-period: - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - - mkdir -p ~/.ssh - chmod 700 ~/.ssh - - ssh-keyscan 192.168.1.19 + - ssh-keyscan 192.168.1.19 >> ~/.ssh/known_hosts + - chmod 644 ~/.ssh/known_hosts script: - ssh ahosking@192.168.1.19 "cd /home/ahosking/period && git pull origin master && exit" only: