Skip to content

feat: Add "coder projects create" command #246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Feb 12, 2022
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Only show job status if completed
  • Loading branch information
kylecarbs committed Feb 11, 2022
commit bff96b692b8883ded1191c3ddeaa97d51d32b4ca
9 changes: 7 additions & 2 deletions cli/projectcreate.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,13 @@ func doProjectLoop(cmd *cobra.Command, client *codersdk.Client, organization cod
if err != nil {
return nil, err
}
logBuffer := make([]coderd.ProvisionerJobLog, 0, 64)
for {
_, ok := <-logs
log, ok := <-logs
if !ok {
break
}
// _, _ = fmt.Fprintf(cmd.OutOrStdout(), "%s %s\n", color.HiGreenString("[tf]"), log.Output)
logBuffer = append(logBuffer, log)
}

job, err = client.ProvisionerJob(cmd.Context(), organization.Name, job.ID)
Expand Down Expand Up @@ -184,6 +185,10 @@ func doProjectLoop(cmd *cobra.Command, client *codersdk.Client, organization cod
}

if job.Status != coderd.ProvisionerJobStatusSucceeded {
for _, log := range logBuffer {
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "%s %s\n", color.HiGreenString("[tf]"), log.Output)
}

return nil, xerrors.New(job.Error)
}

Expand Down