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

Skip to content

Commit 4d26778

Browse files
committed
fix(cli/ssh): Fetch up-to-date build info to avoid ws has no agents
Fixes #5836
1 parent ba02dc8 commit 4d26778

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

cli/ssh.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,11 @@ func getWorkspaceAndAgent(ctx context.Context, inv *clibase.Invocation, client *
362362
if err != nil {
363363
return codersdk.Workspace{}, codersdk.WorkspaceAgent{}, err
364364
}
365+
// Fetch up-to-date build information after completion.
366+
workspace.LatestBuild, err = client.WorkspaceBuild(ctx, workspace.LatestBuild.ID)
367+
if err != nil {
368+
return codersdk.Workspace{}, codersdk.WorkspaceAgent{}, err
369+
}
365370
}
366371
if workspace.LatestBuild.Transition == codersdk.WorkspaceTransitionDelete {
367372
return codersdk.Workspace{}, codersdk.WorkspaceAgent{}, xerrors.Errorf("workspace %q is being deleted", workspace.Name)

0 commit comments

Comments
 (0)