-
Notifications
You must be signed in to change notification settings - Fork 886
feat(cli): add --parameter flag to exp scaletest command #10132
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -525,6 +525,8 @@ func (r *RootCmd) scaletestCreateWorkspaces() *clibase.Cmd { | |
|
||
useHostUser bool | ||
|
||
parameterFlags workspaceParameterFlags | ||
|
||
tracingFlags = &scaletestTracingFlags{} | ||
strategy = &scaletestStrategyFlags{} | ||
cleanupStrategy = &scaletestStrategyFlags{cleanup: true} | ||
|
@@ -597,11 +599,29 @@ func (r *RootCmd) scaletestCreateWorkspaces() *clibase.Cmd { | |
return xerrors.Errorf("get template version %q: %w", tpl.ActiveVersionID, err) | ||
} | ||
|
||
cliRichParameters, err := asWorkspaceBuildParameters(parameterFlags.richParameters) | ||
if err != nil { | ||
return xerrors.Errorf("can't parse given parameter values: %w", err) | ||
} | ||
|
||
richParameters, err := prepWorkspaceBuild(inv, client, prepWorkspaceBuildArgs{ | ||
Action: WorkspaceCreate, | ||
Template: tpl, | ||
NewWorkspaceName: "scaletest-%", // TODO: the scaletest runner will pass in a different name here. Does this matter? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mtojek Does the value here only matter for showing the plan output? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, only for dry-run purposes. Not sure what happens if there is a workspace with such name exists. In the worst case, you can append a random number. |
||
|
||
RichParameterFile: parameterFlags.richParameterFile, | ||
RichParameters: cliRichParameters, | ||
}) | ||
if err != nil { | ||
return xerrors.Errorf("prepare build: %w", err) | ||
} | ||
|
||
// Do a dry-run to ensure the template and parameters are valid | ||
// before we start creating users and workspaces. | ||
if !noPlan { | ||
dryRun, err := client.CreateTemplateVersionDryRun(ctx, templateVersion.ID, codersdk.CreateTemplateVersionDryRunRequest{ | ||
WorkspaceName: "scaletest", | ||
WorkspaceName: "scaletest", | ||
RichParameterValues: richParameters, | ||
}) | ||
if err != nil { | ||
return xerrors.Errorf("start dry run workspace creation: %w", err) | ||
|
@@ -653,7 +673,8 @@ func (r *RootCmd) scaletestCreateWorkspaces() *clibase.Cmd { | |
OrganizationID: me.OrganizationIDs[0], | ||
// UserID is set by the test automatically. | ||
Request: codersdk.CreateWorkspaceRequest{ | ||
TemplateID: tpl.ID, | ||
TemplateID: tpl.ID, | ||
RichParameterValues: richParameters, | ||
}, | ||
NoWaitForAgents: noWaitForAgents, | ||
}, | ||
|
@@ -865,6 +886,7 @@ func (r *RootCmd) scaletestCreateWorkspaces() *clibase.Cmd { | |
}, | ||
} | ||
|
||
cmd.Options = append(cmd.Options, parameterFlags.cliParameters()...) | ||
tracingFlags.attach(&cmd.Options) | ||
strategy.attach(&cmd.Options) | ||
cleanupStrategy.attach(&cmd.Options) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI This may also pull
--build-options
, not sure if you want to support them too. Probably not.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see a need at present. We don't rebuild workspaces in this command, only create.