From 6fd1cb2f1ba3d3ff2061dc283c3ff665a2b81e73 Mon Sep 17 00:00:00 2001 From: Imran Hussain Date: Sat, 1 Jan 2022 12:50:21 +0000 Subject: [PATCH 1/5] Add github mirror step --- .gitlab-ci.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fa6b6a8..e480d43 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,10 +3,22 @@ image: entrypoint: [""] stages: + - mirror - test - build - deploy +Mirror to Github: + stage: mirror + image: debian:stable + script: + - apt update -y && apt install openssh-client git -y + - mkdir -p ~/.ssh + - chmod 700 ~/.ssh + - echo $SSH_PRIVATE_KEY_B64 | base64 -d > ~/.ssh/id_ed25519 + - chmod 600 ~/.ssh/id_ed25519 + - git push --mirror git@github.com:imranh2/marvin.git + Run Tests: stage: test image: node:lts @@ -47,4 +59,4 @@ Deploy Tag: - ssh root@192.168.10.59 "docker docker rmi --force $CI_REGISTRY_IMAGE 2>/dev/null || true" - ssh root@192.168.10.59 "docker run -d --name marvin -v /opt/marvin/.env:/opt/nodeapp/.env $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME" environment: - name: production \ No newline at end of file + name: production -- GitLab From aad12731c03bda7f86bc378e07073b3264d9927d Mon Sep 17 00:00:00 2001 From: Imran Hussain Date: Sat, 1 Jan 2022 12:54:00 +0000 Subject: [PATCH 2/5] Github.com ssh host key scan --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e480d43..8556472 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -17,6 +17,7 @@ Mirror to Github: - chmod 700 ~/.ssh - echo $SSH_PRIVATE_KEY_B64 | base64 -d > ~/.ssh/id_ed25519 - chmod 600 ~/.ssh/id_ed25519 + - ssh-keyscan -H github.com >> ~/.ssh/known_hosts - git push --mirror git@github.com:imranh2/marvin.git Run Tests: -- GitLab From 5c1d9e5942c0aebbed175c6f0b766b9ace91c00a Mon Sep 17 00:00:00 2001 From: Imran Hussain Date: Sat, 1 Jan 2022 12:56:51 +0000 Subject: [PATCH 3/5] Update .gitlab-ci.yml --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8556472..f71ce1b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,7 +15,7 @@ Mirror to Github: - apt update -y && apt install openssh-client git -y - mkdir -p ~/.ssh - chmod 700 ~/.ssh - - echo $SSH_PRIVATE_KEY_B64 | base64 -d > ~/.ssh/id_ed25519 + - echo -n $SSH_PRIVATE_KEY_B64 | base64 -d > ~/.ssh/id_ed25519 - chmod 600 ~/.ssh/id_ed25519 - ssh-keyscan -H github.com >> ~/.ssh/known_hosts - git push --mirror git@github.com:imranh2/marvin.git -- GitLab From 7c8ad444ebade92110ed59862eb5fdb78ef5af98 Mon Sep 17 00:00:00 2001 From: Imran Hussain Date: Sat, 1 Jan 2022 12:59:30 +0000 Subject: [PATCH 4/5] Update .gitlab-ci.yml --- .gitlab-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f71ce1b..3c4b509 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,7 +15,8 @@ Mirror to Github: - apt update -y && apt install openssh-client git -y - mkdir -p ~/.ssh - chmod 700 ~/.ssh - - echo -n $SSH_PRIVATE_KEY_B64 | base64 -d > ~/.ssh/id_ed25519 + - echo $SSH_PRIVATE_KEY_B64 | base64 -d > ~/.ssh/id_ed25519 + - cat ~/.ssh/id_ed25519 - chmod 600 ~/.ssh/id_ed25519 - ssh-keyscan -H github.com >> ~/.ssh/known_hosts - git push --mirror git@github.com:imranh2/marvin.git -- GitLab From c224048f331e7afbf4887fda622dc5cfe47badbd Mon Sep 17 00:00:00 2001 From: Imran Hussain Date: Sat, 1 Jan 2022 13:02:03 +0000 Subject: [PATCH 5/5] Update .gitlab-ci.yml --- .gitlab-ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3c4b509..8556472 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,7 +16,6 @@ Mirror to Github: - mkdir -p ~/.ssh - chmod 700 ~/.ssh - echo $SSH_PRIVATE_KEY_B64 | base64 -d > ~/.ssh/id_ed25519 - - cat ~/.ssh/id_ed25519 - chmod 600 ~/.ssh/id_ed25519 - ssh-keyscan -H github.com >> ~/.ssh/known_hosts - git push --mirror git@github.com:imranh2/marvin.git -- GitLab