From 44681609d83e253a5e95d400348a71c2bbceaedc Mon Sep 17 00:00:00 2001 From: Emil Balitzki Date: Sun, 7 Jul 2024 00:10:46 +0200 Subject: [PATCH] Fixed production ci-cd Signed-off-by: Emil Balitzki --- .github/workflows/deploy_production.yml | 10 +++++----- .github/workflows/deploy_test.yml | 21 ++++++++++++--------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/.github/workflows/deploy_production.yml b/.github/workflows/deploy_production.yml index 78c7bd54..4c256601 100644 --- a/.github/workflows/deploy_production.yml +++ b/.github/workflows/deploy_production.yml @@ -20,7 +20,7 @@ jobs: service: - name: frontend context: ./frontend - docker_dir: + docker_dir: - name: api-gateway context: ./backend docker_dir: /api-gateway @@ -31,11 +31,11 @@ jobs: context: ./backend docker_dir: /src/BIE.DataPipeline - name: sql-database - context: ./backend - docker_dir: /sql-database + context: ./backend/sql-database + docker_dir: - name: metadata-database - context: ./backend - docker_dir: /metadata-database + context: ./backend/metadata-database + docker_dir: steps: - name: Checkout repository diff --git a/.github/workflows/deploy_test.yml b/.github/workflows/deploy_test.yml index 42af928e..933b0252 100644 --- a/.github/workflows/deploy_test.yml +++ b/.github/workflows/deploy_test.yml @@ -23,7 +23,7 @@ jobs: service: - name: frontend context: ./frontend - docker_dir: + docker_dir: - name: api-gateway context: ./backend docker_dir: /api-gateway @@ -35,10 +35,11 @@ jobs: docker_dir: /src/BIE.DataPipeline - name: sql-database context: ./backend/sql-database - docker_dir: + docker_dir: - name: metadata-database context: ./backend/metadata-database - docker_dir: + docker_dir: + steps: - name: Checkout repository uses: actions/checkout@v4 @@ -82,20 +83,22 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + with: + ref: ${{github.ref_name}} - name: Install SSH key run: | install -m 600 -D /dev/null ~/.ssh/id_rsa - echo "${{ secrets.TEST_ENV_SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa - ssh-keyscan -H ${{ secrets.TEST_ENV_SSH_HOST }} > ~/.ssh/known_hosts + echo "${{secrets.TEST_ENV_SSH_PRIVATE_KEY}}" > ~/.ssh/id_rsa + ssh-keyscan -H ${{secrets.TEST_ENV_SSH_HOST}} > ~/.ssh/known_hosts - name: Copy necessary files run: | - scp ./docker-compose.yml ${{ secrets.TEST_ENV_SSH_USER }}@${{ secrets.TEST_ENV_SSH_HOST }}:/var/lib/bie - scp ./.env.test ${{ secrets.TEST_ENV_SSH_USER }}@${{ secrets.TEST_ENV_SSH_HOST }}:/var/lib/bie/.env + scp ./docker-compose.yml ${{secrets.TEST_ENV_SSH_USER}}@${{secrets.TEST_ENV_SSH_HOST}}:/var/lib/bie + scp ./.env.test ${{secrets.TEST_ENV_SSH_USER }}@${{secrets.TEST_ENV_SSH_HOST}}:/var/lib/bie/.env - name: Connect and Pull - run: ssh ${{ secrets.TEST_ENV_SSH_USER }}@${{ secrets.TEST_ENV_SSH_HOST }} "cd /var/lib/bie && docker compose down -v && docker compose pull && docker compose up -d --remove-orphans --force-recreate && exit" + run: ssh ${{secrets.TEST_ENV_SSH_USER}}@${{secrets.TEST_ENV_SSH_HOST}} "cd /var/lib/bie && docker compose down -v && docker compose pull && docker compose up -d --remove-orphans --force-recreate && exit" - name: Cleanup - run: rm -rf ~/.ssh \ No newline at end of file + run: rm -rf ~/.ssh