Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: restart stopped workspaces on ssh command#11050

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Emyrk merged 10 commits intomainfromstevenmasley/ssh_autostart
Dec 8, 2023

Conversation

Emyrk
Copy link
Member

@EmyrkEmyrk commentedDec 5, 2023
edited
Loading

What this does

Oncoder ssh orssh if the target workspace is off, the workspace will be started.

ssh coder.local-docker                                                                                                                           02:08:08 PMWorkspace was stopped, starting workspace to allow connection "local-docker"...==> ⧗ Queued=== ✔ Queued [0ms]==> ⧗ Running=== ✔ Running [4ms]==> ⧗ Setting up=== ✔ Setting up [29ms]==> ⧗ Planning infrastructure... rest of logs ...

Feature can beopt out, so by default this is on. To opt out:

$ coder ssh --disable-autostart local-docker# Or$ coder config-ssh --disable-autostart

Closes:#4973

VScode extension?

Vscode usescoder vscodessh and is unaffected:

func (r*RootCmd)vscodeSSH()*clibase.Cmd {

denbeigh2000 reacted with hooray emoji
This is opt out by default. VScode ssh does not have this behavior
@EmyrkEmyrk changed the titlefeat: autostart stopped workspaces on sshfeat: start stopped workspaces on sshDec 6, 2023
@EmyrkEmyrk requested a review frommafredriDecember 6, 2023 14:46
@EmyrkEmyrk changed the titlefeat: start stopped workspaces on sshfeat: restart stopped workspaces on ssh commandDec 6, 2023
Copy link
Member

@mafredrimafredri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Nice clean addition!

}
// The workspace needs to be stopped before we can start it.
// It cannot be in any pending or failed state.
if workspace.LatestBuild.Status != codersdk.WorkspaceStatusStopped {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

A case that I would personally like for to work is that I can ssh into a stopping workspace and have it wait until the stop is complete and then either issue the start or wait for a start to complete.

No action necessary for this PR, though. Just writing this down as a food for thought.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Things could be improved to handle more cases, but that felt a bit overkill atm.

err := inv.WithContext(ctx).Run()
assert.NoError(t, err)
})
pty.ExpectMatch("⧗ Running")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I wonder if this has the potential to be racy, i.e. workspace started before we end up streaming logs. 🤔

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

That is a good point. I am unsure how to prevent that 🤔.

We really should have a controllable provisioner in our unit tests to trigger this stuff 😢

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Actually, we havecoderdtest.AwaitWorkspaceAgents(t, client, workspace.ID) before I runexit which is sufficient to wait for the workspace to be ready.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Yeah, I think workspace being ready shouldn't be an issue. But I'm wondering if the provisioner log missing could be an issue depending on at what stage of the workspace lifecycle we connect to it.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Yup, I removed it because I check if the agent is ready right below it. So That agent ready will always work, even if we miss the logs.

mafredri reacted with thumbs up emoji
@EmyrkEmyrk requested a review frommafredriDecember 7, 2023 22:25
Copy link
Member

@mafredrimafredri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

:shipit:

denbeigh2000 reacted with hooray emoji
@EmyrkEmyrk merged commitcb89bc1 intomainDec 8, 2023
@EmyrkEmyrk deleted the stevenmasley/ssh_autostart branchDecember 8, 2023 16:01
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@mafredrimafredrimafredri approved these changes

Assignees

@EmyrkEmyrk

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Auto start workspace when I connect via SSH or visit an app
2 participants
@Emyrk@mafredri

[8]ページ先頭

©2009-2025 Movatter.jp