Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit ccecc2f

Browse files
authored
fix: rename envs to workspaces (#421)
* Fix a few stray uses of the legacy "environments" terminology and replace it with "workspaces" * Rename Workspaces as Code to Workspace Templates
1 parent a430ef6 commit ccecc2f

File tree

4 files changed

+31
-31
lines changed

4 files changed

+31
-31
lines changed

coder-sdk/workspace.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ type ParseTemplateRequest struct {
112112
Local io.Reader `json:"-"`
113113
}
114114

115-
// TemplateVersion is a Workspaces As Code (WAC) template.
115+
// TemplateVersion is a workspace template.
116116
// For now, let's not interpret it on the CLI level. We just need
117117
// to forward this as part of the create workspace request.
118118
type TemplateVersion struct {

docs/coder_workspaces_create-from-config.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ create a new workspace from a template
44

55
### Synopsis
66

7-
Create a new Coder workspace using a Workspaces As Code template.
7+
Create a new Coder workspace using a workspace template.
88

99
```
1010
coder workspaces create-from-config [flags]
@@ -14,8 +14,8 @@ coder workspaces create-from-config [flags]
1414

1515
```
1616
# create a new workspace from git repository
17-
coder envs create-from-config --name="dev-env" --repo-url https://github.com/cdr/m --ref my-branch
18-
coder envs create-from-config --name="dev-env" -f coder.yaml
17+
coder workspaces create-from-config --name="dev-env" --repo-url https://github.com/cdr/m --ref my-branch
18+
coder workspaces create-from-config --name="dev-env" --filepath coder.yaml
1919
```
2020

2121
### Options

docs/coder_workspaces_edit-from-config.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ change the template a workspace is tracking
44

55
### Synopsis
66

7-
Edit an existing Coder workspace using a Workspaces As Code template.
7+
Edit an existing Coder workspace using a workspace template.
88

99
```
1010
coder workspaces edit-from-config [flags]
@@ -14,8 +14,8 @@ coder workspaces edit-from-config [flags]
1414

1515
```
1616
# edit a new workspace from git repository
17-
coder envs edit-from-config dev-env --repo-url https://github.com/cdr/m --ref my-branch
18-
coder envs edit-from-config dev-env -f coder.yaml
17+
coder workspaces edit-from-config dev-env --repo-url https://github.com/cdr/m --ref my-branch
18+
coder workspaces edit-from-config dev-env --filepath coder.yaml
1919
```
2020

2121
### Options

internal/cmd/workspaces.go

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -542,22 +542,22 @@ func selectOrg(needle string, haystack []coder.Organization) (*coder.Organizatio
542542
// If `update` is true, the update command is returned. If false, the create command.
543543
func workspaceFromConfigCmd(update bool) *cobra.Command {
544544
var (
545-
ref string
546-
repo string
547-
follow bool
548-
filepath string
549-
org string
550-
providerName string
551-
envName string
545+
ref string
546+
repo string
547+
follow bool
548+
filepath string
549+
org string
550+
providerName string
551+
workspaceName string
552552
)
553553

554554
run := func(cmd *cobra.Command, args []string) error {
555555
ctx := cmd.Context()
556556

557557
// Update requires the env name, and the name should be the first argument.
558558
if update {
559-
envName = args[0]
560-
} else if envName == "" {
559+
workspaceName = args[0]
560+
} else if workspaceName == "" {
561561
// Create takes the name as a flag, and it must be set
562562
return clog.Error("Must provide a workspace name.",
563563
clog.BlankLine,
@@ -581,17 +581,17 @@ func workspaceFromConfigCmd(update bool) *cobra.Command {
581581
}
582582

583583
// This is the env to be updated/created
584-
var env *coder.Workspace
584+
var workspace *coder.Workspace
585585

586586
// OrgID is the org where the template and env should be created.
587587
// If we are updating an env, use the orgID from the workspace.
588588
var orgID string
589589
if update {
590-
env, err = findWorkspace(ctx, client, envName, coder.Me)
590+
workspace, err = findWorkspace(ctx, client, workspaceName, coder.Me)
591591
if err != nil {
592592
return handleAPIError(err)
593593
}
594-
orgID = env.OrganizationID
594+
orgID = workspace.OrganizationID
595595
} else {
596596
var userOrg *coder.Organization
597597
// Select org in list or use default
@@ -637,16 +637,16 @@ func workspaceFromConfigCmd(update bool) *cobra.Command {
637637
}
638638

639639
if update {
640-
err = client.EditWorkspace(ctx, env.ID, coder.UpdateWorkspaceReq{
640+
err = client.EditWorkspace(ctx, workspace.ID, coder.UpdateWorkspaceReq{
641641
TemplateID: &version.TemplateID,
642642
})
643643
} else {
644-
env, err = client.CreateWorkspace(ctx, coder.CreateWorkspaceRequest{
644+
workspace, err = client.CreateWorkspace(ctx, coder.CreateWorkspaceRequest{
645645
OrgID: orgID,
646646
TemplateID: version.TemplateID,
647647
ResourcePoolID: provider.ID,
648648
Namespace: provider.DefaultNamespace,
649-
Name: envName,
649+
Name: workspaceName,
650650
})
651651
}
652652
if err != nil {
@@ -655,15 +655,15 @@ func workspaceFromConfigCmd(update bool) *cobra.Command {
655655

656656
if follow {
657657
clog.LogSuccess("creating workspace...")
658-
if err := trailBuildLogs(ctx, client, env.ID); err != nil {
658+
if err := trailBuildLogs(ctx, client, workspace.ID); err != nil {
659659
return err
660660
}
661661
return nil
662662
}
663663

664664
clog.LogSuccess("creating workspace...",
665665
clog.BlankLine,
666-
clog.Tipf(`run "coder envs watch-build %s" to trail the build logs`, env.Name),
666+
clog.Tipf(`run "coder workspaces watch-build %s" to see build logs`, workspace.Name),
667667
)
668668
return nil
669669
}
@@ -673,25 +673,25 @@ func workspaceFromConfigCmd(update bool) *cobra.Command {
673673
cmd = &cobra.Command{
674674
Use: "edit-from-config",
675675
Short: "change the template a workspace is tracking",
676-
Long: "Edit an existing Coder workspace using a Workspaces As Code template.",
676+
Long: "Edit an existing Coder workspace using a workspace template.",
677677
Args: cobra.ExactArgs(1),
678678
Example: `# edit a new workspace from git repository
679-
coder envs edit-from-config dev-env --repo-url https://github.com/cdr/m --ref my-branch
680-
coder envs edit-from-config dev-env -f coder.yaml`,
679+
coder workspaces edit-from-config dev-env --repo-url https://github.com/cdr/m --ref my-branch
680+
coder workspaces edit-from-config dev-env --filepath coder.yaml`,
681681
RunE: run,
682682
}
683683
} else {
684684
cmd = &cobra.Command{
685685
Use: "create-from-config",
686686
Short: "create a new workspace from a template",
687-
Long: "Create a new Coder workspace using a Workspaces As Code template.",
687+
Long: "Create a new Coder workspace using a workspace template.",
688688
Example: `# create a new workspace from git repository
689-
coder envs create-from-config --name="dev-env" --repo-url https://github.com/cdr/m --ref my-branch
690-
coder envs create-from-config --name="dev-env" -f coder.yaml`,
689+
coder workspaces create-from-config --name="dev-env" --repo-url https://github.com/cdr/m --ref my-branch
690+
coder workspaces create-from-config --name="dev-env" --filepath coder.yaml`,
691691
RunE: run,
692692
}
693693
cmd.Flags().StringVar(&providerName, "provider", "", "name of Workspace Provider with which to create the workspace")
694-
cmd.Flags().StringVar(&envName, "name", "", "name of the workspace to be created")
694+
cmd.Flags().StringVar(&workspaceName, "name", "", "name of the workspace to be created")
695695
cmd.Flags().StringVarP(&org, "org", "o", "", "name of the organization the workspace should be created under.")
696696
// Ref and repo-url can only be used for create
697697
cmd.Flags().StringVarP(&ref, "ref", "", "master", "git reference to pull template from. May be a branch, tag, or commit hash.")

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy