Skip to content
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

[supervisor] improve ssh connected behaviors #10736

Merged
merged 3 commits into from
Jun 21, 2022
Merged

[supervisor] improve ssh connected behaviors #10736

merged 3 commits into from
Jun 21, 2022

Conversation

mustard-mh
Copy link
Contributor

@mustard-mh mustard-mh commented Jun 17, 2022

Description

When we connect to a workspace via SSH, the default folder is ~, this PR change the default directory to $GITPOD_REPO_ROOT, so that user can reach their code folder after conn succeed

After ssh connected, it'll print environment vars in terminal, this PR will remove the log behavior.

After ssh connected, we will print a graceful welcome message for users to tell them useful commands

image

Related Issue(s)

Fixes #9377

How to test

See if print message as expected after ssh connected

Test if it works

  • Start a workspace
  • Connect via SSH copy-paste to see if default folder is correct

Test if not change original behavior

  • After tests above
  • Open a terminal in browser vscode
  • cd into any folder
  • Click Split button (or command+\ on MacOS)
  • See if the new split terminal goes with same pwd with previous terminal

Release Notes

Change the default directory of ssh connections
Remove env print after connect via ssh
Add graceful welcome message for users after ssh connected

Documentation

Werft options:

  • /werft with-preview

@mustard-mh mustard-mh changed the title [supervisor] change default directory of ssh [supervisor] improve ssh connected behaviors Jun 17, 2022
@roboquat roboquat added size/M and removed size/S labels Jun 17, 2022
@mustard-mh mustard-mh force-pushed the hw/ssh-dir branch 2 times, most recently from 66ccb42 to 2b3f40f Compare June 17, 2022 18:32
msg := []byte(`


Welcome to Gitpod - Always ready to code. You use commands below to be more productive.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Any suggestions for this message 🙏? @loujaybee

}

func configureSSHMessageOfTheDay() {
msg := []byte(`Welcome to Gitpod - Always ready to code. You can use commands below to be more productive.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can't find a proper char to scroll terminal content to next page without clear history, (tried chars in this page on my computer)

@akosyakov akosyakov requested a review from iQQBot June 20, 2022 05:59
}

func configureSSHMessageOfTheDay() {
msg := []byte(`Welcome to Gitpod - Always ready to code. You can use commands below to be more productive.
Copy link
Member

Choose a reason for hiding this comment

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

@loujaybee Please review text. 🙏

@iQQBot
Copy link
Contributor

iQQBot commented Jun 20, 2022

look into now

@mustard-mh mustard-mh force-pushed the hw/ssh-dir branch 2 times, most recently from 9fbb0d1 to 16ee2b4 Compare June 20, 2022 07:25
log.Error("cannot configure ssh default dir with empty repo root")
return
}
file, err := os.OpenFile("/home/gitpod/.bashrc", os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0o644)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

~/.ssh/rc with -oPermitUserRC not works, don't know why, so we choose .bashrc to do it

}

func configureSSHMessageOfTheDay() {
msg := []byte(`Welcome to Gitpod - Always ready to code. You can use commands below to be more productive.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
msg := []byte(`Welcome to Gitpod - Always ready to code. You can use commands below to be more productive.
msg := []byte(`Welcome to Gitpod: Always ready to code. Try the following commands to get started:

msg := []byte(`Welcome to Gitpod - Always ready to code. You can use commands below to be more productive.

gp tasks list List all your defined tasks in .gitpod.yml
gp tasks attach Attach to a workspace task
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
gp tasks attach Attach to a workspace task
gp tasks attach Attach your terminal to a workspace task

@loujaybee
Copy link
Member

loujaybee commented Jun 20, 2022

Thanks for fixing this one @mustard-mh ! :) This should help a few of our Vim users out 😝

Copy link
Contributor

@iQQBot iQQBot left a comment

Choose a reason for hiding this comment

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

code LGTM, This is indeed an obvious change for the user, who won't see a bunch of weird env output anymore

/hold
in case you want to change welcome text

@iQQBot
Copy link
Contributor

iQQBot commented Jun 21, 2022

/werft run

👍 started the job as gitpod-build-hw-ssh-dir.9
(with .werft/ from main)

@werft-gitpod-dev-com
Copy link

started the job as gitpod-build-hw-ssh-dir.10 because the annotations in the pull request description changed
(with .werft/ from main)

@iQQBot
Copy link
Contributor

iQQBot commented Jun 21, 2022

feel free to unhold

@mustard-mh
Copy link
Contributor Author

/unhold

@roboquat roboquat merged commit 47a0941 into main Jun 21, 2022
@roboquat roboquat deleted the hw/ssh-dir branch June 21, 2022 10:37
@roboquat roboquat added deployed: IDE IDE change is running in production deployed Change is completely running in production labels Jun 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployed: IDE IDE change is running in production deployed Change is completely running in production release-note size/M team: IDE
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Change default directory when SSH to workspace
5 participants