|
| 1 | +--- |
| 2 | +layout: src/layouts/Default.astro |
| 3 | +pubDate: 2026-06-18 |
| 4 | +title: Project badges |
| 5 | +description: How to add deployment status badges to your Git repositories and other external tools. |
| 6 | +navOrder: 12 |
| 7 | +--- |
| 8 | + |
| 9 | +Project badges let you display the deployment status of your projects in external tools like Git repository READMEs, wikis, or dashboards. Each badge shows the latest release version for a specific environment, so your team can see deployment status at a glance without opening Octopus. |
| 10 | + |
| 11 | +## Enable badges for a project |
| 12 | + |
| 13 | +Badges are turned off by default. To turn them on: |
| 14 | + |
| 15 | +1. Navigate to your project and click **Settings**. |
| 16 | +2. Toggle **Badges** on. |
| 17 | +3. Click **Save**. |
| 18 | + |
| 19 | +:::div{.warning} |
| 20 | +Turning on badges lets anyone with the badge URL view the latest release version and deployment status for the selected environment. No authentication is required, and no other project data is exposed. |
| 21 | +::: |
| 22 | + |
| 23 | +## Build a badge with the badge builder |
| 24 | + |
| 25 | +After you turn on badges, a **Badge Builder** button appears on the project settings page. The badge builder gives you a visual interface to configure and preview your badge before copying the code. |
| 26 | + |
| 27 | +1. Click **Badge Builder** on the project settings page. |
| 28 | +2. Select the **environment** you want the badge to show status for. |
| 29 | +3. Choose a **label** for the left side of the badge: |
| 30 | + - **Environment** (default) — shows the environment name |
| 31 | + - **Project** — shows the project name |
| 32 | + - **Release** — shows the text "Release" |
| 33 | +4. Optionally, expand the **Advanced** section to: |
| 34 | + - Turn on **Include failed releases** to show the latest release even if it failed, rather than only showing successful releases. |
| 35 | + - Choose a **badge style** — flat (default) or flat-square. |
| 36 | +5. Copy the generated code from one of the available formats: |
| 37 | + - **Markdown** — for Git repository READMEs and wikis |
| 38 | + - **HTML** — for web pages |
| 39 | + - **URL** — direct link to the badge image |
| 40 | + |
| 41 | +The preview updates as you change options, so you can see what the badge looks like before you copy it. |
| 42 | + |
| 43 | +## Badge colors |
| 44 | + |
| 45 | +The right side of the badge is automatically colored based on the deployment status: |
| 46 | + |
| 47 | +| Color | Status | |
| 48 | +|-------|--------| |
| 49 | +| Green | Successful deployment | |
| 50 | +| Red | Failed, canceled, or timed-out deployment | |
| 51 | +| Blue | Deployment in progress or other states | |
| 52 | +| Gray | No deployment found | |
| 53 | + |
| 54 | +## API endpoints |
| 55 | + |
| 56 | +You can also build badge URLs manually. Both endpoints are anonymous and don't require authentication. They return a 404 if badges aren't turned on for the project. |
| 57 | + |
| 58 | +### Image endpoint |
| 59 | + |
| 60 | +Returns an SVG image you can embed directly: |
| 61 | + |
| 62 | +``` |
| 63 | +GET /api/{spaceId}/projects/{projectSlug}/badge/{environmentSlug}/latest_release |
| 64 | +``` |
| 65 | + |
| 66 | +### JSON endpoint |
| 67 | + |
| 68 | +Returns badge data as JSON, useful for integrations with third-party badge services: |
| 69 | + |
| 70 | +``` |
| 71 | +GET /api/{spaceId}/projects/{projectSlug}/badge/{environmentSlug}/latest_release.json |
| 72 | +``` |
| 73 | + |
| 74 | +### Query parameters |
| 75 | + |
| 76 | +| Parameter | Default | Description | |
| 77 | +|-----------|---------|-------------| |
| 78 | +| `label` | `environment` | The text on the left side: `environment`, `project`, or `release` | |
| 79 | +| `style` | `flat` | The badge style: `flat` or `flat-square` | |
| 80 | +| `includeFailed` | `false` | Include failed, canceled, or timed-out releases | |
| 81 | +| `tenantId` | | Filter by a specific tenant for multi-tenant deployments | |
| 82 | + |
| 83 | +## Use badges with shields.io |
| 84 | + |
| 85 | +You can use the JSON endpoint with [shields.io Dynamic JSON Badge](https://shields.io/badges/dynamic-json-badge) to serve badges through shields.io's infrastructure. This offloads requests from your Octopus Server, as shields.io has its own caching layer. |
| 86 | + |
| 87 | +To create a shields.io badge: |
| 88 | + |
| 89 | +1. Open the badge builder and copy the **URL** for the JSON endpoint (ending in `.json`). |
| 90 | +2. URL-encode the endpoint and use it as the `url` parameter for a shields.io dynamic badge. |
| 91 | + |
| 92 | +For example: |
| 93 | + |
| 94 | +``` |
| 95 | +https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fyour-octopus.example.com%2Fapi%2FSpaces-1%2Fprojects%2Fmy-project%2Fbadge%2Fproduction%2Flatest_release.json&query=%24.Message&label=Production |
| 96 | +``` |
| 97 | + |
| 98 | +## Caching |
| 99 | + |
| 100 | +Badge responses include HTTP caching headers to reduce load on your Octopus Server. External consumers like shields.io also maintain their own caches. This means badge updates may not appear instantly after a deployment completes. |
0 commit comments