From e228c09d112f3fa34a008912a28907adba7cabb3 Mon Sep 17 00:00:00 2001 From: Mike Benowitz Date: Tue, 9 Mar 2021 11:42:37 -0500 Subject: [PATCH 1/6] NOREF Update Docker Workflow YAML --- .github/workflows/build-qa.yml | 73 ++++++++++++++++++---------------- 1 file changed, 38 insertions(+), 35 deletions(-) diff --git a/.github/workflows/build-qa.yml b/.github/workflows/build-qa.yml index 66998ad5..923b92b7 100644 --- a/.github/workflows/build-qa.yml +++ b/.github/workflows/build-qa.yml @@ -8,44 +8,47 @@ on: jobs: publish_qa: - name: Publish image to ECR - if: github.event.pull_request.merged - runs-on: ubuntu-latest - steps: - - name: checkout - - uses: actions/checkout@v2 + name: Publish image to ECR + if: github.event.pull_request.merged + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v2 - - id: nvmrc - run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc) + - id: nvmrc + run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc) + + - name: Set up node with version from nvm + uses: actions/setup-node@v2 + with: { node-version: "${{ steps.nvmrc.outputs.NODE_VERSION }}" } - - uses: actions/setup-node@v2 - with: { node-version: "${{ steps.nvmrc.outputs.NODE_VERSION }}" } - - - run: npm install - - run: npm build + - name: build next.js app + run: | + npm install + npm build - - name: Configure AWS credentials from Test account - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-east-1 + - name: Configure AWS credentials from Test account + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: us-east-1 - - name: Login to Amazon ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v1 + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 - - name: Build, tag, and push image to Amazon ECR - env: - ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} - ECR_REPOSITORY: sfr-front-end - IMAGE_TAG: ${{ github.sha }} - run: | - docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . - docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG - docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG $ECR_REGISTRY/$ECR_REPOSITORY:latest - docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest + - name: Build, tag, and push image to Amazon ECR + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: sfr-front-end + IMAGE_TAG: ${{ github.sha }} + run: | + docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . + docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG + docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG $ECR_REGISTRY/$ECR_REPOSITORY:latest + docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest - - name: Force ECS Update - run: | - aws ecs update-service --cluster sfr-front-end-qa --service sfr-front-end-qa --force-new-deployment \ No newline at end of file + - name: Force ECS Update + run: | + aws ecs update-service --cluster sfr-front-end-qa --service sfr-front-end-qa --force-new-deployment \ No newline at end of file From 364de7d55baab86324269e85094ec859bbf76a84 Mon Sep 17 00:00:00 2001 From: Mike Benowitz Date: Tue, 9 Mar 2021 11:44:04 -0500 Subject: [PATCH 2/6] NOREF Fix YAML indentation --- .github/workflows/build-qa.yml | 74 +++++++++++++++++----------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/.github/workflows/build-qa.yml b/.github/workflows/build-qa.yml index 923b92b7..3ec6c0ef 100644 --- a/.github/workflows/build-qa.yml +++ b/.github/workflows/build-qa.yml @@ -9,46 +9,46 @@ on: jobs: publish_qa: name: Publish image to ECR - if: github.event.pull_request.merged - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@v2 + if: github.event.pull_request.merged + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v2 - - id: nvmrc - run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc) - - - name: Set up node with version from nvm - uses: actions/setup-node@v2 - with: { node-version: "${{ steps.nvmrc.outputs.NODE_VERSION }}" } + - id: nvmrc + run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc) - - name: build next.js app - run: | - npm install - npm build + - name: Set up node with version from nvm + uses: actions/setup-node@v2 + with: { node-version: "${{ steps.nvmrc.outputs.NODE_VERSION }}" } + + - name: build next.js app + run: | + npm install + npm build - - name: Configure AWS credentials from Test account - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-east-1 + - name: Configure AWS credentials from Test account + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: us-east-1 - - name: Login to Amazon ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v1 + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 - - name: Build, tag, and push image to Amazon ECR - env: - ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} - ECR_REPOSITORY: sfr-front-end - IMAGE_TAG: ${{ github.sha }} - run: | - docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . - docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG - docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG $ECR_REGISTRY/$ECR_REPOSITORY:latest - docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest + - name: Build, tag, and push image to Amazon ECR + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: sfr-front-end + IMAGE_TAG: ${{ github.sha }} + run: | + docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . + docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG + docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG $ECR_REGISTRY/$ECR_REPOSITORY:latest + docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest - - name: Force ECS Update - run: | - aws ecs update-service --cluster sfr-front-end-qa --service sfr-front-end-qa --force-new-deployment \ No newline at end of file + - name: Force ECS Update + run: | + aws ecs update-service --cluster sfr-front-end-qa --service sfr-front-end-qa --force-new-deployment \ No newline at end of file From c8ff5316cc60a1035f3c43b18853bfff7d1e6a60 Mon Sep 17 00:00:00 2001 From: Mike Benowitz Date: Tue, 9 Mar 2021 11:49:00 -0500 Subject: [PATCH 3/6] NOREF More indentation fixes --- .github/workflows/build-qa.yml | 42 +++++++++++++++++----------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build-qa.yml b/.github/workflows/build-qa.yml index 3ec6c0ef..c4438b4d 100644 --- a/.github/workflows/build-qa.yml +++ b/.github/workflows/build-qa.yml @@ -28,27 +28,27 @@ jobs: npm build - name: Configure AWS credentials from Test account - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-east-1 + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: us-east-1 - - name: Login to Amazon ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v1 + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 - - name: Build, tag, and push image to Amazon ECR - env: - ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} - ECR_REPOSITORY: sfr-front-end - IMAGE_TAG: ${{ github.sha }} - run: | - docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . - docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG - docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG $ECR_REGISTRY/$ECR_REPOSITORY:latest - docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest + - name: Build, tag, and push image to Amazon ECR + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: sfr-front-end + IMAGE_TAG: ${{ github.sha }} + run: | + docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . + docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG + docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG $ECR_REGISTRY/$ECR_REPOSITORY:latest + docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest - - name: Force ECS Update - run: | - aws ecs update-service --cluster sfr-front-end-qa --service sfr-front-end-qa --force-new-deployment \ No newline at end of file + - name: Force ECS Update + run: | + aws ecs update-service --cluster sfr-front-end-qa --service sfr-front-end-qa --force-new-deployment \ No newline at end of file From 05a38f45993ecf46478b14670c8eb7386be6e26c Mon Sep 17 00:00:00 2001 From: Mike Benowitz Date: Tue, 9 Mar 2021 11:50:38 -0500 Subject: [PATCH 4/6] NOREF Remove if merged condition for testing --- .github/workflows/build-qa.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-qa.yml b/.github/workflows/build-qa.yml index c4438b4d..1b41e208 100644 --- a/.github/workflows/build-qa.yml +++ b/.github/workflows/build-qa.yml @@ -9,7 +9,8 @@ on: jobs: publish_qa: name: Publish image to ECR - if: github.event.pull_request.merged + # Temporarily removing this line for testing purposes + # if: github.event.pull_request.merged runs-on: ubuntu-latest steps: - name: checkout From 28b3ee4d0cb8e98693fda84db63d0f22f4e9bf2e Mon Sep 17 00:00:00 2001 From: Mike Benowitz Date: Tue, 9 Mar 2021 11:58:22 -0500 Subject: [PATCH 5/6] NOREF Run on all pushes --- .github/workflows/build-qa.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-qa.yml b/.github/workflows/build-qa.yml index 1b41e208..85e5506a 100644 --- a/.github/workflows/build-qa.yml +++ b/.github/workflows/build-qa.yml @@ -2,9 +2,12 @@ # build a container and deploy to ECR name: Publish qa on: - pull_request: - branches: [fc-components] - types: [pull_request] + push: + branches: + - github-actions +# pull_request: +# branches: [fc-components] +# types: [closed] jobs: publish_qa: From a73e267b16bd58c22685b63817bd8cd8cec975af Mon Sep 17 00:00:00 2001 From: Mike Benowitz Date: Tue, 9 Mar 2021 12:14:41 -0500 Subject: [PATCH 6/6] NOREF Remove install and build from action --- .github/workflows/build-qa.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/build-qa.yml b/.github/workflows/build-qa.yml index 85e5506a..a1e94446 100644 --- a/.github/workflows/build-qa.yml +++ b/.github/workflows/build-qa.yml @@ -26,11 +26,6 @@ jobs: uses: actions/setup-node@v2 with: { node-version: "${{ steps.nvmrc.outputs.NODE_VERSION }}" } - - name: build next.js app - run: | - npm install - npm build - - name: Configure AWS credentials from Test account uses: aws-actions/configure-aws-credentials@v1 with: