From 1dc23a94581bb006da8b90808ab4a01fb31f9a76 Mon Sep 17 00:00:00 2001 From: Justin Persaud Date: Tue, 9 Jul 2024 11:24:24 -0400 Subject: [PATCH 1/4] Warn on production deploy failure --- .github/workflows/deploy.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 624c00de6831..ca85cc9b7181 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -68,3 +68,21 @@ jobs: run: gh release create ${{ env.PRODUCTION_VERSION }} --generate-notes env: GITHUB_TOKEN: ${{ steps.setupGitForOSBotify.outputs.OS_BOTIFY_API_TOKEN }} + + - name: Warn deployers if production deploy failed + if: ${{ failure() }} + uses: 8398a7/action-slack@v3 + with: + status: custom + custom_payload: | + { + channel: '#deployer', + attachments: [{ + color: "#DB4545", + pretext: ``, + text: `💥 NewDot production deploy failed. 💥`, + }] + } + env: + GITHUB_TOKEN: ${{ github.token }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} From bc62bd3025943891f5ee08d4a0578187556792f8 Mon Sep 17 00:00:00 2001 From: Justin Persaud Date: Tue, 9 Jul 2024 11:25:03 -0400 Subject: [PATCH 2/4] warn for staging too --- .github/workflows/deploy.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index ca85cc9b7181..ed2a1e7b7f85 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -28,6 +28,24 @@ jobs: - name: 🚀 Push tags to trigger staging deploy 🚀 run: git push --tags + + - name: Warn deployers if staging deploy failed + if: ${{ failure() }} + uses: 8398a7/action-slack@v3 + with: + status: custom + custom_payload: | + { + channel: '#deployer', + attachments: [{ + color: "#DB4545", + pretext: ``, + text: `💥 NewDot staging deploy failed. 💥`, + }] + } + env: + GITHUB_TOKEN: ${{ github.token }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} deployProduction: runs-on: ubuntu-latest From 41a2d1be99a3766b76d8aadc678c082044186646 Mon Sep 17 00:00:00 2001 From: Justin Persaud Date: Tue, 9 Jul 2024 11:55:26 -0400 Subject: [PATCH 3/4] use our own release notes --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index ed2a1e7b7f85..5030ea1c2f2b 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -83,7 +83,7 @@ jobs: PR_LIST: ${{ steps.getReleasePRList.outputs.PR_LIST }} - name: 🚀 Create release to trigger production deploy 🚀 - run: gh release create ${{ env.PRODUCTION_VERSION }} --generate-notes + run: gh release create ${{ env.PRODUCTION_VERSION }} --notes '${{ steps.getReleaseBody.outputs.RELEASE_BODY }}' env: GITHUB_TOKEN: ${{ steps.setupGitForOSBotify.outputs.OS_BOTIFY_API_TOKEN }} From b29732e4b5896f6e2c1e937287e9ad3b185d8459 Mon Sep 17 00:00:00 2001 From: rory Date: Tue, 9 Jul 2024 13:27:22 -0700 Subject: [PATCH 4/4] Add mock steps --- workflow_tests/mocks/deployMocks.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/workflow_tests/mocks/deployMocks.ts b/workflow_tests/mocks/deployMocks.ts index 2fda1efe8e78..5d711b892002 100644 --- a/workflow_tests/mocks/deployMocks.ts +++ b/workflow_tests/mocks/deployMocks.ts @@ -10,11 +10,13 @@ const DEPLOY_STAGING__SETUP_GIT__STEP_MOCK = createMockStep('Setup git for OSBot ]); const DEPLOY_STAGING__TAG_VERSION__STEP_MOCK = createMockStep('Tag version', 'Tagging new version', 'DEPLOY_STAGING'); const DEPLOY_STAGING__PUSH_TAG__STEP_MOCK = createMockStep('🚀 Push tags to trigger staging deploy 🚀', 'Pushing tag to trigger staging deploy', 'DEPLOY_STAGING'); +const DEPLOY_STAGING__WARN_DEPLOYERS__STEP_MOCK = createMockStep('Warn deployers if staging deploy failed', 'Warning deployers in slack for workflow failure', 'DEPLOY_STAGING'); const DEPLOY_STAGING_STEP_MOCKS = [ DEPLOY_STAGING__CHECKOUT__STEP_MOCK, DEPLOY_STAGING__SETUP_GIT__STEP_MOCK, DEPLOY_STAGING__TAG_VERSION__STEP_MOCK, DEPLOY_STAGING__PUSH_TAG__STEP_MOCK, + DEPLOY_STAGING__WARN_DEPLOYERS__STEP_MOCK, ] as const satisfies StepIdentifier[]; const DEPLOY_PRODUCTION__CHECKOUT__STEP_MOCK = createMockStep('Checkout', 'Checking out', 'DEPLOY_PRODUCTION', ['ref', 'token']); @@ -47,6 +49,7 @@ const DEPLOY_PRODUCTION__CREATE_RELEASE__STEP_MOCK = createMockStep( [], ['GITHUB_TOKEN'], ); +const DEPLOY_PRODUCTION__WARN_DEPLOYERS__STEP_MOCK = createMockStep('Warn deployers if production deploy failed', 'Warning deployers in slack for workflow failure', 'DEPLOY_STAGING'); const DEPLOY_PRODUCTION_STEP_MOCKS = [ DEPLOY_PRODUCTION__CHECKOUT__STEP_MOCK, DEPLOY_PRODUCTION__SETUP_GIT__STEP_MOCK, @@ -54,6 +57,7 @@ const DEPLOY_PRODUCTION_STEP_MOCKS = [ DEPLOY_PRODUCTION__RELEASE_PR_LIST__STEP_MOCK, DEPLOY_PRODUCTION__GENERATE_RELEASE_BODY__STEP_MOCK, DEPLOY_PRODUCTION__CREATE_RELEASE__STEP_MOCK, + DEPLOY_PRODUCTION__WARN_DEPLOYERS__STEP_MOCK, ] as const satisfies StepIdentifier[]; export default {DEPLOY_STAGING_STEP_MOCKS, DEPLOY_PRODUCTION_STEP_MOCKS};