Thanks to visit codestin.com
Credit goes to github.com

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

chore: Unhide create-from-config #306

Merged
merged 2 commits into from
Mar 30, 2021
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions docs/coder_envs.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Perform operations on the Coder environments owned by the active user.

* [coder](coder.md) - coder provides a CLI for working with an existing Coder Enterprise installation
* [coder envs create](coder_envs_create.md) - create a new environment.
* [coder envs create-from-config](coder_envs_create-from-config.md) - create a new environment from a template
* [coder envs edit](coder_envs_edit.md) - edit an existing environment and initiate a rebuild.
* [coder envs ls](coder_envs_ls.md) - list all environments owned by the active user
* [coder envs rebuild](coder_envs_rebuild.md) - rebuild a Coder environment
Expand Down
43 changes: 43 additions & 0 deletions docs/coder_envs_create-from-config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
## coder envs create-from-config

create a new environment from a template

### Synopsis

Create a new Coder environment using a Workspaces As Code template.

```
coder envs create-from-config [flags]
```

### Examples

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

### Options

```
-f, --filepath string path to local template file.
--follow follow buildlog after initiating rebuild
-h, --help help for create-from-config
--name string name of the environment to be created
-o, --org string name of the organization the environment should be created under.
--provider string name of Workspace Provider with which to create the environment
--ref string git reference to pull template from. May be a branch, tag, or commit hash. (default "master")
-r, --repo-url string URL of the git repository to pull the config from. Config file must live in '.coder/coder.yaml'.
```

### Options inherited from parent commands

```
-v, --verbose show verbose output
```

### SEE ALSO

* [coder envs](coder_envs.md) - Interact with Coder environments

15 changes: 7 additions & 8 deletions internal/cmd/envs.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func envsCmd() *cobra.Command {
watchBuildLogCommand(),
rebuildEnvCommand(),
createEnvCmd(),
createEnvFromRepoCmd(),
createEnvFromConfigCmd(),
editEnvCmd(),
)
return cmd
Expand Down Expand Up @@ -291,7 +291,7 @@ coder envs create my-new-powerful-env --cpu 12 --disk 100 --memory 16 --image ub
return cmd
}

func createEnvFromRepoCmd() *cobra.Command {
func createEnvFromConfigCmd() *cobra.Command {
var (
ref string
repo string
Expand All @@ -303,12 +303,11 @@ func createEnvFromRepoCmd() *cobra.Command {
)

cmd := &cobra.Command{
Use: "create-from-config",
Short: "create a new environment from a config file.",
Long: "Create a new Coder environment from a config file.",
Hidden: true,
Example: `# create a new environment from git repository template
coder envs create-from-config --name="dev-env" --repo-url github.com/cdr/m --ref my-branch
Use: "create-from-config",
Short: "create a new environment from a template",
Long: "Create a new Coder environment using a Workspaces As Code template.",
Example: `# create a new environment from git repository
coder envs create-from-config --name="dev-env" --repo-url https://github.com/cdr/m --ref my-branch
coder envs create-from-config --name="dev-env" -f coder.yaml`,
RunE: func(cmd *cobra.Command, args []string) error {
ctx := cmd.Context()
Expand Down