Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/_check_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ permissions:

on:
workflow_call:
secrets:
slack-bot-token:
inputs:
request:
type: string
Expand All @@ -20,6 +22,8 @@ concurrency:

jobs:
build:
secrets:
slack-bot-token: ${{ secrets.slack-bot-token }}
permissions:
actions: read
contents: read
Expand All @@ -39,6 +43,7 @@ jobs:
rbe: true
request: ${{ inputs.request }}
skip: ${{ matrix.skip != false && true || false }}
slack-channel: ${{ matrix.slack-channel || '' }}
target: ${{ matrix.target }}
timeout-minutes: 180
trusted: ${{ inputs.trusted }}
Expand Down
33 changes: 32 additions & 1 deletion .github/workflows/_run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
app-key:
gpg-key:
gpg-key-password:
slack-bot-token:
ssh-key:
ssh-key-extra:
inputs:
Expand Down Expand Up @@ -138,6 +139,10 @@ on:
skip:
type: boolean
default: false
slack-channel:
type: string
default: ''
description: Slack channel for failure notifications (opt-in, e.g. '#envoy-ci'). Leave empty to disable.
source:
type: string
summary-post:
Expand Down Expand Up @@ -385,7 +390,7 @@ jobs:
name: Configure repo Bazel settings

# NOTE: This is where untrusted code can be run!!!
# It MUST be the last step in the workflow
# Only post-failure notification steps (which don't use any repo code) should follow this step.
- uses: envoyproxy/toolshed/actions/github/run@8d5d8d4b9eeb5e4e76b92341b0b1b1f6438af231 # v0.4.5
name: Run CI ${{ inputs.command }} ${{ inputs.target }}
with:
Expand Down Expand Up @@ -438,3 +443,29 @@ jobs:
MOUNT_GPG_HOME: ${{ inputs.import-gpg && 1 || '' }}
ENVOY_DOCKER_CPUS: ${{ inputs.docker-cpus }}
ENVOY_DOCKER_CI: ${{ inputs.docker-ci && 'true' || '' }}

- name: Notify Slack on failure
if: ${{ failure() && inputs.slack-channel != '' }}
env:
SLACK_BOT_TOKEN: ${{ secrets.slack-bot-token }}
run: |
JOB_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
curl -sf -X POST https://slack.com/api/chat.postMessage \
-H "Authorization: Bearer $SLACK_BOT_TOKEN" \
-H "Content-type: application/json" \
--data "$(cat <<EOF
{
"channel": "${{ inputs.slack-channel }}",
"text": "CI job failed: ${{ inputs.target }}",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":x: *CI job failed:* \`${{ inputs.target }}\`\n<${JOB_URL}|View workflow run>"
}
}
]
}
EOF
)"
2 changes: 2 additions & 0 deletions .github/workflows/envoy-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ jobs:
# head-sha: ${{ github.sha }}

build:
secrets:
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
permissions:
actions: read
contents: read
Expand Down
Loading