Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: disable parameter validatation for dynamic params for all transitions#17926

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Emyrk merged 16 commits intomainfromstevenmasley/deleting_workspace_params
May 20, 2025

Conversation

Emyrk
Copy link
Member

@EmyrkEmyrk commentedMay 19, 2025
edited
Loading

What this does

Dynamic params currently has relaxed parameter validation in coder/coder. This is because conditional parameters cannot be validated with the static parameters in the database.

We might want to tighten this up later based on thecoder provider version in the terraform. As version >=2.4.0 all have the strict validation built into the provider. And the UI form relies on the preview engine for validation.

Unit test

A unit test of validation drift is present. Without this dynamic params option in wsbuilder, workspace transactions fail to validate, and will never succeed.

This puts the workspace in a locked position where you cannot change its state.

The error is:

unexpected status code 400: Unable to validate parameter "param"Error: can't validate build parameter "param": value 5 is less than the minimum 10

This would also break updates, auto-starts, auto-stop, deletes, etc.

Future work

Before we exit experimental, we should revisit if parameter validation is critical in coder/coder (for provider versions >2.4.0).

Validation in coder/coder is for raising errors early, rather than waiting for the terraform logs. For any action without the ability to change params, this does not really provide much help, as there is no way to resolve the issue.

We can always hook up dynamic params to more endpoints, the cost is just a bit of memory loading in all the files.

#17942

Note

This currently only applies to deployments that enable the experiment. Historical versions enforce the previous validation always.

Templates can additionally be opt-in or opt-out of dynamic params. Meaning a deployment with the experiment could have some templates testing the new params, and some on the old.

Validation drift prevents builds from being submitted, suchas deleting
@EmyrkEmyrk changed the titlechore: unit test to showcase param validation driftchore: param validation drift permanently locks workspace stateMay 19, 2025
@EmyrkEmyrk marked this pull request as draftMay 19, 2025 22:30
@EmyrkEmyrk changed the titlechore: param validation drift permanently locks workspace statechore: dynamic params validation on all workspace build transitionsMay 20, 2025
@EmyrkEmyrk changed the titlechore: dynamic params validation on all workspace build transitionschore: disable parameter validatation for dynamic params on all workspace build transitionsMay 20, 2025
@EmyrkEmyrk changed the titlechore: disable parameter validatation for dynamic params on all workspace build transitionschore: disable parameter validatation for dynamic params for all transitionsMay 20, 2025
Comment on lines 387 to 392
// Only defer to dynamic parameters if the experiment is enabled.
if api.Experiments.Enabled(codersdk.ExperimentDynamicParameters) &&
createBuild.EnableDynamicParameters != nil {
// Explicit opt-in
builder = builder.DynamicParameters(*createBuild.EnableDynamicParameters)
}
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I provide the explicit opt in as a way to force through transitions such asDELETE if there an issue. It would be unfortunate to have to change a template wide setting to fix a single workspace if we get into a strange state.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Can we drop a WARN or something if the build requests dynamic parameters but the experiment is not enabled?

Emyrk reacted with thumbs up emoji
@EmyrkEmyrk requested a review fromjohnstcnMay 20, 2025 03:49
@EmyrkEmyrk marked this pull request as ready for reviewMay 20, 2025 03:49
Comment on lines 387 to 392
// Only defer to dynamic parameters if the experiment is enabled.
if api.Experiments.Enabled(codersdk.ExperimentDynamicParameters) &&
createBuild.EnableDynamicParameters != nil {
// Explicit opt-in
builder = builder.DynamicParameters(*createBuild.EnableDynamicParameters)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Can we drop a WARN or something if the build requests dynamic parameters but the experiment is not enabled?

Emyrk reacted with thumbs up emoji
Comment on lines +1048 to +1053
func ProvisionerVersionSupportsDynamicParameters(version string) bool {
major, minor, err := apiversion.Parse(version)
// If the api version is not valid or less than 1.6, we need to use the static parameters
useStaticParams := err != nil || major < 1 || (major == 1 && minor < 6)
return !useStaticParams
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

nit: this feels like something that might want to be inprovisionersdk

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Hmm. Really tough to know where to place it. I'm going to keep it with wsbuilder right now, since it only affects workspace builds.

I think I'll create a new package for dynamic params more generally as more code is added to support the feature, and I can move it there.

johnstcn reacted with thumbs up emoji
@EmyrkEmyrk requested a review fromjohnstcnMay 20, 2025 13:37
@EmyrkEmyrk merged commite76d58f intomainMay 20, 2025
41 checks passed
@EmyrkEmyrk deleted the stevenmasley/deleting_workspace_params branchMay 20, 2025 15:09
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsMay 20, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@johnstcnjohnstcnjohnstcn approved these changes

Assignees

@EmyrkEmyrk

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@Emyrk@johnstcn

[8]ページ先頭

©2009-2025 Movatter.jp