-
Notifications
You must be signed in to change notification settings - Fork 8
STAC-25533: report release-branch CI failures to Slack via Cerberus #366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5c91ebe
STAC-25533: report release-branch CI failures to Slack via Cerberus
LouisParkin 246a3f1
STAC-25531: run the five Docker-daemon test suites in GitHub Actions
LouisParkin d097666
STAC-25531: resolve Docker Compose v2 instead of the EOL v1 binary
LouisParkin 788e466
STAC-25531: detect an active compose project in a v2-compatible way
LouisParkin beba732
STAC-25544: move vsphere to the publicly-published VMware SDK
LouisParkin c2a2ba1
STAC-25544: update the embedded agent requirements to the renamed SDK
LouisParkin 20d74ec
Merge pull request #368 from StackVista/STAC-25544-public-vmware-sdk
LouisParkin 2198208
Merge pull request #367 from StackVista/STAC-25531-docker-suites
LouisParkin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,122 @@ | ||
| name: Cerberus notify | ||
|
|
||
| # New capability, not a port (STAC-25142 / STAC-25533). Unlike stackstate-agent | ||
| # and stackstate-process-agent, this repo's retired .gitlab-ci.yml had no notify | ||
| # job and no .cerberus directory, so a failed release-branch pipeline has always | ||
| # been silent here. STAC-25510 is what that costs: process-agent's image | ||
| # publishing broke on 2026-07-23 and went unnoticed for 12 days. | ||
| # | ||
| # Structure and calling convention follow | ||
| # stackstate-process-agent/.github/workflows/cerberus-notify.yml, which in turn | ||
| # follows `cerberus-block-on-master-fail` in StackVista/stackstate. Cerberus is | ||
| # the internal notify/block Lambda (source: https://github.com/StackVista/cerberus). | ||
| # `platform: github` makes it build GitHub pipeline/commit URLs rather than | ||
| # GitLab ones. | ||
| # | ||
| # `action: notify`, never `action: block`. Policy for migrated repos is notify by | ||
| # default. Blocking locks the branch (`lock_branch`), additionally requires the | ||
| # Cerberus GitHub App to be installed here, and mutates branch protection that | ||
| # pulumi-infra owns (STAC-25522) out from under it -- a subsequent pulumi apply | ||
| # would silently unlock the branch again. | ||
| # | ||
| # Prerequisites: CERBERUS_LAMBDA_URL and CERBERUS_API_TOKEN must both reach this | ||
| # repo as REPO-level secrets. The org-level copies are visibility=private, which | ||
| # excludes this PUBLIC repo. pulumi-infra provisions the pair together | ||
| # (github/repoVariables/resources.yaml, StackVista/pulumi-infra#277). If either | ||
| # is missing, this workflow warns and exits 0 rather than adding a second red job | ||
| # to an already-failed run -- the annotation is the signal. | ||
| # | ||
| # The bearer token is not optional going forward. StackVista/cerberus#4 | ||
| # (STAC-24889) adds `Authorization: Bearer <token>` verification to every | ||
| # non-Slack request; before it, the endpoint was entirely unauthenticated. | ||
| # Sending the header is forward-compatible -- the currently deployed Lambda | ||
| # ignores unknown headers -- so this works either side of that deploy. Without | ||
| # it, the first failure after cerberus#4 ships would get a 401 and no Slack | ||
| # message. | ||
| # | ||
| # The Slack channel is deliberately not sent. Cerberus resolves it as | ||
| # `util.GetOrDefault(req.Context, "channel", s.Channel)`, and GetOrDefault treats | ||
| # an empty or whitespace value as absent, so omitting `channel` falls back to the | ||
| # Lambda's own SLACK_CHANNEL. | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| suite: | ||
| description: Suite label shown in the Slack message, e.g. checks. | ||
| required: true | ||
| type: string | ||
| secrets: | ||
| # `required: false`. A caller passing `${{ secrets.X }}` for a secret the | ||
| # repo does not hold yields an empty string, which GitHub rejects as "not | ||
| # provided" against a required secret and fails the call before the run | ||
| # step's guard can warn -- the failure mode this workflow exists to avoid. | ||
| CERBERUS_LAMBDA_URL: | ||
| required: false | ||
| CERBERUS_API_TOKEN: | ||
| required: false | ||
|
|
||
| # Nothing here reads the repository; the payload is built entirely from the | ||
| # github context. | ||
| permissions: {} | ||
|
|
||
| jobs: | ||
| notify: | ||
| name: Notify Slack via Cerberus | ||
| runs-on: ubuntu-24.04 | ||
| timeout-minutes: 5 | ||
| steps: | ||
| - name: Post the failure to Cerberus | ||
| env: | ||
| CERBERUS_LAMBDA_URL: ${{ secrets.CERBERUS_LAMBDA_URL }} | ||
| CERBERUS_API_TOKEN: ${{ secrets.CERBERUS_API_TOKEN }} | ||
| REPOSITORY: ${{ github.repository }} | ||
| BRANCH: ${{ github.ref_name }} | ||
| PIPELINE: ${{ github.run_id }} | ||
| COMMIT_SHA: ${{ github.sha }} | ||
| # Empty on tag pushes, which carry no head_commit. COMMIT_TITLE below | ||
| # falls back to the sha so the Slack message is never blank. | ||
| COMMIT_MESSAGE: ${{ github.event.head_commit.message }} | ||
| SUITE: ${{ inputs.suite }} | ||
| run: | | ||
| set -euo pipefail | ||
|
|
||
| if [ -z "${CERBERUS_LAMBDA_URL}" ] || [ -z "${CERBERUS_API_TOKEN}" ]; then | ||
| echo "::warning title=Cerberus not configured::CERBERUS_LAMBDA_URL and/or CERBERUS_API_TOKEN is not visible to this repo, so the ${SUITE} failure was not reported to Slack. Both are provisioned as repo-level secrets by pulumi-infra (STAC-25533)." | ||
| exit 0 | ||
| fi | ||
|
|
||
| COMMIT_TITLE=$(printf '%s' "${COMMIT_MESSAGE}" | head -n1) | ||
| if [ -z "${COMMIT_TITLE}" ]; then | ||
| COMMIT_TITLE="${COMMIT_SHA}" | ||
| fi | ||
|
|
||
| # Not --verbose: it echoes request headers, and the Authorization | ||
| # header carries the shared token. GitHub would mask it, but not | ||
| # emitting it is better than relying on masking. | ||
| curl --fail --silent --show-error \ | ||
| -X POST "${CERBERUS_LAMBDA_URL}" \ | ||
| -H "Content-Type: application/json" \ | ||
| -H "Authorization: Bearer ${CERBERUS_API_TOKEN}" \ | ||
| -d "$(jq -n \ | ||
| --arg repo "${REPOSITORY}" \ | ||
| --arg branch "${BRANCH}" \ | ||
| --arg pipeline "${PIPELINE}" \ | ||
| --arg sha "${COMMIT_SHA}" \ | ||
| --arg title "${COMMIT_TITLE}" \ | ||
| --arg suite "${SUITE}" \ | ||
| '{ | ||
| action: "notify", | ||
| context: { | ||
| platform: "github", | ||
| "project.id": $repo, | ||
| "project.slug": $repo, | ||
| "project.name": "StackState Agent Integrations", | ||
| branch: $branch, | ||
| pipeline: $pipeline, | ||
| "commit.sha": $sha, | ||
| "commit.title": $title, | ||
| suite: $suite | ||
| } | ||
| }' | ||
| )" | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.