Skip to content

Commit

Permalink
Add: topic check for all deploys (#8963)
Browse files Browse the repository at this point in the history
* Add: topic check for all deploys

* Fix show start message and failure message in the same thread with blocked status

* Let it go if the slack api fails

* Add: better slack msg
  • Loading branch information
Fraggle authored Nov 28, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent f352f8e commit 484cb00
Showing 9 changed files with 73 additions and 8 deletions.
7 changes: 6 additions & 1 deletion .github/actions/slack-check-deployment-blocked/action.yml
Original file line number Diff line number Diff line change
@@ -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"
@@ -23,7 +27,6 @@ runs:
token: ${{ inputs.slack_token }}
payload: |
channel: ${{ inputs.channel }}
errors: true
- name: Get channel topic
if: steps.slack_channel_info.outputs.ok == 'true'
@@ -58,8 +61,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
4 changes: 4 additions & 0 deletions .github/actions/slack-notify/action.yml
Original file line number Diff line number Diff line change
@@ -20,6 +20,9 @@ inputs:
slack_token:
description: 'Slack bot token'
required: true
blocked:
description: 'Is deployment blocked?'
required: false

outputs:
thread_ts:
@@ -91,4 +94,5 @@ runs:
thread_ts: "${{ inputs.thread_ts }}"
text: |
❌ Build pipeline failed
${{ inputs.blocked == 'true' && format('Is blocked by channel topic: {0}', inputs.blocked) }}
• Check logs: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View details>
9 changes: 9 additions & 0 deletions .github/workflows/deploy-connectors.yml
Original file line number Diff line number Diff line change
@@ -34,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:
@@ -84,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 }}
9 changes: 9 additions & 0 deletions .github/workflows/deploy-core.yml
Original file line number Diff line number Diff line change
@@ -34,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:
@@ -84,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 }}
16 changes: 9 additions & 7 deletions .github/workflows/deploy-front-edge.yml
Original file line number Diff line number Diff line change
@@ -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 }}
9 changes: 9 additions & 0 deletions .github/workflows/deploy-front.yml
Original file line number Diff line number Diff line change
@@ -34,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:
@@ -81,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 }}
9 changes: 9 additions & 0 deletions .github/workflows/deploy-oauth.yml
Original file line number Diff line number Diff line change
@@ -34,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:
@@ -81,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 }}
9 changes: 9 additions & 0 deletions .github/workflows/deploy-prodbox.yml
Original file line number Diff line number Diff line change
@@ -35,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:
@@ -86,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 }}
9 changes: 9 additions & 0 deletions .github/workflows/deploy-viz.yml
Original file line number Diff line number Diff line change
@@ -34,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:
@@ -84,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 }}

0 comments on commit 484cb00

Please sign in to comment.