Skip to content

Commit 76fc100

Browse files
zuchkaclaude
andcommitted
docs(recipes): document buildkite_annotate notifier
- 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>
1 parent 511e568 commit 76fc100

3 files changed

Lines changed: 42 additions & 3 deletions

File tree

ding.yaml.example

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@ notifiers:
9393
# alert-gitlab:
9494
# type: gitlab_artifact
9595
# # path: ding-alerts.md # default; relative to CWD ($CI_PROJECT_DIR in GitLab CI)
96+
#
97+
# Buildkite annotation (publishes alerts as Buildkite build annotations via
98+
# `buildkite-agent annotate`; visible at the top of the build UI):
99+
# alert-buildkite:
100+
# type: buildkite_annotate
101+
# # style: error # default; success | info | warning | error
96102

97103
rules:
98104
# Event-per-event: fires on a single reading above threshold.

docs/configuration.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,25 @@ notifiers:
215215

216216
**No CI gate**: the notifier writes the file regardless of whether it's running in GitLab CI. Outside CI, it just produces a local `ding-alerts.md` — harmless. Combine with `.gitlab-ci.yml` `artifacts: { when: always, paths: [ding-alerts.md] }` to archive the file on every pipeline run (including failed jobs). See the [GitLab CI recipe](recipes/gitlab-ci.md#native-gitlab-ui-surfacing) for an end-to-end example.
217217

218+
### `type: buildkite_annotate`
219+
220+
Publishes alerts as Buildkite build annotations via `buildkite-agent annotate`. All alerts for a build land in a single rolling annotation (`--context ding --append`) shown at the top of the Buildkite job UI. Requires `buildkite-agent` on PATH (always set inside Buildkite jobs); outside Buildkite the notifier no-ops gracefully after a one-time warning.
221+
222+
```yaml
223+
notifiers:
224+
annotate:
225+
type: buildkite_annotate
226+
style: error # success | info | warning | error; default error
227+
```
228+
229+
| Field | Default | Notes |
230+
|-------|---------|-------|
231+
| `style` | `error` | Buildkite annotation style. Drives the colored badge in the build UI. |
232+
233+
**Behavior**: sync, mutex-guarded. The first `Send()` writes a `# DING Alerts` H1 header; subsequent calls append `## <rule>` sections that Buildkite's `--append` concatenates into the existing annotation body. No async queue, no retry, no metrics — failures from `buildkite-agent` (agent disconnected, body too large, etc.) are returned from `Send()` with stderr captured.
234+
235+
**No CI gate**: the notifier checks for `buildkite-agent` once at construction; outside Buildkite jobs it logs `ding: buildkite_annotate notifier: buildkite-agent not on PATH; alerts via this notifier will be no-ops` and Send becomes a no-op. See the [Buildkite recipe](recipes/buildkite.md#native-buildkite-ui-surfacing) for an end-to-end example.
236+
218237
### `type: webhook`
219238

220239
Posts a flat JSON payload to any HTTP endpoint. Useful for generic integrations (PagerDuty, custom receivers, etc.).

docs/recipes/buildkite.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,33 @@ Use these in `match.labels` or `message` templates. See [Configuration](../confi
6666

6767
If the alert doesn't fire, check the Buildkite build log for `ding` output. Common issues: webhook URL not exposed (env hook scope, agent vs pipeline level), or `drain_timeout` shorter than the notifier retry window — see [Configuration](../configuration.md).
6868

69+
## Native Buildkite UI surfacing
70+
71+
If you want DING alerts to surface as Buildkite build annotations (visible at the top of the build UI) rather than (or alongside) external notifiers, DING ships a built-in `type: buildkite_annotate` notifier. See [`type: buildkite_annotate`](../configuration.md#type-buildkite_annotate) for the full reference.
72+
73+
Add to `ding.yaml`:
74+
75+
```yaml
76+
notifiers:
77+
annotate:
78+
type: buildkite_annotate
79+
# style: error # default; success | info | warning | error
80+
```
81+
82+
No changes to `.buildkite/pipeline.yml` are needed — the `buildkite-agent` CLI is already on PATH inside Buildkite jobs. All DING alerts from a build land in a single rolling annotation (`--context ding --append`) so the UI stays uncluttered. Outside Buildkite (e.g. local dev), the notifier no-ops gracefully after a one-time warning.
83+
6984
## Tradeoffs / known limitations
7085

7186
- **No `job` label by default.** runctx captures Buildkite's pipeline-level identifiers but not step-level (`BUILDKITE_STEP_KEY`). Add explicit `match.labels` if you need per-step rules.
7287
- **Binary download per step.** Bake DING into your agent image, or use a [`pre-command` hook](https://buildkite.com/docs/agent/v3/hooks#available-hooks) to install it once per agent.
73-
- **Annotation surface unused.** Buildkite has `buildkite-agent annotate`, the analogue of GHA's `$GITHUB_STEP_SUMMARY`. The minimal recipe doesn't use it; surfacing alerts back into the build UI would be a Tier-2 abstraction (`type: buildkite_annotate` notifier).
7488

7589
## Escalation criteria
7690

7791
This recipe is **a Tier-2 candidate** by the program's standard rubric:
7892

7993
- **Setup commands required:** 1 (`curl | tar`) — under threshold of 5
8094
- **Boilerplate lines:** ~24 — under threshold of 50
81-
- **"Gotcha" callouts:** 3 (no `job` label, binary download, no annotation surface) — over threshold of 2 → **Tier-2 candidate**
95+
- **"Gotcha" callouts:** 2 (no `job` label, binary download) — at threshold of 2
8296
- **End-to-end runnable:** yes (Buildkite has a free trial; the underlying agent is OSS and self-hostable indefinitely)
8397

84-
**Tier-2 candidate.** The structural friction is "annotations not used" — Buildkite users expect alerts to land in the build UI, not just Slack. A `type: buildkite_annotate` notifier (calling `buildkite-agent annotate --style error --context ding`) is the natural Tier-2 abstraction. Sequence it after GitLab CI's artifact notifier (similar shape).
98+
Buildkite-native alert surfacing now ships as the built-in [`type: buildkite_annotate`](../configuration.md#type-buildkite_annotate) notifier (covered in the section above). The remaining gotchas (no `job` label, binary download per step) are environmental rather than implementation gaps; the recipe stays Tier 1.

0 commit comments

Comments
 (0)