Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 30, 2024. It is now read-only.
/coder-v1-cliPublic archive

fix: rename envs to workspaces#421

Merged
jawnsy merged 1 commit intomainfromjawnsy/ch16287/chore-rename-envs-workspaces
Aug 24, 2021
Merged
Show file tree
Hide file tree
Changes fromall 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
2 changes: 1 addition & 1 deletioncoder-sdk/workspace.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -112,7 +112,7 @@ type ParseTemplateRequest struct {
Local io.Reader `json:"-"`
}

// TemplateVersion is aWorkspaces As Code (WAC) template.
// TemplateVersion is aworkspace template.
// For now, let's not interpret it on the CLI level. We just need
// to forward this as part of the create workspace request.
type TemplateVersion struct {
Expand Down
6 changes: 3 additions & 3 deletionsdocs/coder_workspaces_create-from-config.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,7 +4,7 @@ create a new workspace from a template

### Synopsis

Create a new Coder workspace using aWorkspaces As Code template.
Create a new Coder workspace using aworkspace template.

```
coder workspaces create-from-config [flags]
Expand All@@ -14,8 +14,8 @@ coder workspaces create-from-config [flags]

```
# create a new workspace from git repository
coderenvs create-from-config --name="dev-env" --repo-url https://github.com/cdr/m --ref my-branch
coderenvs create-from-config --name="dev-env" -f coder.yaml
coderworkspaces create-from-config --name="dev-env" --repo-url https://github.com/cdr/m --ref my-branch
coderworkspaces create-from-config --name="dev-env" --filepath coder.yaml
```

### Options
Expand Down
6 changes: 3 additions & 3 deletionsdocs/coder_workspaces_edit-from-config.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,7 +4,7 @@ change the template a workspace is tracking

### Synopsis

Edit an existing Coder workspace using aWorkspaces As Code template.
Edit an existing Coder workspace using aworkspace template.

```
coder workspaces edit-from-config [flags]
Expand All@@ -14,8 +14,8 @@ coder workspaces edit-from-config [flags]

```
# edit a new workspace from git repository
coderenvs edit-from-config dev-env --repo-url https://github.com/cdr/m --ref my-branch
coderenvs edit-from-config dev-env -f coder.yaml
coderworkspaces edit-from-config dev-env --repo-url https://github.com/cdr/m --ref my-branch
coderworkspaces edit-from-config dev-env --filepath coder.yaml
```

### Options
Expand Down
48 changes: 24 additions & 24 deletionsinternal/cmd/workspaces.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -542,22 +542,22 @@ func selectOrg(needle string, haystack []coder.Organization) (*coder.Organizatio
// If `update` is true, the update command is returned. If false, the create command.
func workspaceFromConfigCmd(update bool) *cobra.Command {
var (
ref string
repo string
follow bool
filepath string
org string
providerName string
envName string
refstring
repostring
followbool
filepathstring
orgstring
providerNamestring
workspaceName string
)

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

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

// This is the env to be updated/created
varenv *coder.Workspace
varworkspace *coder.Workspace

// OrgID is the org where the template and env should be created.
// If we are updating an env, use the orgID from the workspace.
var orgID string
if update {
env, err = findWorkspace(ctx, client,envName, coder.Me)
workspace, err = findWorkspace(ctx, client,workspaceName, coder.Me)
if err != nil {
return handleAPIError(err)
}
orgID =env.OrganizationID
orgID =workspace.OrganizationID
} else {
var userOrg *coder.Organization
// Select org in list or use default
Expand DownExpand Up@@ -637,16 +637,16 @@ func workspaceFromConfigCmd(update bool) *cobra.Command {
}

if update {
err = client.EditWorkspace(ctx,env.ID, coder.UpdateWorkspaceReq{
err = client.EditWorkspace(ctx,workspace.ID, coder.UpdateWorkspaceReq{
TemplateID: &version.TemplateID,
})
} else {
env, err = client.CreateWorkspace(ctx, coder.CreateWorkspaceRequest{
workspace, err = client.CreateWorkspace(ctx, coder.CreateWorkspaceRequest{
OrgID: orgID,
TemplateID: version.TemplateID,
ResourcePoolID: provider.ID,
Namespace: provider.DefaultNamespace,
Name:envName,
Name:workspaceName,
})
}
if err != nil {
Expand All@@ -655,15 +655,15 @@ func workspaceFromConfigCmd(update bool) *cobra.Command {

if follow {
clog.LogSuccess("creating workspace...")
if err := trailBuildLogs(ctx, client,env.ID); err != nil {
if err := trailBuildLogs(ctx, client,workspace.ID); err != nil {
return err
}
return nil
}

clog.LogSuccess("creating workspace...",
clog.BlankLine,
clog.Tipf(`run "coderenvs watch-build %s" totrail thebuild logs`,env.Name),
clog.Tipf(`run "coderworkspaces watch-build %s" toseebuild logs`,workspace.Name),
)
return nil
}
Expand All@@ -673,25 +673,25 @@ func workspaceFromConfigCmd(update bool) *cobra.Command {
cmd = &cobra.Command{
Use: "edit-from-config",
Short: "change the template a workspace is tracking",
Long: "Edit an existing Coder workspace using aWorkspaces As Code template.",
Long: "Edit an existing Coder workspace using aworkspace template.",
Args: cobra.ExactArgs(1),
Example: `# edit a new workspace from git repository
coderenvs edit-from-config dev-env --repo-url https://github.com/cdr/m --ref my-branch
coderenvs edit-from-config dev-env -f coder.yaml`,
coderworkspaces edit-from-config dev-env --repo-url https://github.com/cdr/m --ref my-branch
coderworkspaces edit-from-config dev-env --filepath coder.yaml`,
RunE: run,
}
} else {
cmd = &cobra.Command{
Use: "create-from-config",
Short: "create a new workspace from a template",
Long: "Create a new Coder workspace using aWorkspaces As Code template.",
Long: "Create a new Coder workspace using aworkspace template.",
Example: `# create a new workspace from git repository
coderenvs create-from-config --name="dev-env" --repo-url https://github.com/cdr/m --ref my-branch
coderenvs create-from-config --name="dev-env" -f coder.yaml`,
coderworkspaces create-from-config --name="dev-env" --repo-url https://github.com/cdr/m --ref my-branch
coderworkspaces create-from-config --name="dev-env" --filepath coder.yaml`,
RunE: run,
}
cmd.Flags().StringVar(&providerName, "provider", "", "name of Workspace Provider with which to create the workspace")
cmd.Flags().StringVar(&envName, "name", "", "name of the workspace to be created")
cmd.Flags().StringVar(&workspaceName, "name", "", "name of the workspace to be created")
cmd.Flags().StringVarP(&org, "org", "o", "", "name of the organization the workspace should be created under.")
// Ref and repo-url can only be used for create
cmd.Flags().StringVarP(&ref, "ref", "", "master", "git reference to pull template from. May be a branch, tag, or commit hash.")
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp