Skip to content

Commit

Permalink
Fix show start message and failure message in the same thread with bl…
Browse files Browse the repository at this point in the history
…ocked status
  • Loading branch information
Fraggle committed Nov 27, 2024
1 parent 711f834 commit b5d68cb
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 49 deletions.
6 changes: 6 additions & 0 deletions .github/actions/slack-check-deployment-blocked/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
4 changes: 4 additions & 0 deletions .github/actions/slack-notify/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ inputs:
slack_token:
description: 'Slack bot token'
required: true
blocked:
description: 'Is deployment blocked?'
required: false

outputs:
thread_ts:
Expand Down Expand Up @@ -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>
16 changes: 9 additions & 7 deletions .github/workflows/deploy-connectors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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 }}
Expand Down
16 changes: 9 additions & 7 deletions .github/workflows/deploy-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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 }}
Expand Down
16 changes: 9 additions & 7 deletions .github/workflows/deploy-front-edge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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 }}
Expand Down
16 changes: 9 additions & 7 deletions .github/workflows/deploy-front.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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 }}
Expand Down
16 changes: 9 additions & 7 deletions .github/workflows/deploy-oauth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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 }}
Expand Down
16 changes: 9 additions & 7 deletions .github/workflows/deploy-prodbox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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 }}
Expand Down
16 changes: 9 additions & 7 deletions .github/workflows/deploy-viz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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 }}
Expand Down

0 comments on commit b5d68cb

Please sign in to comment.