-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
feat(gitpod-cli): add tasks cmd #8890
Conversation
Token string | ||
} | ||
|
||
func AttachToTerminal(ctx context.Context, client api.TerminalServiceClient, alias string, opts AttachToTerminalOpts) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the same as
func attachToTerminal(ctx context.Context, client api.TerminalServiceClient, alias string, opts attachToTerminalOpts) { |
We agreed with @akosyakov to duplicate the logic instead of trying to share it between the two CLIs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, this function comes with a problem - if a terminal attaches to itself, it will go into a loop. In tasks cmd, we try avoiding going into that situation but it's not easy to detect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe, in the context of the running terminal, there could be an environment variable indicating it's a Task Terminal, so the attach command could check this env variable, and if detected someone trying run gp tasks attach
on it, it would just print a message saying, for example: "It's not possible to attach to a task terminal from another task terminal. Please start a new terminal and run 'gp tasks attach' from there."
/werft run 👍 started the job as gitpod-build-af-feat-gp-cli-tasks-cmd.3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've checked and tested it, and it looks great!
I think this could even be used in #8338
Description
Adds a command with 2 sub-commands to gitpod-cli.
Related Issue(s)
Fixes #7016
How to test
go get
go build
./gitpod-cli tasks list
./gitpod-cli tasks attach
(See the prompt)./gitpod-cli tasks attach <terminalId>
Release Notes
Documentation
https://github.com/gitpod-io/website/issues/1791