From 0b79474cfdec7a95145f2d6cc89270c1c5d9749f Mon Sep 17 00:00:00 2001 From: Ilja Date: Tue, 21 Nov 2023 15:32:13 +0200 Subject: [PATCH] Deploy services --- .github/workflows/build.yml | 31 ++++++++++++++++++++++++++----- api-gateway/Dockerfile | 3 +++ 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 159a09a..4e35c8b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -166,12 +166,12 @@ jobs: compose/tests-all.log retention-days: 2 - tag: - if: ${{ github.ref == 'refs/heads/master' }} + deploy: + #if: ${{ github.ref == 'refs/heads/master' }} runs-on: ubuntu-latest - needs: - - test - - dockerize + #needs: + # - test + # - dockerize strategy: fail-fast: false matrix: @@ -188,10 +188,31 @@ jobs: aws-region: ${{ env.AWS_REGION }} role-to-assume: ${{ secrets.AWS_ROLE }} role-duration-seconds: 1200 + role-session-name: "ci-shared" - name: Retag + if: false # TODO run: | for repository in service api-gateway frontend; do MANIFEST=$(aws ecr batch-get-image --repository-name "oppivelvollisuus/$repository" --image-ids imageTag="${{ github.event.pull_request.head.sha || github.sha }}" --output json | jq --raw-output --join-output '.images[0].imageManifest') aws ecr put-image --repository-name "oppivelvollisuus/$repository" --image-tag "env-${{ matrix.environment }}" --image-manifest "$MANIFEST" done + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + aws-region: ${{ env.AWS_REGION }} + role-to-assume: voltti-ci-oppivelvollisuus-${{ matrix.environment }} + role-duration-seconds: 1200 + role-session-name: "ci-${{ matrix.environment }}" + unset-current-credentials: true + + - name: Deploy + run: | + aws ecs update-service \ + --cluster "oppivelvollisuus-${{ matrix.environment }}" \ + --service "oppivelvollisuus-${{ matrix.environment }}" \ + --force-new-deployment + aws ecs wait services-stable \ + --cluster "oppivelvollisuus-${{ matrix.environment }}" \ + --services "oppivelvollisuus-${{ matrix.environment }}" diff --git a/api-gateway/Dockerfile b/api-gateway/Dockerfile index 9e5f56a..78cb36e 100644 --- a/api-gateway/Dockerfile +++ b/api-gateway/Dockerfile @@ -25,6 +25,9 @@ FROM builder ENV NODE_ENV production +RUN apt-get update \ + && apt-get -y install curl + ARG build=none ARG commit=none