Skip to content

Workspace restart button/kira pilot #7070

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

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
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
moved restart fn into workspacebuilds.go
  • Loading branch information
Kira-Pilot committed Apr 10, 2023
commit a3cfc8557f9943000ba917dce17e6075d7320a96
5 changes: 5 additions & 0 deletions cli/restart.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,28 +34,33 @@ func (r *RootCmd) restart() *clibase.Cmd {
return err
}

// get the workspace - this can probably stay in here
workspace, err := namedWorkspace(inv.Context(), client, inv.Args[0])
if err != nil {
return err
}

// create a build - stop the workspace
build, err := client.CreateWorkspaceBuild(ctx, workspace.ID, codersdk.CreateWorkspaceBuildRequest{
Transition: codersdk.WorkspaceTransitionStop,
})
if err != nil {
return err
}
// this seems to return the provisioner job - perhaps we are watching for an error
err = cliui.WorkspaceBuild(ctx, out, client, build.ID)
if err != nil {
return err
}

// create a build - start the workspace
build, err = client.CreateWorkspaceBuild(ctx, workspace.ID, codersdk.CreateWorkspaceBuildRequest{
Transition: codersdk.WorkspaceTransitionStart,
})
if err != nil {
return err
}
// this seems to return the provisioner job - perhaps we are watching for an error
err = cliui.WorkspaceBuild(ctx, out, client, build.ID)
if err != nil {
return err
Expand Down
Loading