From b5e942ab6424608cf1a3b8aab190aab04dd23b8b Mon Sep 17 00:00:00 2001 From: erosenthal Date: Mon, 27 Sep 2021 15:29:09 -0400 Subject: [PATCH 1/3] push images to ACC:rocketchat in ECR --- .github/workflows/build_and_test.yml | 34 ++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index e24a42baa911..713d795dd98f 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -559,8 +559,6 @@ jobs: docker build -t ${IMAGE}:develop . docker push ${IMAGE}:develop - # TODO: configure for merges to develop when ready - # NOTE: Right now it will only push on every merge into develop_pwa because we have a standing PR from it -> develop. widechat-ecr-push: runs-on: ubuntu-latest if: ${{ github.ref == 'refs/heads/develop_pwa' && github.event_name == 'push' }} @@ -576,11 +574,9 @@ jobs: - name: Parse for branch run: | - git_ref=${{ github.ref }} - arrRef=(${git_ref//\// }) - branch=${arrRef[2]} - echo "branch is this: $branch" - echo "PR_TAG=latest-$branch" >> $GITHUB_ENV + git_hash=$(git rev-parse --short "$GITHUB_SHA") + rocket_version=$(node -pe "require('./package.json').version") + echo "PR_TAG=v$rocket_version.$git_hash" >> $GITHUB_ENV - name: Restore build uses: actions/download-artifact@v1 @@ -643,3 +639,27 @@ jobs: # Tag docker image and push it to ECR docker tag ${{ steps.build-image-dev.outputs.DEV_IMAGE }} $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG + + ## Push to ACC + - name: Configure AWS credentials in ACC + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.ACC_ACCESS_KEY }} + aws-secret-access-key: ${{ secrets.ACC_SECRET_ACCESS_KEY }} + aws-region: us-east-1 + + - name: Login to Amazon ECR + id: login-ecr-acc + uses: aws-actions/amazon-ecr-login@v1 + + - name: tag, and push image to Amazon ECR in ACC + id: tag-image + env: + ECR_REGISTRY: ${{ steps.login-ecr-acc.outputs.registry }} + ECR_REPOSITORY: rocketchat + IMAGE_TAG: ${{ env.PR_TAG }} + + run: | + # Tag docker image and push it to ECR + docker tag ${{ steps.build-image-dev.outputs.DEV_IMAGE }} $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG + docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG From 33d45cf8364f04ceee4e7aab1ae88bd1c8c2252c Mon Sep 17 00:00:00 2001 From: erosenthal Date: Mon, 27 Sep 2021 15:47:35 -0400 Subject: [PATCH 2/3] retrigger tests --- .github/workflows/build_and_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 713d795dd98f..4e680b0e3af8 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -640,7 +640,7 @@ jobs: docker tag ${{ steps.build-image-dev.outputs.DEV_IMAGE }} $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG - ## Push to ACC + ## Push to ACC:rocketchat - name: Configure AWS credentials in ACC uses: aws-actions/configure-aws-credentials@v1 with: From e4d2fa408e363b26d922961d3a05abd06226c8c5 Mon Sep 17 00:00:00 2001 From: erosenthal Date: Mon, 27 Sep 2021 15:53:32 -0400 Subject: [PATCH 3/3] do not reuse id --- .github/workflows/build_and_test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 4e680b0e3af8..375cf6de4f2e 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -653,7 +653,6 @@ jobs: uses: aws-actions/amazon-ecr-login@v1 - name: tag, and push image to Amazon ECR in ACC - id: tag-image env: ECR_REGISTRY: ${{ steps.login-ecr-acc.outputs.registry }} ECR_REPOSITORY: rocketchat