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

Skip to content

chore: add dynamic parameter warning if missing metadata #17809

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 9 commits into from
May 14, 2025

Conversation

Emyrk
Copy link
Member

@Emyrk Emyrk commented May 13, 2025

EDIT: I made it an error instead of a warning

Templates from before

Screenshot From 2025-05-13 16-57-59

Templates on an old provisioner

Screenshot From 2025-05-13 17-00-14

Dynamic parameters require the latest provisioner to function
@Emyrk Emyrk changed the title chore: previous template versions missing dynamic param metadata chore: add dynamic param metadata to previous template versions May 13, 2025
@Emyrk Emyrk marked this pull request as ready for review May 13, 2025 22:16
@Emyrk Emyrk requested a review from aslilac May 14, 2025 14:38
func NewServer(lifecycleCtx context.Context,
func NewServer(
lifecycleCtx context.Context,
apiVersion string,
Copy link
Member

Choose a reason for hiding this comment

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

I don't feel like coderd should be telling the provisioner what it's version is. This would break on deployments with external provisioners that are on an older version. and I know that's not really a thing we prioritize supporting, but this masks over the mismatched versions in a bad way.

Copy link
Member Author

Choose a reason for hiding this comment

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

Coderd does not tell the provisioner.

External provisioners call coderd via provisionerDaemonServe

In that, they add a query param of their version:

apiVersion := "1.0"
if qv := r.URL.Query().Get("version"); qv != "" {
apiVersion = qv
}

Which is saved to the DB, and what we show on the provisioners page:

APIVersion: apiVersion,

And in that serve function, that apiVersion is sent to the go routine that manages the gRPC connection:

So the apiVersion in that NewServer is the Coderd side of the provisioner. And that version is sourced from the external provisionerd

Copy link
Member Author

Choose a reason for hiding this comment

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

The daemon client sends the version here:

query.Add("version", proto.CurrentVersion.String())

Idk why it sets it twice

@Emyrk Emyrk changed the title chore: add dynamic param metadata to previous template versions chore: add dynamic parameter warning if missing metadata May 14, 2025
func parameterProvisionerVersionDiagnostic(tf database.TemplateVersionTerraformValue) hcl.Diagnostics {
missingMetaData := hcl.Diagnostic{
Severity: hcl.DiagError,
Summary: "This template version is missing required metadata to support dynamic parameters. Go back to the classic creation flow.",
Copy link
Member

Choose a reason for hiding this comment

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

hmm. I don't like this. I would much prefer if we could have a way to expose this naturally to the frontend, forcing it over to the classic form. why make everyone click the "dynamic parameters suck" button? that's a super bad first impression

Copy link
Member Author

Choose a reason for hiding this comment

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

You are right, it is unfortunate. I want to get this in first, just to get an error up if someone toggles on dev and get this detection in. I will build on this experience.

We just need something now, otherwise it fails silently.

@Emyrk Emyrk merged commit 789c4be into main May 14, 2025
34 checks passed
@Emyrk Emyrk deleted the stevenmasley/old_version branch May 14, 2025 17:21
@github-actions github-actions bot locked and limited conversation to collaborators May 14, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants