Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f6e4ba6

Browse files
authored
chore: remove per request dynamic parameters opt in and rely on template (#18505)
When in experimental this was used as an escape hatch. Removed to be consistent with the template author's intentions Backwards compatible, removing an experimental api field that is no longer used.
1 parent 6877142 commit f6e4ba6

File tree

14 files changed

+4
-57
lines changed

14 files changed

+4
-57
lines changed

coderd/apidoc/docs.go

Lines changed: 0 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

Lines changed: 0 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/parameters_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import (
1515
"github.com/coder/coder/v2/coderd/database/dbtestutil"
1616
"github.com/coder/coder/v2/coderd/database/pubsub"
1717
"github.com/coder/coder/v2/coderd/rbac"
18-
"github.com/coder/coder/v2/coderd/util/ptr"
1918
"github.com/coder/coder/v2/codersdk"
2019
"github.com/coder/coder/v2/codersdk/wsjson"
2120
"github.com/coder/coder/v2/provisioner/echo"
@@ -260,7 +259,6 @@ func TestDynamicParametersWithTerraformValues(t *testing.T) {
260259
Value: "eu",
261260
},
262261
}
263-
request.EnableDynamicParameters = true
264262
})
265263
coderdtest.AwaitWorkspaceBuildJobCompleted(t, setup.client, wrk.LatestBuild.ID)
266264

@@ -285,7 +283,6 @@ func TestDynamicParametersWithTerraformValues(t *testing.T) {
285283
RichParameterValues: []codersdk.WorkspaceBuildParameter{
286284
{Name: "region", Value: regionVal},
287285
},
288-
EnableDynamicParameters: ptr.Ref(true),
289286
})
290287
require.NoError(t, err)
291288
coderdtest.AwaitWorkspaceBuildJobCompleted(t, setup.client, bld.ID)

coderd/workspacebuilds.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -385,10 +385,6 @@ func (api *API) postWorkspaceBuilds(rw http.ResponseWriter, r *http.Request) {
385385
builder = builder.State(createBuild.ProvisionerState)
386386
}
387387

388-
if createBuild.EnableDynamicParameters != nil {
389-
builder = builder.DynamicParameters(*createBuild.EnableDynamicParameters)
390-
}
391-
392388
workspaceBuild, provisionerJob, provisionerDaemons, err = builder.Build(
393389
ctx,
394390
tx,

coderd/workspaces.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -717,10 +717,6 @@ func createWorkspace(
717717
builder = builder.MarkPrebuiltWorkspaceClaim()
718718
}
719719

720-
if req.EnableDynamicParameters {
721-
builder = builder.DynamicParameters(req.EnableDynamicParameters)
722-
}
723-
724720
workspaceBuild, provisionerJob, provisionerDaemons, err = builder.Build(
725721
ctx,
726722
db,

coderd/wsbuilder/wsbuilder.go

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,10 @@ type Builder struct {
5757
deploymentValues *codersdk.DeploymentValues
5858
experiments codersdk.Experiments
5959

60-
richParameterValues []codersdk.WorkspaceBuildParameter
61-
// dynamicParametersEnabled is non-nil if set externally
62-
dynamicParametersEnabled *bool
63-
initiator uuid.UUID
64-
reason database.BuildReason
65-
templateVersionPresetID uuid.UUID
60+
richParameterValues []codersdk.WorkspaceBuildParameter
61+
initiator uuid.UUID
62+
reason database.BuildReason
63+
templateVersionPresetID uuid.UUID
6664

6765
// used during build, makes function arguments less verbose
6866
ctx context.Context
@@ -204,12 +202,6 @@ func (b Builder) MarkPrebuiltWorkspaceClaim() Builder {
204202
return b
205203
}
206204

207-
func (b Builder) DynamicParameters(using bool) Builder {
208-
// nolint: revive
209-
b.dynamicParametersEnabled = ptr.Ref(using)
210-
return b
211-
}
212-
213205
// SetLastWorkspaceBuildInTx prepopulates the Builder's cache with the last workspace build. This allows us
214206
// to avoid a repeated database query when the Builder's caller also needs the workspace build, e.g. auto-start &
215207
// auto-stop.
@@ -1211,10 +1203,6 @@ func (b *Builder) checkRunningBuild() error {
12111203
}
12121204

12131205
func (b *Builder) usingDynamicParameters() bool {
1214-
if b.dynamicParametersEnabled != nil {
1215-
return *b.dynamicParametersEnabled
1216-
}
1217-
12181206
tpl, err := b.getTemplate()
12191207
if err != nil {
12201208
return false // Let another part of the code get this error

codersdk/organizations.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@ type CreateWorkspaceRequest struct {
227227
RichParameterValues []WorkspaceBuildParameter `json:"rich_parameter_values,omitempty"`
228228
AutomaticUpdates AutomaticUpdates `json:"automatic_updates,omitempty"`
229229
TemplateVersionPresetID uuid.UUID `json:"template_version_preset_id,omitempty" format:"uuid"`
230-
EnableDynamicParameters bool `json:"enable_dynamic_parameters,omitempty"`
231230
}
232231

233232
func (c *Client) OrganizationByName(ctx context.Context, name string) (Organization, error) {

codersdk/workspaces.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,6 @@ type CreateWorkspaceBuildRequest struct {
110110
LogLevel ProvisionerLogLevel `json:"log_level,omitempty" validate:"omitempty,oneof=debug"`
111111
// TemplateVersionPresetID is the ID of the template version preset to use for the build.
112112
TemplateVersionPresetID uuid.UUID `json:"template_version_preset_id,omitempty" format:"uuid"`
113-
// EnableDynamicParameters skips some of the static parameter checking.
114-
// It will default to whatever the template has marked as the default experience.
115-
// Requires the "dynamic-experiment" to be used.
116-
EnableDynamicParameters *bool `json:"enable_dynamic_parameters,omitempty"`
117113
}
118114

119115
type WorkspaceOptions struct {

docs/reference/api/builds.md

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/api/schemas.md

Lines changed: 0 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/api/workspaces.md

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

enterprise/coderd/workspaces_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1759,7 +1759,6 @@ func TestWorkspaceTemplateParamsChange(t *testing.T) {
17591759
Value: "7",
17601760
},
17611761
},
1762-
EnableDynamicParameters: true,
17631762
})
17641763

17651764
// Then: the build should succeed. The updated value of param_min should be

site/src/api/typesGenerated.ts

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

site/src/pages/CreateWorkspacePage/CreateWorkspacePageExperimental.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,6 @@ const CreateWorkspacePageExperimental: FC = () => {
326326

327327
const workspace = await createWorkspaceMutation.mutateAsync({
328328
...workspaceRequest,
329-
enable_dynamic_parameters: true,
330329
userId: owner.id,
331330
});
332331
onCreateWorkspace(workspace);

0 commit comments

Comments
 (0)