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

Trail build logs if follow enabled for envs edit #155

Merged
merged 1 commit into from
Oct 23, 2020
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
4 changes: 0 additions & 4 deletions docs/coder.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

coder provides a CLI for working with an existing Coder Enterprise installation

### Synopsis

coder provides a CLI for working with an existing Coder Enterprise installation

### Options

```
Expand Down
4 changes: 0 additions & 4 deletions docs/coder_login.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

Authenticate this client for future operations

### Synopsis

Authenticate this client for future operations

```
coder login [Coder Enterprise URL eg. https://my.coder.domain/] [flags]
```
Expand Down
4 changes: 0 additions & 4 deletions docs/coder_logout.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

Remove local authentication credentials if any exist

### Synopsis

Remove local authentication credentials if any exist

```
coder logout [flags]
```
Expand Down
4 changes: 0 additions & 4 deletions docs/coder_secrets_ls.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

List all secrets owned by the active user

### Synopsis

List all secrets owned by the active user

```
coder secrets ls [flags]
```
Expand Down
4 changes: 0 additions & 4 deletions docs/coder_secrets_rm.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

Remove one or more secrets by name

### Synopsis

Remove one or more secrets by name

```
coder secrets rm [...secret_name] [flags]
```
Expand Down
4 changes: 0 additions & 4 deletions docs/coder_secrets_view.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

View a secret by name

### Synopsis

View a secret by name

```
coder secrets view [secret_name] [flags]
```
Expand Down
4 changes: 0 additions & 4 deletions docs/coder_sync.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

Establish a one way directory sync to a Coder environment

### Synopsis

Establish a one way directory sync to a Coder environment

```
coder sync [local directory] [<env name>:<remote directory>] [flags]
```
Expand Down
4 changes: 0 additions & 4 deletions docs/coder_urls.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

Interact with environment DevURLs

### Synopsis

Interact with environment DevURLs

### Options

```
Expand Down
4 changes: 0 additions & 4 deletions docs/coder_urls_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

Create a new devurl for an environment

### Synopsis

Create a new devurl for an environment

```
coder urls create [env_name] [port] [--access <level>] [--name <name>] [flags]
```
Expand Down
4 changes: 0 additions & 4 deletions docs/coder_urls_ls.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

List all DevURLs for an environment

### Synopsis

List all DevURLs for an environment

```
coder urls ls [environment_name] [flags]
```
Expand Down
4 changes: 0 additions & 4 deletions docs/coder_urls_rm.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

Remove a dev url

### Synopsis

Remove a dev url

```
coder urls rm [environment_name] [port] [flags]
```
Expand Down
4 changes: 0 additions & 4 deletions docs/coder_users.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

Interact with Coder user accounts

### Synopsis

Interact with Coder user accounts

### Options

```
Expand Down
4 changes: 0 additions & 4 deletions docs/coder_users_ls.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

list all user accounts

### Synopsis

list all user accounts

```
coder users ls [flags]
```
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ require (
cdr.dev/wsep v0.0.0-20200728013649-82316a09813f
github.com/briandowns/spinner v1.11.1
github.com/fatih/color v1.9.0
github.com/gorilla/websocket v1.4.1
github.com/gorilla/websocket v1.4.2
github.com/kirsle/configdir v0.0.0-20170128060238-e45d2f54772f
github.com/klauspost/compress v1.10.8 // indirect
github.com/manifoldco/promptui v0.7.0
github.com/mattn/go-colorable v0.1.8 // indirect
github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4
github.com/rjeczalik/notify v0.9.2
github.com/spf13/cobra v1.0.0
github.com/spf13/cobra v1.1.1
github.com/stretchr/testify v1.6.1
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
golang.org/x/net v0.0.0-20200822124328-c89045814202 // indirect
Expand Down
76 changes: 64 additions & 12 deletions go.sum

Large diffs are not rendered by default.

24 changes: 16 additions & 8 deletions internal/cmd/envs.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,17 +183,18 @@ coder envs create --cpu 4 --disk 100 --memory 8 --image 5f443b16-30652892427b955
return xerrors.Errorf("create environment: %w", err)
}

clog.LogSuccess(
"creating environment...",
clog.BlankLine,
clog.Tipf(`run "coder envs watch-build %q" to trail the build logs`, args[0]),
)

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

clog.LogSuccess("creating environment...",
clog.BlankLine,
clog.Tipf(`run "coder envs watch-build %q" to trail the build logs`, env.Name),
)
return nil
},
}
Expand Down Expand Up @@ -293,8 +294,15 @@ coder envs edit back-end-env --disk 20`,
return xerrors.Errorf("failed to apply changes to environment: '%s'", envName)
}

clog.LogSuccess(
"applied changes to the environment, rebuilding...",
if follow {
clog.LogSuccess("applied changes to the environment, rebuilding...")
if err := trailBuildLogs(cmd.Context(), client, env.ID); err != nil {
return err
}
return nil
}

clog.LogSuccess("applied changes to the environment, rebuilding...",
clog.BlankLine,
clog.Tipf(`run "coder envs watch-build %q" to trail the build logs`, envName),
)
Expand Down