From 8afc9e3f8f98a4838507bfd6ea1d6f33b580b2dc Mon Sep 17 00:00:00 2001 From: Duncan Ragsdale <88173870+Thistleman@users.noreply.github.com> Date: Wed, 1 May 2024 14:02:10 -0700 Subject: [PATCH 1/4] Update test-build.yml Signed-off-by: Duncan Ragsdale <88173870+Thistleman@users.noreply.github.com> --- .github/workflows/test-build.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 7488275..1d38d21 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -1,15 +1,16 @@ name: Test-build -on: +on: push: - branches-ignore: - - master + branches: [develop,master] + pull_request: + branches: [develop,master] jobs: test-build: runs-on: ubuntu-latest environment: Build steps: - name: Checkout Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install SSH key uses: shimataro/ssh-key-action@v2 @@ -20,7 +21,7 @@ jobs: if_key_exists: fail # replace / ignore / fail; optional (defaults to fail) - name: Install Python - uses: actions/setup-python@v3 + uses: actions/setup-python@v4 with: python-version: 3.8 @@ -38,7 +39,7 @@ jobs: python -m invoke test --junit --enforce-percent 97 - name: Store test results as artifacts - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: store test results path: test-results From f2a9bd08a403340ee85b19b333b94ac7a252ca7f Mon Sep 17 00:00:00 2001 From: Duncan Ragsdale <88173870+Thistleman@users.noreply.github.com> Date: Wed, 1 May 2024 14:09:16 -0700 Subject: [PATCH 2/4] Update docker-deploy-stage.yml Signed-off-by: Duncan Ragsdale <88173870+Thistleman@users.noreply.github.com> --- .github/workflows/docker-deploy-stage.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/docker-deploy-stage.yml b/.github/workflows/docker-deploy-stage.yml index feaf92f..4ae3285 100644 --- a/.github/workflows/docker-deploy-stage.yml +++ b/.github/workflows/docker-deploy-stage.yml @@ -2,14 +2,14 @@ name: Deploy Staging on: push: branches: - - master + - develop jobs: build: runs-on: ubuntu-latest environment: Build steps: - name: Checkout Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install SSH key uses: shimataro/ssh-key-action@v2 @@ -20,7 +20,7 @@ jobs: if_key_exists: fail # replace / ignore / fail; optional (defaults to fail) - name: Install Python - uses: actions/setup-python@v3 + uses: actions/setup-python@v4 with: python-version: 3.8 @@ -38,7 +38,7 @@ jobs: python3 -m invoke test --junit --enforce-percent 97 - name: Store test results as artifacts - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: store test results path: test-results @@ -57,7 +57,7 @@ jobs: DOCKER_BUILDKIT: "1" steps: - name: Checkout Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install SSH key uses: shimataro/ssh-key-action@v2 @@ -74,7 +74,7 @@ jobs: sudo chmod o+x /root/ - name: Install Python - uses: actions/setup-python@v3 + uses: actions/setup-python@v4 with: python-version: 3.8 @@ -83,7 +83,7 @@ jobs: python -m pip install --upgrade pip - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1 + uses: aws-actions/configure-aws-credentials@v4 with: aws-access-key-id: ${{ secrets.STAGE_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.STAGE_SECRET_ACCESS_KEY }} @@ -91,7 +91,7 @@ jobs: - name: Login to Amazon ECR id: login-ecr - uses: aws-actions/amazon-ecr-login@v1 + uses: aws-actions/amazon-ecr-login@v2 # uses repository in your authorized registry to push to. # sign in to your ecr page for a list of all your repositories. @@ -107,7 +107,7 @@ jobs: export DOCKER_BUILDKIT=1 docker build --build-arg SSH_PRIVATE_KEY="$(cat ~/.ssh/id_rsa)" -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f Dockerfile . docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG - echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" + echo "IMAGE=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_ENV # needed for the task-definition.json file, update task family here # can also use the CLI to manually generate the task @@ -121,7 +121,7 @@ jobs: with: task-definition: task-definition.json container-name: 'openfido-stage-app-task' - image: ${{ steps.build-image.outputs.image }} + image: ${{ env.IMAGE }} - name: Deploy Amazon ECS task definition uses: aws-actions/amazon-ecs-deploy-task-definition@v1 From c1b1d27eab545c052a5fb714574d8e960d2f363f Mon Sep 17 00:00:00 2001 From: Duncan Ragsdale <88173870+Thistleman@users.noreply.github.com> Date: Wed, 1 May 2024 14:15:11 -0700 Subject: [PATCH 3/4] Update docker-deploy-prod.yml Signed-off-by: Duncan Ragsdale <88173870+Thistleman@users.noreply.github.com> --- .github/workflows/docker-deploy-prod.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/docker-deploy-prod.yml b/.github/workflows/docker-deploy-prod.yml index 0741787..e2c6c73 100644 --- a/.github/workflows/docker-deploy-prod.yml +++ b/.github/workflows/docker-deploy-prod.yml @@ -1,8 +1,7 @@ name: Deploy Production -on: - push: - tags: - - v*.*.* +on: + release: + types: [published] jobs: deploy-production: @@ -29,7 +28,7 @@ jobs: sudo chmod o+x /root/ - name: Install Python - uses: actions/setup-python@v3 + uses: actions/setup-python@v4 with: python-version: 3.8 @@ -42,7 +41,7 @@ jobs: run: python -m pip install -r requirements.txt - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1 + uses: aws-actions/configure-aws-credentials@v4 with: aws-access-key-id: ${{ secrets.PROD_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.PROD_SECRET_ACCESS_KEY }} @@ -50,7 +49,7 @@ jobs: - name: Login to Amazon ECR id: login-ecr - uses: aws-actions/amazon-ecr-login@v1 + uses: aws-actions/amazon-ecr-login@v2 # uses repository in your authorized registry to push to. # sign in to your ecr page for a list of all your repositories. @@ -66,7 +65,7 @@ jobs: export DOCKER_BUILDKIT=1 docker build --build-arg SSH_PRIVATE_KEY="$(cat ~/.ssh/id_rsa)" -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f Dockerfile . docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG - echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" + echo "IMAGE=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_ENV # needed for the task-definition.json file, update task family here # can also use the CLI to manually generate the task @@ -80,7 +79,7 @@ jobs: with: task-definition: task-definition.json container-name: 'openfido-prod-app-task' - image: ${{ steps.build-image.outputs.image }} + image: ${{ env.IMAGE }} - name: Deploy Amazon ECS task definition uses: aws-actions/amazon-ecs-deploy-task-definition@v1 From 3d7a33d79989a404e68a62676fef8b561c5fdd48 Mon Sep 17 00:00:00 2001 From: Duncan Ragsdale <88173870+Thistleman@users.noreply.github.com> Date: Wed, 1 May 2024 14:16:52 -0700 Subject: [PATCH 4/4] Update Dockerfile fix bug in dockerfile Signed-off-by: Duncan Ragsdale <88173870+Thistleman@users.noreply.github.com> --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index d3dd5f7..b71f1d2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,7 @@ RUN apt-get update -qq && apt-get install -y ssh git # require a private key to access private github repositories ARG SSH_PRIVATE_KEY -RUN mkdir ~/.ssh/ +RUN mkdir -p ~/.ssh/ RUN echo "${SSH_PRIVATE_KEY}" > ~/.ssh/id_rsa RUN chmod 600 ~/.ssh/id_rsa RUN touch ~/.ssh/known_hosts