From b5d68cba0599711499d35d59860fe112acc57d9d Mon Sep 17 00:00:00 2001 From: Sebastien Flory Date: Wed, 27 Nov 2024 16:45:55 +0100 Subject: [PATCH] Fix show start message and failure message in the same thread with blocked status --- .../slack-check-deployment-blocked/action.yml | 6 ++++++ .github/actions/slack-notify/action.yml | 4 ++++ .github/workflows/deploy-connectors.yml | 16 +++++++++------- .github/workflows/deploy-core.yml | 16 +++++++++------- .github/workflows/deploy-front-edge.yml | 16 +++++++++------- .github/workflows/deploy-front.yml | 16 +++++++++------- .github/workflows/deploy-oauth.yml | 16 +++++++++------- .github/workflows/deploy-prodbox.yml | 16 +++++++++------- .github/workflows/deploy-viz.yml | 16 +++++++++------- 9 files changed, 73 insertions(+), 49 deletions(-) diff --git a/.github/actions/slack-check-deployment-blocked/action.yml b/.github/actions/slack-check-deployment-blocked/action.yml index f79129f32d386..21b2273c4c5ef 100644 --- a/.github/actions/slack-check-deployment-blocked/action.yml +++ b/.github/actions/slack-check-deployment-blocked/action.yml @@ -11,6 +11,10 @@ inputs: slack_token: description: 'Slack bot token' required: true +outputs: + blocked: + description: "Is deployment blocked?" + value: ${{ steps.parse_channel_topic.outputs.blocked }} runs: using: "composite" @@ -58,8 +62,10 @@ runs: if is_blocked "${{ inputs.component }}" "${{ steps.slack_channel_topic.outputs.topic }}"; then echo "${{ inputs.component}} is blocked based on channel topic" + echo "blocked=true" >> $GITHUB_OUTPUT exit 1 else echo "${{ inputs.component}} is not blocked based on channel topic" + echo "blocked=false" >> $GITHUB_OUTPUT exit 0 fi \ No newline at end of file diff --git a/.github/actions/slack-notify/action.yml b/.github/actions/slack-notify/action.yml index 33893dbf03a49..0a30e1d159b5f 100644 --- a/.github/actions/slack-notify/action.yml +++ b/.github/actions/slack-notify/action.yml @@ -20,6 +20,9 @@ inputs: slack_token: description: 'Slack bot token' required: true + blocked: + description: 'Is deployment blocked?' + required: false outputs: thread_ts: @@ -100,4 +103,5 @@ runs: thread_ts: "${{ inputs.thread_ts }}" text: | ❌ Build pipeline failed + Is blocked by channel topic: ${{ inputs.blocked || "n/a" }} • Check logs: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View details> \ No newline at end of file diff --git a/.github/workflows/deploy-connectors.yml b/.github/workflows/deploy-connectors.yml index bef5224c7f79d..8791d9b4ba17f 100644 --- a/.github/workflows/deploy-connectors.yml +++ b/.github/workflows/deploy-connectors.yml @@ -20,13 +20,6 @@ jobs: - name: Checkout code uses: actions/checkout@v3 - - name: Slack Check Deployment Blocked - uses: ./.github/actions/slack-check-deployment-blocked - with: - component: "connectors" - channel: ${{ secrets.SLACK_CHANNEL_ID }} - slack_token: ${{ secrets.SLACK_BOT_TOKEN }} - - name: Get short sha id: short_sha run: echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT @@ -41,6 +34,14 @@ jobs: channel: ${{ secrets.SLACK_CHANNEL_ID }} slack_token: ${{ secrets.SLACK_BOT_TOKEN }} + - name: Slack Check Deployment Blocked + id: check_deployment_blocked + uses: ./.github/actions/slack-check-deployment-blocked + with: + component: "connectors" + channel: ${{ secrets.SLACK_CHANNEL_ID }} + slack_token: ${{ secrets.SLACK_BOT_TOKEN }} + - name: "Authenticate with Google Cloud" uses: "google-github-actions/auth@v1" with: @@ -91,6 +92,7 @@ jobs: uses: ./.github/actions/slack-notify with: step: "failure" + blocked: ${{ steps.check_deployment_blocked.outputs.blocked }} component: "connectors" image_tag: ${{ steps.short_sha.outputs.short_sha }} channel: ${{ secrets.SLACK_CHANNEL_ID }} diff --git a/.github/workflows/deploy-core.yml b/.github/workflows/deploy-core.yml index 019ef11155789..b83de5d77abed 100644 --- a/.github/workflows/deploy-core.yml +++ b/.github/workflows/deploy-core.yml @@ -20,13 +20,6 @@ jobs: - name: Checkout code uses: actions/checkout@v3 - - name: Slack Check Deployment Blocked - uses: ./.github/actions/slack-check-deployment-blocked - with: - component: "core" - channel: ${{ secrets.SLACK_CHANNEL_ID }} - slack_token: ${{ secrets.SLACK_BOT_TOKEN }} - - name: Get short sha id: short_sha run: echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT @@ -41,6 +34,14 @@ jobs: channel: ${{ secrets.SLACK_CHANNEL_ID }} slack_token: ${{ secrets.SLACK_BOT_TOKEN }} + - name: Slack Check Deployment Blocked + id: check_deployment_blocked + uses: ./.github/actions/slack-check-deployment-blocked + with: + component: "core" + channel: ${{ secrets.SLACK_CHANNEL_ID }} + slack_token: ${{ secrets.SLACK_BOT_TOKEN }} + - name: "Authenticate with Google Cloud" uses: "google-github-actions/auth@v1" with: @@ -91,6 +92,7 @@ jobs: uses: ./.github/actions/slack-notify with: step: "failure" + blocked: ${{ steps.check_deployment_blocked.outputs.blocked }} component: "core" image_tag: ${{ steps.short_sha.outputs.short_sha }} channel: ${{ secrets.SLACK_CHANNEL_ID }} diff --git a/.github/workflows/deploy-front-edge.yml b/.github/workflows/deploy-front-edge.yml index 46e5e5e8b4f29..a8ee6be196e65 100644 --- a/.github/workflows/deploy-front-edge.yml +++ b/.github/workflows/deploy-front-edge.yml @@ -19,13 +19,6 @@ jobs: - name: Checkout code uses: actions/checkout@v3 - - name: Slack Check Deployment Blocked - uses: ./.github/actions/slack-check-deployment-blocked - with: - component: "front-edge" - channel: ${{ secrets.SLACK_CHANNEL_ID }} - slack_token: ${{ secrets.SLACK_BOT_TOKEN }} - - name: Get short sha id: short_sha run: echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT @@ -40,6 +33,14 @@ jobs: channel: ${{ secrets.SLACK_CHANNEL_ID }} slack_token: ${{ secrets.SLACK_BOT_TOKEN }} + - name: Slack Check Deployment Blocked + id: check_deployment_blocked + uses: ./.github/actions/slack-check-deployment-blocked + with: + component: "front-edge" + channel: ${{ secrets.SLACK_CHANNEL_ID }} + slack_token: ${{ secrets.SLACK_BOT_TOKEN }} + - name: "Authenticate with Google Cloud" uses: "google-github-actions/auth@v1" with: @@ -83,6 +84,7 @@ jobs: uses: ./.github/actions/slack-notify with: step: "failure" + blocked: ${{ steps.check_deployment_blocked.outputs.blocked }} component: "front-edge" image_tag: ${{ steps.short_sha.outputs.short_sha }} channel: ${{ secrets.SLACK_CHANNEL_ID }} diff --git a/.github/workflows/deploy-front.yml b/.github/workflows/deploy-front.yml index 48bddc9509d9e..3b67eef492bc8 100644 --- a/.github/workflows/deploy-front.yml +++ b/.github/workflows/deploy-front.yml @@ -20,13 +20,6 @@ jobs: - name: Checkout code uses: actions/checkout@v3 - - name: Slack Check Deployment Blocked - uses: ./.github/actions/slack-check-deployment-blocked - with: - component: "front" - channel: ${{ secrets.SLACK_CHANNEL_ID }} - slack_token: ${{ secrets.SLACK_BOT_TOKEN }} - - name: Get short sha id: short_sha run: echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT @@ -41,6 +34,14 @@ jobs: channel: ${{ secrets.SLACK_CHANNEL_ID }} slack_token: ${{ secrets.SLACK_BOT_TOKEN }} + - name: Slack Check Deployment Blocked + id: check_deployment_blocked + uses: ./.github/actions/slack-check-deployment-blocked + with: + component: "front" + channel: ${{ secrets.SLACK_CHANNEL_ID }} + slack_token: ${{ secrets.SLACK_BOT_TOKEN }} + - name: "Authenticate with Google Cloud" uses: "google-github-actions/auth@v1" with: @@ -88,6 +89,7 @@ jobs: uses: ./.github/actions/slack-notify with: step: "failure" + blocked: ${{ steps.check_deployment_blocked.outputs.blocked }} component: "front" image_tag: ${{ steps.short_sha.outputs.short_sha }} channel: ${{ secrets.SLACK_CHANNEL_ID }} diff --git a/.github/workflows/deploy-oauth.yml b/.github/workflows/deploy-oauth.yml index 106de14b2f735..4191a8b581f04 100644 --- a/.github/workflows/deploy-oauth.yml +++ b/.github/workflows/deploy-oauth.yml @@ -20,13 +20,6 @@ jobs: - name: Checkout code uses: actions/checkout@v3 - - name: Slack Check Deployment Blocked - uses: ./.github/actions/slack-check-deployment-blocked - with: - component: "oauth" - channel: ${{ secrets.SLACK_CHANNEL_ID }} - slack_token: ${{ secrets.SLACK_BOT_TOKEN }} - - name: Get short sha id: short_sha run: echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT @@ -41,6 +34,14 @@ jobs: channel: ${{ secrets.SLACK_CHANNEL_ID }} slack_token: ${{ secrets.SLACK_BOT_TOKEN }} + - name: Slack Check Deployment Blocked + id: check_deployment_blocked + uses: ./.github/actions/slack-check-deployment-blocked + with: + component: "oauth" + channel: ${{ secrets.SLACK_CHANNEL_ID }} + slack_token: ${{ secrets.SLACK_BOT_TOKEN }} + - name: "Authenticate with Google Cloud" uses: "google-github-actions/auth@v1" with: @@ -88,6 +89,7 @@ jobs: uses: ./.github/actions/slack-notify with: step: "failure" + blocked: ${{ steps.check_deployment_blocked.outputs.blocked }} component: "oauth" image_tag: ${{ steps.short_sha.outputs.short_sha }} channel: ${{ secrets.SLACK_CHANNEL_ID }} diff --git a/.github/workflows/deploy-prodbox.yml b/.github/workflows/deploy-prodbox.yml index 1f4a6c833e96f..892aa30d21d40 100644 --- a/.github/workflows/deploy-prodbox.yml +++ b/.github/workflows/deploy-prodbox.yml @@ -21,13 +21,6 @@ jobs: fetch-depth: 0 ssh-key: "${{ secrets.PRODBOX_PRIVATE_DEPLOY_KEY }}" - - name: Slack Check Deployment Blocked - uses: ./.github/actions/slack-check-deployment-blocked - with: - component: "prodbox" - channel: ${{ secrets.SLACK_CHANNEL_ID }} - slack_token: ${{ secrets.SLACK_BOT_TOKEN }} - - name: Get short sha id: short_sha run: echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT @@ -42,6 +35,14 @@ jobs: channel: ${{ secrets.SLACK_CHANNEL_ID }} slack_token: ${{ secrets.SLACK_BOT_TOKEN }} + - name: Slack Check Deployment Blocked + id: check_deployment_blocked + uses: ./.github/actions/slack-check-deployment-blocked + with: + component: "prodbox" + channel: ${{ secrets.SLACK_CHANNEL_ID }} + slack_token: ${{ secrets.SLACK_BOT_TOKEN }} + - name: "Authenticate with Google Cloud" uses: "google-github-actions/auth@v1" with: @@ -93,6 +94,7 @@ jobs: uses: ./.github/actions/slack-notify with: step: "failure" + blocked: ${{ steps.check_deployment_blocked.outputs.blocked }} component: "prodbox" image_tag: ${{ steps.short_sha.outputs.short_sha }} channel: ${{ secrets.SLACK_CHANNEL_ID }} diff --git a/.github/workflows/deploy-viz.yml b/.github/workflows/deploy-viz.yml index a8430894aa310..6d386cce67b23 100644 --- a/.github/workflows/deploy-viz.yml +++ b/.github/workflows/deploy-viz.yml @@ -20,13 +20,6 @@ jobs: - name: Checkout code uses: actions/checkout@v3 - - name: Slack Check Deployment Blocked - uses: ./.github/actions/slack-check-deployment-blocked - with: - component: "viz" - channel: ${{ secrets.SLACK_CHANNEL_ID }} - slack_token: ${{ secrets.SLACK_BOT_TOKEN }} - - name: Get short sha id: short_sha run: echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT @@ -41,6 +34,14 @@ jobs: channel: ${{ secrets.SLACK_CHANNEL_ID }} slack_token: ${{ secrets.SLACK_BOT_TOKEN }} + - name: Slack Check Deployment Blocked + id: check_deployment_blocked + uses: ./.github/actions/slack-check-deployment-blocked + with: + component: "viz" + channel: ${{ secrets.SLACK_CHANNEL_ID }} + slack_token: ${{ secrets.SLACK_BOT_TOKEN }} + - name: "Authenticate with Google Cloud" uses: "google-github-actions/auth@v1" with: @@ -91,6 +92,7 @@ jobs: uses: ./.github/actions/slack-notify with: step: "failure" + blocked: ${{ steps.check_deployment_blocked.outputs.blocked }} component: "viz" image_tag: ${{ steps.short_sha.outputs.short_sha }} channel: ${{ secrets.SLACK_CHANNEL_ID }}