Skip to content

Commit

Permalink
🤖 Notify of main failures via slack
Browse files Browse the repository at this point in the history
This introduces a way for the main branch to notify in the slack channel
when failures happen on the main branch. Currently we have no visibility
over what happens on the main branhc unless we check manually. And as we
are moving more jobs to be run only in the main branch we need to keep
up to date on those failures.

Signed-off-by: Itxaka <[email protected]>
  • Loading branch information
Itxaka committed Jul 19, 2023
1 parent 9a0f215 commit 1f1586f
Show file tree
Hide file tree
Showing 16 changed files with 769 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/reusable-build-flavor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ jobs:
FLAVOR: ${{ inputs.flavor }}
IMAGE: quay.io/kairos/core-${{ inputs.flavor }}:latest
run: |
exit 1
earthly +ci --SECURITY_SCANS=false --IMAGE=$IMAGE --FLAVOR=$FLAVOR
sudo mv build/* .
sudo rm -rf build
Expand Down Expand Up @@ -126,3 +127,51 @@ jobs:
run: |
docker tag quay.io/kairos/core-${{ inputs.flavor }}:latest ttl.sh/kairos-${{ inputs.flavor }}-${{ github.sha }}:24h
docker push ttl.sh/kairos-${{ inputs.flavor }}-${{ github.sha }}:24h
- name: save commit-message
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} && failure()
run: echo "COMMIT_MSG=$(git log -1 --pretty=format:%s)" >> $GITHUB_ENV
- name: notify if failure
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} && failure()
uses: slackapi/[email protected]
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
with:
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Job failure on main branch for job ${{ github.job }} in workflow \"${{ github.workflow }}\"\n\nCommit message is \"${{ env.COMMIT_MSG }}\"\n\n Commit sha is <https://github.com/${{ github.repository }}/commit/${{ github.sha }}|${{ github.sha }}>"
}
},
{
"type": "divider"
},
{
"type": "actions",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": ":thisisfine: Failed Run",
"emoji": true
},
"url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
},
{
"type": "button",
"text": {
"type": "plain_text",
"text": ":kairos: Repository link",
"emoji": true
},
"url": "https://github.com/${{ github.repository }}"
}
]
}
]
}
48 changes: 48 additions & 0 deletions .github/workflows/reusable-build-framework-flavor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,51 @@ jobs:
earthly +build-framework-image --FLAVOR=${FLAVOR} --VERSION=master
docker push "$IMAGE:$TAG" # Otherwise .RepoDigests will be empty for some reason
cosign sign $(docker image inspect --format='{{index .RepoDigests 0}}' "$IMAGE:$TAG")
- name: save commit-message
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} && failure()
run: echo "COMMIT_MSG=$(git log -1 --pretty=format:%s)" >> $GITHUB_ENV
- name: notify if failure
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} && failure()
uses: slackapi/[email protected]
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
with:
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Job failure on main branch for job ${{ github.job }} in workflow \"${{ github.workflow }}\"\n\nCommit message is \"${{ env.COMMIT_MSG }}\"\n\n Commit sha is <https://github.com/${{ github.repository }}/commit/${{ github.sha }}|${{ github.sha }}>"
}
},
{
"type": "divider"
},
{
"type": "actions",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": ":thisisfine: Failed Run",
"emoji": true
},
"url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
},
{
"type": "button",
"text": {
"type": "plain_text",
"text": ":kairos: Repository link",
"emoji": true
},
"url": "https://github.com/${{ github.repository }}"
}
]
}
]
}
48 changes: 48 additions & 0 deletions .github/workflows/reusable-build-provider.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,51 @@ jobs:
- name: Push to testing
run: |
docker push ttl.sh/kairos-${{ inputs.flavor }}-${{ github.sha }}-provider:24h
- name: save commit-message
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} && failure()
run: echo "COMMIT_MSG=$(git log -1 --pretty=format:%s)" >> $GITHUB_ENV
- name: notify if failure
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} && failure()
uses: slackapi/[email protected]
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
with:
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Job failure on main branch for job ${{ github.job }} in workflow \"${{ github.workflow }}\"\n\nCommit message is \"${{ env.COMMIT_MSG }}\"\n\n Commit sha is <https://github.com/${{ github.repository }}/commit/${{ github.sha }}|${{ github.sha }}>"
}
},
{
"type": "divider"
},
{
"type": "actions",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": ":thisisfine: Failed Run",
"emoji": true
},
"url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
},
{
"type": "button",
"text": {
"type": "plain_text",
"text": ":kairos: Repository link",
"emoji": true
},
"url": "https://github.com/${{ github.repository }}"
}
]
}
]
}
48 changes: 48 additions & 0 deletions .github/workflows/reusable-docker-arm-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,51 @@ jobs:
name: ${{ inputs.flavor }}-image
path: build
if-no-files-found: error
- name: save commit-message
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} && failure()
run: echo "COMMIT_MSG=$(git log -1 --pretty=format:%s)" >> $GITHUB_ENV
- name: notify if failure
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} && failure()
uses: slackapi/[email protected]
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
with:
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Job failure on main branch for job ${{ github.job }} in workflow \"${{ github.workflow }}\"\n\nCommit message is \"${{ env.COMMIT_MSG }}\"\n\n Commit sha is <https://github.com/${{ github.repository }}/commit/${{ github.sha }}|${{ github.sha }}>"
}
},
{
"type": "divider"
},
{
"type": "actions",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": ":thisisfine: Failed Run",
"emoji": true
},
"url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
},
{
"type": "button",
"text": {
"type": "plain_text",
"text": ":kairos: Repository link",
"emoji": true
},
"url": "https://github.com/${{ github.repository }}"
}
]
}
]
}
48 changes: 48 additions & 0 deletions .github/workflows/reusable-encryption-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,51 @@ jobs:
run: |
export ISO=$PWD/kairos-core-${{ inputs.flavor }}.iso
.github/encryption-tests.sh
- name: save commit-message
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} && failure()
run: echo "COMMIT_MSG=$(git log -1 --pretty=format:%s)" >> $GITHUB_ENV
- name: notify if failure
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} && failure()
uses: slackapi/[email protected]
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
with:
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Job failure on main branch for job ${{ github.job }} in workflow \"${{ github.workflow }}\"\n\nCommit message is \"${{ env.COMMIT_MSG }}\"\n\n Commit sha is <https://github.com/${{ github.repository }}/commit/${{ github.sha }}|${{ github.sha }}>"
}
},
{
"type": "divider"
},
{
"type": "actions",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": ":thisisfine: Failed Run",
"emoji": true
},
"url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
},
{
"type": "button",
"text": {
"type": "plain_text",
"text": ":kairos: Repository link",
"emoji": true
},
"url": "https://github.com/${{ github.repository }}"
}
]
}
]
}
48 changes: 48 additions & 0 deletions .github/workflows/reusable-image-and-iso-arm-generic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,51 @@ jobs:
path: |
build/*.iso
build/*.sha256
- name: save commit-message
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} && failure()
run: echo "COMMIT_MSG=$(git log -1 --pretty=format:%s)" >> $GITHUB_ENV
- name: notify if failure
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} && failure()
uses: slackapi/[email protected]
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
with:
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Job failure on main branch for job ${{ github.job }} in workflow \"${{ github.workflow }}\"\n\nCommit message is \"${{ env.COMMIT_MSG }}\"\n\n Commit sha is <https://github.com/${{ github.repository }}/commit/${{ github.sha }}|${{ github.sha }}>"
}
},
{
"type": "divider"
},
{
"type": "actions",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": ":thisisfine: Failed Run",
"emoji": true
},
"url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
},
{
"type": "button",
"text": {
"type": "plain_text",
"text": ":kairos: Repository link",
"emoji": true
},
"url": "https://github.com/${{ github.repository }}"
}
]
}
]
}
48 changes: 48 additions & 0 deletions .github/workflows/reusable-install-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,51 @@ jobs:
name: ${{ inputs.flavor }}-vbox.logs.zip
path: tests/**/logs/*
if-no-files-found: warn
- name: save commit-message
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} && failure()
run: echo "COMMIT_MSG=$(git log -1 --pretty=format:%s)" >> $GITHUB_ENV
- name: notify if failure
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} && failure()
uses: slackapi/[email protected]
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
with:
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Job failure on main branch for job ${{ github.job }} in workflow \"${{ github.workflow }}\"\n\nCommit message is \"${{ env.COMMIT_MSG }}\"\n\n Commit sha is <https://github.com/${{ github.repository }}/commit/${{ github.sha }}|${{ github.sha }}>"
}
},
{
"type": "divider"
},
{
"type": "actions",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": ":thisisfine: Failed Run",
"emoji": true
},
"url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
},
{
"type": "button",
"text": {
"type": "plain_text",
"text": ":kairos: Repository link",
"emoji": true
},
"url": "https://github.com/${{ github.repository }}"
}
]
}
]
}
Loading

0 comments on commit 1f1586f

Please sign in to comment.