Skip to content

fix(cli): remove invalid character for kubernetes provider in implicit non-obvious plan #10228

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
Oct 12, 2023
Merged
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
42 changes: 1 addition & 41 deletions cli/exp_scaletest.go
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,6 @@ func (r *RootCmd) scaletestCreateWorkspaces() *clibase.Cmd {
count int64
template string

noPlan bool
noCleanup bool
// TODO: implement this flag
// noCleanupFailures bool
Expand Down Expand Up @@ -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 {
Expand All @@ -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?
Copy link
Member

Choose a reason for hiding this comment

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

I presume that the comment is still valid?

Copy link
Member Author

Choose a reason for hiding this comment

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

As we saw, it does appear to matter if NewWorkspaceName ends up not being valid :-)


RichParameterFile: parameterFlags.richParameterFile,
RichParameters: cliRichParameters,
Expand All @@ -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)
Expand Down Expand Up @@ -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",
Expand Down