Skip to content

Commit

Permalink
Migrate to slack notifications (#481)
Browse files Browse the repository at this point in the history
* Migrate to slack notifications

Migrate away from Discord and to Slack notifications
Notifications are going to #mondoo-ops via the Mondoo App

Signed-off-by: Philip Balinov <[email protected]>

* Cleanup slack step a bit

---------

Signed-off-by: Philip Balinov <[email protected]>
  • Loading branch information
philipbalinov authored Oct 16, 2024
1 parent f0115bf commit a230a31
Show file tree
Hide file tree
Showing 2 changed files with 126 additions and 13 deletions.
71 changes: 64 additions & 7 deletions .github/workflows/check_gpg_key_not_expired.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,45 @@ on:
jobs:
check_gpg:
name: Check Mondoo's GPG key has not expired
env:
# C07R9GSGKEU == #mondoo-ops
SLACK_BOT_CHANNEL_ID: "C07R9GSGKEU"

runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4

- id: slack
uses: slackapi/[email protected]
with:
channel-id: ${{ env.SLACK_BOT_CHANNEL_ID }}
payload: |
{
"attachments": [
{
"color": "#FFFF00",
"blocks": [
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "<${{ github.event.workflow_run.html_url }}|${{ github.event.workflow_run.name }}>"
},
{
"type": "mrkdwn",
"text": "*Status:*\n`In Progress`"
}
]
}
]
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

- name: Install Mondoo cnspec
shell: bash
run: |
Expand All @@ -32,11 +66,34 @@ jobs:
shell: bash
run: |
bash test/scripts/cert-harmony.sh
- name: Discord notification
uses: Ilshidur/[email protected]
if: failure()
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
- uses: slackapi/[email protected]
if: always()
with:
args: ':warning: Mondoo GPG key is expiring or out of sync! (https://github.com/mondoohq/installer/actions/workflows/check_gpg_key_not_expired.yml)'
channel-id: ${{ env.SLACK_BOT_CHANNEL_ID }}
update-ts: ${{ steps.slack.outputs.ts }}
payload: |
{
"attachments": [
{
"color": "${{ job.status == 'success' && '#00FF00' || job.status == 'failure' && '#FF0000' || '#FFA500' }}",
"blocks": [
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "<${{ github.event.workflow_run.html_url }}|${{ github.event.workflow_run.name }}>"
},
{
"type": "mrkdwn",
"text": "*Status:*\n`${{ job.status }}`"
}
]
}
]
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
68 changes: 62 additions & 6 deletions .github/workflows/test_install_sh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ on:
jobs:
build_container:
runs-on: ubuntu-latest
env:
# C07R9GSGKEU == #mondoo-ops
SLACK_BOT_CHANNEL_ID: "C07R9GSGKEU"
timeout-minutes: 10
strategy:
matrix:
Expand All @@ -33,6 +36,36 @@ jobs:
with:
fetch-depth: 0

- id: slack
uses: slackapi/[email protected]
with:
channel-id: ${{ env.SLACK_BOT_CHANNEL_ID }}
payload: |
{
"attachments": [
{
"color": "#FFFF00",
"blocks": [
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "<${{ github.event.workflow_run.html_url }}|${{ github.event.workflow_run.name }}>"
},
{
"type": "mrkdwn",
"text": "*Status:*\n`In Progress`"
}
]
}
]
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
Expand All @@ -51,10 +84,33 @@ jobs:
tags: |
mondoohq/mondoo-install-test:${{ matrix.dockerfile }}
- name: Discord notification
uses: Ilshidur/[email protected]
if: failure()
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
- uses: slackapi/[email protected]
if: always()
with:
args: ':warning: Mondoo install failed in test container! (https://github.com/mondoohq/installer/actions/workflows/test_with_container_build.yml)'
channel-id: ${{ env.SLACK_BOT_CHANNEL_ID }}
update-ts: ${{ steps.slack.outputs.ts }}
payload: |
{
"attachments": [
{
"color": "${{ job.status == 'success' && '#00FF00' || job.status == 'failure' && '#FF0000' || '#FFA500' }}",
"blocks": [
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "<${{ github.event.workflow_run.html_url }}|${{ github.event.workflow_run.name }}>"
},
{
"type": "mrkdwn",
"text": "*Status:*\n`${{ job.status }}`"
}
]
}
]
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

0 comments on commit a230a31

Please sign in to comment.