feat: add --experiments flag to replace --experimental (#5767)

- Deprecates the --experimental flag
- Adds a new flag --experiments which supports passing multiple comma-separated values or a wildcard value.
- Exposes a new endpoint /api/v2/experiments that returns the list of enabled experiments.
- Deprecates the field Features.Experimental in favour of this new API.
- Updates apidocgen to support type aliases (shoutout to @mtojek).
- Modifies apitypings to support generating slice types.
- Updates develop.sh to pass additional args after -- to $CODERD_SHIM.
This commit is contained in:
Cian Johnston
2023-01-18 19:12:53 +00:00
committed by GitHub
parent 47c3d72294
commit 56b996532f
29 changed files with 593 additions and 41 deletions
+12
View File
@@ -636,6 +636,18 @@ export const getEntitlements = async (): Promise<TypesGen.Entitlements> => {
}
}
export const getExperiments = async (): Promise<TypesGen.Experiment[]> => {
try {
const response = await axios.get("/api/v2/experiments")
return response.data
} catch (error) {
if (axios.isAxiosError(error) && error.response?.status === 404) {
return []
}
throw error
}
}
export const getAuditLogs = async (
options: TypesGen.AuditLogsRequest,
): Promise<TypesGen.AuditLogResponse> => {
+10 -2
View File
@@ -311,11 +311,12 @@ export interface DeploymentConfig {
readonly scim_api_key: DeploymentConfigField<string>
readonly provisioner: ProvisionerConfig
readonly rate_limit: RateLimitConfig
readonly experimental: DeploymentConfigField<boolean>
readonly experiments: DeploymentConfigField<string[]>
readonly update_check: DeploymentConfigField<boolean>
readonly max_token_lifetime: DeploymentConfigField<number>
readonly swagger: SwaggerConfig
readonly logging: LoggingConfig
readonly experimental: DeploymentConfigField<boolean>
}
// From codersdk/deploymentconfig.go
@@ -337,10 +338,13 @@ export interface Entitlements {
readonly warnings: string[]
readonly errors: string[]
readonly has_license: boolean
readonly experimental: boolean
readonly trial: boolean
readonly experimental: boolean
}
// From codersdk/experiments.go
export type Experiments = Experiment[]
// From codersdk/features.go
export interface Feature {
readonly entitlement: Entitlement
@@ -1079,6 +1083,10 @@ export const Entitlements: Entitlement[] = [
"not_entitled",
]
// From codersdk/experiments.go
export type Experiment = "vscode_local"
export const Experiments: Experiment[] = ["vscode_local"]
// From codersdk/features.go
export type FeatureName =
| "appearance"