chore: create workspaces and templates for multiple orgs (#13866)

* chore: creating workspaces and templates to work with orgs
* handle wrong org selected
* create org member in coderdtest helper
This commit is contained in:
Steven Masley
2024-07-12 10:47:28 -10:00
committed by GitHub
parent e4aef272fa
commit 9cbe2b27e7
9 changed files with 312 additions and 16 deletions

View File

@ -160,7 +160,7 @@ func (r *RootCmd) templateCreate() *serpent.Command {
RequireActiveVersion: requireActiveVersion,
}
_, err = client.CreateTemplate(inv.Context(), organization.ID, createReq)
template, err := client.CreateTemplate(inv.Context(), organization.ID, createReq)
if err != nil {
return err
}
@ -171,7 +171,7 @@ func (r *RootCmd) templateCreate() *serpent.Command {
pretty.Sprint(cliui.DefaultStyles.DateTimeStamp, time.Now().Format(time.Stamp))+"! "+
"Developers can provision a workspace with this template using:")+"\n")
_, _ = fmt.Fprintln(inv.Stdout, " "+pretty.Sprint(cliui.DefaultStyles.Code, fmt.Sprintf("coder create --template=%q [workspace name]", templateName)))
_, _ = fmt.Fprintln(inv.Stdout, " "+pretty.Sprint(cliui.DefaultStyles.Code, fmt.Sprintf("coder create --template=%q --org=%q [workspace name]", templateName, template.OrganizationName)))
_, _ = fmt.Fprintln(inv.Stdout)
return nil
@ -244,6 +244,7 @@ func (r *RootCmd) templateCreate() *serpent.Command {
cliui.SkipPromptOption(),
}
orgContext.AttachOptions(cmd)
cmd.Options = append(cmd.Options, uploadFlags.options()...)
return cmd
}