feat(notifier): buildkite_annotate notifier (Wave 1 Tier-2 #2)#12
Merged
Conversation
…agent) Adds a built-in `type: buildkite_annotate` notifier that publishes DING alerts as Buildkite build annotations via `buildkite-agent annotate --style <style> --context ding --append`. All alerts for a build land in a single rolling annotation visible at the top of the Buildkite job UI, closing the "annotation surface unused" gap documented in the Buildkite recipe. Pattern: sync, mutex-guarded, append-only — same shape as gitlab_artifact (shipped in v0.10.0) but the writer is exec.Command rather than os.OpenFile. Body passed via stdin to avoid shell-escape pitfalls with multi-line markdown content. First Send writes `# DING Alerts` H1; subsequent Sends append `## <rule>` sections only (Buildkite's --append concatenates each invocation's stdin). Outside Buildkite (buildkite-agent not on PATH), constructor logs once and Send becomes a no-op — graceful degrade matching GHA philosophy. Configurable `style:` field (success | info | warning | error) defaults to "error". No new dependencies, no go.mod changes. Single optional `style:` field added to NotifierConfig. 8 unit tests cover header behavior, multi-Send append, style override + default, exec error propagation, label sort stability, concurrent Send mutex correctness, and no-agent-on-PATH no-op behavior. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- docs/recipes/buildkite.md: replace the "annotation surface unused" gotcha with a positive `## Native Buildkite UI surfacing` section showing the new notifier. Update Escalation criteria gotcha count (3 → 2) and reframe the Tier-2 trigger as fulfilled. - docs/configuration.md: new `### type: buildkite_annotate` section in the Notifiers chapter, between gitlab_artifact and webhook. - ding.yaml.example: commented example block in the notifiers catalog after the gitlab_artifact entry. Closes the documented gap from Wave 1 review (Buildkite recipe's prior "annotation surface unused" trigger has fired). After this commit, type: buildkite_annotate is a fully-documented built-in notifier. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
Adds a built-in `type: buildkite_annotate` notifier that publishes DING alerts as Buildkite build annotations via `buildkite-agent annotate --style <style> --context ding --append`. All alerts for a build land in a single rolling annotation visible at the top of the Buildkite job UI, closing the "annotation surface unused" gap flagged in the Wave 1 Buildkite recipe — second row of the Wave 1 Tier-2 candidates table marked shipped.
This continues the Tier-2 cadence: T2-A (`${VAR}`), T2-B (`kubernetes_event` shipped in v0.9.0), Wave 1 #1 (`gitlab_artifact` shipped in v0.10.0), now Wave 1 #2 (`buildkite_annotate`).
Design (locked in brainstorm)
Commits
Test plan
```bash
mkdir /tmp/buildkite-annotate-smoke && cd /tmp/buildkite-annotate-smoke
cat > buildkite-agent <<'AGENT'
#!/bin/sh
{ echo "=== invocation:
exit 0
AGENT
chmod +x buildkite-agent
export PATH="$PWD:$PATH"
rm -f /tmp/buildkite-agent-calls.log
cat > ding.yaml <<'YAML'
notifiers:
alerts:
type: buildkite_annotate
rules:
match: { metric: run.exit }
condition: value > 0
message: "Job failed (exit {{ .exit_code }})"
alert:
YAML
/tmp/ding run --config ding.yaml -- false
cat /tmp/buildkite-agent-calls.log
```
Out of scope (deferred)
Post-merge
By the established convention (gitlab_artifact → v0.10.0), this could tag as v0.11.0 if you want the new notifier in a release rather than just on main.
🤖 Generated with Claude Code