Files
Niklas Ye a023274280 Let team owners create service accounts in the web UI
Making a credential for CI meant signing in with curl, minting a personal
API key, finding a user id and then calling the service-accounts API by
hand. Nobody should need that to let a pipeline record a release event.

Team -> Automation lists the team's accounts and lets an owner create one,
add a key (rotation), revoke a key or delete the account. A new key is shown
once, next to the team id, because the next place it goes is a CI secret.
It sits behind the owner check, as the rest of a team's configuration does.

Two routes back it: GET /api/teams/{id}/service-accounts returns the team's
accounts with each key's name, age and last use and never a key value, and
DELETE /api/teams/{id}/service-accounts/{id} removes one, scoped to the
team so another team's account answers 404. Creating an account and minting
or revoking a key reuse the existing routes. Deleting an account keeps its
history: timelines, events and notes keep their rows, shown without a name.

Instance-scoped accounts are still an administrator's API call and are not
offered in the UI, since they reach every team. Nothing in the TUI or the
operator's client uses these routes, so neither needs a change.
2026-11-04 21:44:31 +01:00

3.1 KiB

Events

Giving related incidents a shared context. Back to the README and the documentation index.

Incidents are separate until Alertmanager groups their alerts together. But a release can break the API, the database pool and a dozen pods in different groups, and three months later each incident on its own says little. An event is the context they share: a release, a change, a maintenance window, an outage at a vendor.

Incidents are never merged. Each keeps its own timeline, assignee, notes and metrics; the event holds the story that spans them.

What an event has

  • a kind: release, change, maintenance, outage or other. The set is closed so it can be filtered and coloured; adding one is a server change.
  • a title and a summary: what happened and what was done. The summary is where the postmortem note lives.
  • a start, and an end that is absent for a marker or while it is still going.
  • a source: recorded by a person (manual) or by a service account (api), typically CI.
  • optionally an external id and link, such as a pipeline run.
  • notes, for what spans the incidents.

Events belong to one team, like incidents, and an event only holds incidents of its own team.

Attaching incidents

An incident can be attached to several events, and an event can hold many incidents. One attached incident may be marked as the trigger: the first domino. An event has at most one.

Attaching never happens by itself. When you open an incident, GET /api/incidents/{id}/related-events suggests events of its team that started within two hours after it opened, or that were running or ended within two hours before. It is a time-window query, and a person decides.

Attaching and detaching are recorded on the incident's own timeline (event_attached, event_detached).

What you get from an event

Computed each time it is read, never stored: how many incidents are attached and how many are still open, the worst severity, the time from the first incident opening to the first acknowledgement, and, once everything is resolved, the time from the first incident opening to the last resolution. The event's timeline merges its own start, end and notes with the timelines of the attached incidents.

Recording releases from CI

A team-scoped service account key can create events. Make one under Team → Automation in the web UI; the key is shown once. Give each one an external_id, such as the pipeline run, and the call is safe to retry: a repeated id returns the event already recorded.

curl -X POST "$TERDUT/api/events" -H "Authorization: Bearer $TERDUT_KEY" \
  -d '{"team_id": 3, "kind": "release", "title": "terdut-server 0.52.0 rollout",
       "external_id": "pipeline-1841", "external_url": "https://git.example.com/runs/1841"}'

Close it when the rollout is done with PATCH /api/events/{id} and an ended_at.

Deleting

Events are deleted for good, by a team owner. The incidents stay; each one's timeline records that it was detached because the event was deleted. See the API reference for every endpoint.