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

Skip to content

chore: remove per request dynamic parameters opt in and rely on template #18505

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
chore: remove per request dynamic parameters opt in and rely on template
When in experimental this was used as an escape hatch. Removed to be
consistent with the template author's intentions
  • Loading branch information
Emyrk committed Jun 23, 2025
commit a3f77b3feebe8dda69d741e74aba23bff5efe19a
7 changes: 0 additions & 7 deletions coderd/apidoc/docs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 0 additions & 7 deletions coderd/apidoc/swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions coderd/parameters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"github.com/coder/coder/v2/coderd/database/dbtestutil"
"github.com/coder/coder/v2/coderd/database/pubsub"
"github.com/coder/coder/v2/coderd/rbac"
"github.com/coder/coder/v2/coderd/util/ptr"
"github.com/coder/coder/v2/codersdk"
"github.com/coder/coder/v2/codersdk/wsjson"
"github.com/coder/coder/v2/provisioner/echo"
Expand Down Expand Up @@ -260,7 +259,6 @@ func TestDynamicParametersWithTerraformValues(t *testing.T) {
Value: "eu",
},
}
request.EnableDynamicParameters = true
})
coderdtest.AwaitWorkspaceBuildJobCompleted(t, setup.client, wrk.LatestBuild.ID)

Expand All @@ -285,7 +283,6 @@ func TestDynamicParametersWithTerraformValues(t *testing.T) {
RichParameterValues: []codersdk.WorkspaceBuildParameter{
{Name: "region", Value: regionVal},
},
EnableDynamicParameters: ptr.Ref(true),
})
require.NoError(t, err)
coderdtest.AwaitWorkspaceBuildJobCompleted(t, setup.client, bld.ID)
Expand Down
4 changes: 0 additions & 4 deletions coderd/workspacebuilds.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,10 +385,6 @@ func (api *API) postWorkspaceBuilds(rw http.ResponseWriter, r *http.Request) {
builder = builder.State(createBuild.ProvisionerState)
}

if createBuild.EnableDynamicParameters != nil {
builder = builder.DynamicParameters(*createBuild.EnableDynamicParameters)
}

workspaceBuild, provisionerJob, provisionerDaemons, err = builder.Build(
ctx,
tx,
Expand Down
4 changes: 0 additions & 4 deletions coderd/workspaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -717,10 +717,6 @@ func createWorkspace(
builder = builder.MarkPrebuiltWorkspaceClaim()
}

if req.EnableDynamicParameters {
builder = builder.DynamicParameters(req.EnableDynamicParameters)
}

workspaceBuild, provisionerJob, provisionerDaemons, err = builder.Build(
ctx,
db,
Expand Down
20 changes: 4 additions & 16 deletions coderd/wsbuilder/wsbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,10 @@ type Builder struct {
deploymentValues *codersdk.DeploymentValues
experiments codersdk.Experiments

richParameterValues []codersdk.WorkspaceBuildParameter
// dynamicParametersEnabled is non-nil if set externally
dynamicParametersEnabled *bool
initiator uuid.UUID
reason database.BuildReason
templateVersionPresetID uuid.UUID
richParameterValues []codersdk.WorkspaceBuildParameter
initiator uuid.UUID
reason database.BuildReason
templateVersionPresetID uuid.UUID

// used during build, makes function arguments less verbose
ctx context.Context
Expand Down Expand Up @@ -204,12 +202,6 @@ func (b Builder) MarkPrebuiltWorkspaceClaim() Builder {
return b
}

func (b Builder) DynamicParameters(using bool) Builder {
// nolint: revive
b.dynamicParametersEnabled = ptr.Ref(using)
return b
}

// SetLastWorkspaceBuildInTx prepopulates the Builder's cache with the last workspace build. This allows us
// to avoid a repeated database query when the Builder's caller also needs the workspace build, e.g. auto-start &
// auto-stop.
Expand Down Expand Up @@ -1211,10 +1203,6 @@ func (b *Builder) checkRunningBuild() error {
}

func (b *Builder) usingDynamicParameters() bool {
if b.dynamicParametersEnabled != nil {
return *b.dynamicParametersEnabled
}

tpl, err := b.getTemplate()
if err != nil {
return false // Let another part of the code get this error
Expand Down
1 change: 0 additions & 1 deletion codersdk/organizations.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ type CreateWorkspaceRequest struct {
RichParameterValues []WorkspaceBuildParameter `json:"rich_parameter_values,omitempty"`
AutomaticUpdates AutomaticUpdates `json:"automatic_updates,omitempty"`
TemplateVersionPresetID uuid.UUID `json:"template_version_preset_id,omitempty" format:"uuid"`
EnableDynamicParameters bool `json:"enable_dynamic_parameters,omitempty"`
}

func (c *Client) OrganizationByName(ctx context.Context, name string) (Organization, error) {
Expand Down
4 changes: 0 additions & 4 deletions codersdk/workspaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,6 @@ type CreateWorkspaceBuildRequest struct {
LogLevel ProvisionerLogLevel `json:"log_level,omitempty" validate:"omitempty,oneof=debug"`
// TemplateVersionPresetID is the ID of the template version preset to use for the build.
TemplateVersionPresetID uuid.UUID `json:"template_version_preset_id,omitempty" format:"uuid"`
// EnableDynamicParameters skips some of the static parameter checking.
// It will default to whatever the template has marked as the default experience.
// Requires the "dynamic-experiment" to be used.
EnableDynamicParameters *bool `json:"enable_dynamic_parameters,omitempty"`
}

type WorkspaceOptions struct {
Expand Down
1 change: 0 additions & 1 deletion docs/reference/api/builds.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions docs/reference/api/schemas.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions docs/reference/api/workspaces.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion enterprise/coderd/workspaces_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1759,7 +1759,6 @@ func TestWorkspaceTemplateParamsChange(t *testing.T) {
Value: "7",
},
},
EnableDynamicParameters: true,
})

// Then: the build should succeed. The updated value of param_min should be
Expand Down
2 changes: 0 additions & 2 deletions site/src/api/typesGenerated.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,6 @@ const CreateWorkspacePageExperimental: FC = () => {

const workspace = await createWorkspaceMutation.mutateAsync({
...workspaceRequest,
enable_dynamic_parameters: true,
userId: owner.id,
});
onCreateWorkspace(workspace);
Expand Down
Loading