mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix(cli): scaletest: create-worksapces: remove invalid character for kubernetes provider in implicit plan (#10228)
This commit is contained in:
+1
-41
@@ -503,7 +503,6 @@ func (r *RootCmd) scaletestCreateWorkspaces() *clibase.Cmd {
|
||||
count int64
|
||||
template string
|
||||
|
||||
noPlan bool
|
||||
noCleanup bool
|
||||
// TODO: implement this flag
|
||||
// noCleanupFailures bool
|
||||
@@ -594,10 +593,6 @@ func (r *RootCmd) scaletestCreateWorkspaces() *clibase.Cmd {
|
||||
if tpl.ID == uuid.Nil {
|
||||
return xerrors.Errorf("could not find template %q in any organization", template)
|
||||
}
|
||||
templateVersion, err := client.TemplateVersion(ctx, tpl.ActiveVersionID)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("get template version %q: %w", tpl.ActiveVersionID, err)
|
||||
}
|
||||
|
||||
cliRichParameters, err := asWorkspaceBuildParameters(parameterFlags.richParameters)
|
||||
if err != nil {
|
||||
@@ -607,7 +602,7 @@ func (r *RootCmd) scaletestCreateWorkspaces() *clibase.Cmd {
|
||||
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?
|
||||
NewWorkspaceName: "scaletest-N", // TODO: the scaletest runner will pass in a different name here. Does this matter?
|
||||
|
||||
RichParameterFile: parameterFlags.richParameterFile,
|
||||
RichParameters: cliRichParameters,
|
||||
@@ -616,35 +611,6 @@ func (r *RootCmd) scaletestCreateWorkspaces() *clibase.Cmd {
|
||||
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",
|
||||
RichParameterValues: richParameters,
|
||||
})
|
||||
if err != nil {
|
||||
return xerrors.Errorf("start dry run workspace creation: %w", err)
|
||||
}
|
||||
_, _ = fmt.Fprintln(inv.Stdout, "Planning workspace...")
|
||||
err = cliui.ProvisionerJob(inv.Context(), inv.Stdout, cliui.ProvisionerJobOptions{
|
||||
Fetch: func() (codersdk.ProvisionerJob, error) {
|
||||
return client.TemplateVersionDryRun(inv.Context(), templateVersion.ID, dryRun.ID)
|
||||
},
|
||||
Cancel: func() error {
|
||||
return client.CancelTemplateVersionDryRun(inv.Context(), templateVersion.ID, dryRun.ID)
|
||||
},
|
||||
Logs: func() (<-chan codersdk.ProvisionerJobLog, io.Closer, error) {
|
||||
return client.TemplateVersionDryRunLogsAfter(inv.Context(), templateVersion.ID, dryRun.ID, 0)
|
||||
},
|
||||
// Don't show log output for the dry-run unless there's an error.
|
||||
Silent: true,
|
||||
})
|
||||
if err != nil {
|
||||
return xerrors.Errorf("dry-run workspace: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
tracerProvider, closeTracing, tracingEnabled, err := tracingFlags.provider(ctx)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("create tracer provider: %w", err)
|
||||
@@ -793,12 +759,6 @@ func (r *RootCmd) scaletestCreateWorkspaces() *clibase.Cmd {
|
||||
Description: "Required: Name or ID of the template to use for workspaces.",
|
||||
Value: clibase.StringOf(&template),
|
||||
},
|
||||
{
|
||||
Flag: "no-plan",
|
||||
Env: "CODER_SCALETEST_NO_PLAN",
|
||||
Description: `Skip the dry-run step to plan the workspace creation. This step ensures that the given parameters are valid for the given template.`,
|
||||
Value: clibase.BoolOf(&noPlan),
|
||||
},
|
||||
{
|
||||
Flag: "no-cleanup",
|
||||
Env: "CODER_SCALETEST_NO_CLEANUP",
|
||||
|
||||
Reference in New Issue
Block a user