From 64ac78b3372ba3f176e2e9485feb585523d44bb2 Mon Sep 17 00:00:00 2001 From: Pawel Langowski Date: Wed, 24 Jul 2024 11:43:02 +0200 Subject: [PATCH] .github/workflows: Use separate SSH config for deploy job Signed-off-by: Pawel Langowski --- .github/workflows/ci.yml | 17 +++++++---------- .github/workflows/develop.yml | 17 +++++++---------- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e0a7cb62..884df5c5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,18 +51,17 @@ jobs: shell: bash env: SSH_KEY: ${{secrets.SSH_KEY}} - SSH_KEY_GITEA: ${{secrets.SSH_KEY_GITEA}} + SSH_KEY_CI_CD: ${{secrets.SSH_KEY_CI_CD}} run: | echo -e ${SSH_KEY} > ~/.ssh/dts-ci-key chmod 600 ~/.ssh/dts-ci-key - echo -e ${SSH_KEY_GITEA} > ~/.ssh/gitea-key - chmod 600 ~/.ssh/gitea-key - cp ~/.ssh/config ~/.ssh/config-old + echo -e ${SSH_KEY_CI_CD} > ~/.ssh/gitea_dts_release_cicd + chmod 600 ~/.ssh/gitea_dts_release_cicd echo -e "\n Host git.3mdeb.com\n HostName git.3mdeb.com\n - IdentityFile ~/.ssh/gitea-key\n - IdentitiesOnly yes" >> ~/.ssh/config + IdentityFile ~/.ssh/gitea_dts_release_cicd\n + IdentitiesOnly yes" > ~/.ssh/config_deploy - name: Get DTS version id: dts-ver shell: bash @@ -117,7 +116,7 @@ jobs: shell: bash run: | DTS_VER="${{steps.dts-ver.outputs.DTS_VER}}" - git clone ssh://git@git.3mdeb.com:2222/3mdeb/dts-release-cicd-pipeline.git + GIT_SSH_COMMAND='ssh -F ~/.ssh/config_deploy' git clone ssh://git@git.3mdeb.com:2222/3mdeb/dts-release-cicd-pipeline.git cd dts-release-cicd-pipeline echo ${DTS_VER} > LATEST_RELEASE git add LATEST_RELEASE @@ -138,7 +137,5 @@ jobs: run: | rm -rf ~/.ssh/dts-ci-key rm -rf dts-release-cicd-pipeline - rm -f ~/.ssh/gitea-key + rm -f ~/.ssh/gitea_dts_release_cicd rm -rf build - rm -f ~/.ssh/config - mv ~/.ssh/config-old ~/.ssh/config diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index b461ea50..3a1adcd5 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -50,18 +50,17 @@ jobs: shell: bash env: SSH_KEY: ${{secrets.SSH_KEY}} - SSH_KEY_GITEA: ${{secrets.SSH_KEY_GITEA}} + SSH_KEY_CI_CD: ${{secrets.SSH_KEY_CI_CD}} run: | echo -e ${SSH_KEY} > ~/.ssh/dts-ci-key chmod 600 ~/.ssh/dts-ci-key - echo -e ${SSH_KEY_GITEA} > ~/.ssh/gitea-key - chmod 600 ~/.ssh/gitea-key - cp ~/.ssh/config ~/.ssh/config-old + echo -e ${SSH_KEY_CI_CD} > ~/.ssh/gitea_dts_release_cicd + chmod 600 ~/.ssh/gitea_dts_release_cicd echo -e "\n Host git.3mdeb.com\n HostName git.3mdeb.com\n - IdentityFile ~/.ssh/gitea-key\n - IdentitiesOnly yes" >> ~/.ssh/config + IdentityFile ~/.ssh/gitea_dts_release_cicd\n + IdentitiesOnly yes" > ~/.ssh/config_deploy - name: Get DTS version id: dts-ver shell: bash @@ -108,7 +107,7 @@ jobs: shell: bash run: | DTS_VER="${{steps.dts-ver.outputs.DTS_VER}}" - git clone ssh://git@git.3mdeb.com:2222/3mdeb/dts-release-cicd-pipeline.git + GIT_SSH_COMMAND='ssh -F ~/.ssh/config_deploy' git clone ssh://git@git.3mdeb.com:2222/3mdeb/dts-release-cicd-pipeline.git cd dts-release-cicd-pipeline echo ${DTS_VER} > LATEST_RELEASE git add LATEST_RELEASE @@ -129,7 +128,5 @@ jobs: run: | rm -rf ~/.ssh/dts-ci-key rm -rf dts-release-cicd-pipeline - rm -f ~/.ssh/gitea-key + rm -f ~/.ssh/gitea_dts_release_cicd rm -rf build - rm -f ~/.ssh/config - mv ~/.ssh/config-old ~/.ssh/config