From 62e0b352d4603582e397e3a29746697a9e7f4069 Mon Sep 17 00:00:00 2001 From: Trent Smith Date: Thu, 21 Sep 2023 13:18:48 -0700 Subject: [PATCH 1/2] If create rdev get's skipped during PR creation and update fails, the rdev will be created Signed-off-by: Trent Smith --- .github/workflows/rdev-update-for-pr.yml | 25 ++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/.github/workflows/rdev-update-for-pr.yml b/.github/workflows/rdev-update-for-pr.yml index bac013f525d9e..a3755ff21f428 100644 --- a/.github/workflows/rdev-update-for-pr.yml +++ b/.github/workflows/rdev-update-for-pr.yml @@ -16,6 +16,7 @@ env: COMPOSE_DOCKER_CLI_BUILD: 1 DOCKER_REPO: ${{ secrets.ECR_REPO }}/ STACK_NAME: pr-${{ github.event.number }} + HAPPY_VERSION: "0.92.0" permissions: id-token: write @@ -84,24 +85,28 @@ jobs: id: pre_happy run: | echo "IMAGE_TAG=sha-${GITHUB_SHA:0:8}" >> $GITHUB_OUTPUT - if [[ "${{ github.event.action }}" != "synchronize" ]]; then - echo "operation=create" >> $GITHUB_OUTPUT - else - echo "operation=update" >> $GITHUB_OUTPUT - # Check if the pull request was recently created, in the last 5min. If so skip updating the rdev. - fi - - name: Create/Update deployment + - name: Update deployment + if: github.event.action == 'synchronize' uses: chanzuckerberg/github-actions/.github/actions/deploy-happy-stack@deploy-happy-stack-v1.7.2 + continue-on-error: true with: tfe-token: ${{ secrets.TFE_TOKEN }} stack-name: ${{ env.STACK_NAME }} operation: ${{ steps.pre_happy.outputs.operation }} tag: ${{ steps.pre_happy.outputs.IMAGE_TAG }} - happy_version: "0.92.0" + happy_version: ${{ env.HAPPY_VERSION }} + - name: Create deployment + if: github.event.action != 'synchronize' || failure() + uses: chanzuckerberg/github-actions/.github/actions/deploy-happy-stack@deploy-happy-stack-v1.7.2 + with: + tfe-token: ${{ secrets.TFE_TOKEN }} + stack-name: ${{ env.STACK_NAME }} + operation: ${{ steps.pre_happy.outputs.operation }} + tag: ${{ steps.pre_happy.outputs.IMAGE_TAG }} + happy_version: ${{ env.HAPPY_VERSION }} + summarize: runs-on: ubuntu-22.04 - needs: - - create-rdev if: github.event.action == 'opened' steps: - name: Summerize deployment From 62ba601116b2e7a4220ff73baedf940130425bee Mon Sep 17 00:00:00 2001 From: Trent Smith Date: Thu, 21 Sep 2023 13:36:19 -0700 Subject: [PATCH 2/2] use deploy happy defaults of create-or-update Signed-off-by: Trent Smith --- .github/workflows/rdev-update-for-pr.yml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/.github/workflows/rdev-update-for-pr.yml b/.github/workflows/rdev-update-for-pr.yml index a3755ff21f428..2c6dfbbe06f28 100644 --- a/.github/workflows/rdev-update-for-pr.yml +++ b/.github/workflows/rdev-update-for-pr.yml @@ -63,7 +63,7 @@ jobs: --docker-compose-env-file envfile --aws-profile "" \ --tags ${IMAGE_TAG},${STACK_NAME},branch-$(echo ${GITHUB_REF_NAME} | sed 's/[\+\/]/-/g') - create-rdev: + deploy-rdev: runs-on: ubuntu-22.04 needs: - build-images @@ -92,16 +92,6 @@ jobs: with: tfe-token: ${{ secrets.TFE_TOKEN }} stack-name: ${{ env.STACK_NAME }} - operation: ${{ steps.pre_happy.outputs.operation }} - tag: ${{ steps.pre_happy.outputs.IMAGE_TAG }} - happy_version: ${{ env.HAPPY_VERSION }} - - name: Create deployment - if: github.event.action != 'synchronize' || failure() - uses: chanzuckerberg/github-actions/.github/actions/deploy-happy-stack@deploy-happy-stack-v1.7.2 - with: - tfe-token: ${{ secrets.TFE_TOKEN }} - stack-name: ${{ env.STACK_NAME }} - operation: ${{ steps.pre_happy.outputs.operation }} tag: ${{ steps.pre_happy.outputs.IMAGE_TAG }} happy_version: ${{ env.HAPPY_VERSION }}