feat: allow users to pause prebuilt workspace reconciliation (#18700)

This PR provides two commands:
* `coder prebuilds pause`
* `coder prebuilds resume`

These allow the suspension of all prebuilds activity, intended for use
if prebuilds are misbehaving.
This commit is contained in:
Sas Swart
2025-07-02 17:05:42 +02:00
committed by GitHub
parent 4072d228c5
commit 01163ea57b
42 changed files with 1336 additions and 4 deletions

79
docs/reference/api/prebuilds.md generated Normal file
View File

@ -0,0 +1,79 @@
# Prebuilds
## Get prebuilds settings
### Code samples
```shell
# Example request using curl
curl -X GET http://coder-server:8080/api/v2/prebuilds/settings \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```
`GET /prebuilds/settings`
### Example responses
> 200 Response
```json
{
"reconciliation_paused": true
}
```
### Responses
| Status | Meaning | Description | Schema |
|--------|---------------------------------------------------------|-------------|--------------------------------------------------------------------|
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.PrebuildsSettings](schemas.md#codersdkprebuildssettings) |
To perform this operation, you must be authenticated. [Learn more](authentication.md).
## Update prebuilds settings
### Code samples
```shell
# Example request using curl
curl -X PUT http://coder-server:8080/api/v2/prebuilds/settings \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```
`PUT /prebuilds/settings`
> Body parameter
```json
{
"reconciliation_paused": true
}
```
### Parameters
| Name | In | Type | Required | Description |
|--------|------|--------------------------------------------------------------------|----------|----------------------------|
| `body` | body | [codersdk.PrebuildsSettings](schemas.md#codersdkprebuildssettings) | true | Prebuilds settings request |
### Example responses
> 200 Response
```json
{
"reconciliation_paused": true
}
```
### Responses
| Status | Meaning | Description | Schema |
|--------|-----------------------------------------------------------------|--------------|--------------------------------------------------------------------|
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.PrebuildsSettings](schemas.md#codersdkprebuildssettings) |
| 304 | [Not Modified](https://tools.ietf.org/html/rfc7232#section-4.1) | Not Modified | |
To perform this operation, you must be authenticated. [Learn more](authentication.md).

View File

@ -4980,6 +4980,20 @@ Git clone makes use of this by parsing the URL from: 'Username for "https://gith
| `reconciliation_backoff_lookback` | integer | false | | Reconciliation backoff lookback determines the time window to look back when calculating the number of failed prebuilds, which influences the backoff strategy. |
| `reconciliation_interval` | integer | false | | Reconciliation interval defines how often the workspace prebuilds state should be reconciled. |
## codersdk.PrebuildsSettings
```json
{
"reconciliation_paused": true
}
```
### Properties
| Name | Type | Required | Restrictions | Description |
|-------------------------|---------|----------|--------------|-------------|
| `reconciliation_paused` | boolean | false | | |
## codersdk.Preset
```json
@ -6058,6 +6072,7 @@ Git clone makes use of this by parsing the URL from: 'Username for "https://gith
| `convert_login` |
| `health_settings` |
| `notifications_settings` |
| `prebuilds_settings` |
| `workspace_proxy` |
| `organization` |
| `oauth2_provider_app` |