Skip to content

fix(cli): ssh: auto-update workspace #11773

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 5 commits into from
Jan 23, 2024
Merged
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
Fix: unit tests
  • Loading branch information
mtojek committed Jan 23, 2024
commit f68abe1fa072f7a165524c166ffe34c9fd52dd94
2 changes: 1 addition & 1 deletion cli/restart.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (r *RootCmd) restart() *clibase.Cmd {
// It's possible for a workspace build to fail due to the template requiring starting
// workspaces with the active version.
if cerr, ok := codersdk.AsError(err); ok && cerr.StatusCode() == http.StatusForbidden {
_, _ = fmt.Fprintln(inv.Stdout, "Failed to restart with the template version from your last build. Policy may require you to restart with the current active template version.")
_, _ = fmt.Fprintln(inv.Stdout, "Unable to restart the workspace with the template version from the last build. Policy may require you to restart with the current active template version.")
build, err = startWorkspace(inv, client, workspace, parameterFlags, WorkspaceUpdate)
if err != nil {
return xerrors.Errorf("start workspace with active template version: %w", err)
Expand Down
10 changes: 9 additions & 1 deletion enterprise/cli/start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,17 @@ func TestStart(t *testing.T) {

ws = coderdtest.MustWorkspace(t, c.Client, ws.ID)
require.Equal(t, c.ExpectedVersion, ws.LatestBuild.TemplateVersionID)
if initialTemplateVersion != ws.LatestBuild.TemplateVersionID {
if initialTemplateVersion == ws.LatestBuild.TemplateVersionID {
return
}

if cmd == "start" {
require.Contains(t, buf.String(), "Unable to start the workspace with the template version from the last build")
}

if cmd == "restart" {
require.Contains(t, buf.String(), "Unable to restart the workspace with the template version from the last build")
}
})
}
})
Expand Down