Status badges
gocdnext can serve shields-style SVG badges for a project or a single pipeline:
GET /api/v1/badge/<project>.svg?token=<badge-token>GET /api/v1/badge/<project>/<pipeline>.svg?token=<badge-token>The badge shows the latest matching run as:
passingfor a successful runfailingfor a failed or canceled runrunningfor queued, waiting, or running workunknownwhen there is no matching run
Badges are anonymous so GitHub, docs sites, and dashboards can embed them without a session cookie. When the project has an SCM source, a badge without branch uses that source’s default branch. Add branch=<name> to override it.
Security model
Badges are disabled by default. Enabling a badge creates an unguessable project token and stores only its SHA-256 hash. A request with a missing, malformed, disabled, unknown, or wrong token returns the same grey unknown SVG with HTTP 200. This avoids turning the public endpoint into a project-existence or run-history oracle.
Treat the token like a publish link. Anyone who has it can see the coarse status of that project or pipeline. Rotate it to invalidate existing badge URLs, or disable badges for the project.
Enable or rotate
Use a maintainer or admin session/API token:
curl -X POST \ -H "Authorization: Bearer $GOCDNEXT_TOKEN" \ https://ci.example.com/api/v1/projects/payments/badge/tokenThe response returns the plaintext token once, plus a ready-to-copy Markdown snippet:
{ "enabled": true, "token": "43-character-url-token", "badge_url": "https://ci.example.com/api/v1/badge/payments.svg?token=43-character-url-token", "markdown": ""}Pin the badge to a non-default branch by appending &branch=<name>.
For a specific pipeline, insert the pipeline name before .svg:
Disable
curl -X DELETE \ -H "Authorization: Bearer $GOCDNEXT_TOKEN" \ https://ci.example.com/api/v1/projects/payments/badge/tokenAfter disable, old badge URLs continue to render a valid unknown SVG.