Skip to content

fix(gitpod-cli): ports list safe access to exposed url #14040

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 1 commit into from
Oct 21, 2022

Conversation

andreafalzetti
Copy link
Contributor

@andreafalzetti andreafalzetti commented Oct 20, 2022

Description

This PR fix safe access to port.Exposed.* for both Url and Visibility.

Also, I've refactored the existing logic to determine the status, to be more readable and to follow the vscode implementation

 gp ports list
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x97c5ae]

goroutine 1 [running]:
github.com/gitpod-io/gitpod/gitpod-cli/cmd.glob..func12(0xfb5fe0, {0xac9654, 0x0, 0x0})
        github.com/gitpod-io/gitpod/gitpod-cli/cmd/ports-list.go:86 +0x3ae
github.com/spf13/cobra.(*Command).execute(0xfb5fe0, {0xff6aa8, 0x0, 0x0})
        github.com/spf13/[email protected]/command.go:856 +0x663
github.com/spf13/cobra.(*Command).ExecuteC(0xfb5ae0)
        github.com/spf13/[email protected]/command.go:960 +0x39d
github.com/spf13/cobra.(*Command).Execute(...)
        github.com/spf13/[email protected]/command.go:897
github.com/gitpod-io/gitpod/gitpod-cli/cmd.Execute()
        github.com/gitpod-io/gitpod/gitpod-cli/cmd/root.go:35 +0x325
main.main()
        github.com/gitpod-io/gitpod/gitpod-cli/main.go:12 +0x17

Related Issue(s)

Fixes #11990

How to test

  1. Start a workspace with https://afalz-fix-5d5a7c82e6.preview.gitpod-dev.com/#https://github.com/gitpod-io/empty
  2. Run gp ports list and observe nothing is resulted (actually port 3000 is already displayed as non-served by default for some reason)
  3. Run curl lama.sh | sh -s — —port 3001
  4. Run gp ports list and observe port 3001 being open (private)
  5. Run gp ports visibility 3001:public, then run gp ports list and observe port 3001 being open (public)

Release Notes

Bugfix: avoid failure on `ports list` when port is not exposed

Documentation

Werft options:

  • /werft with-local-preview
    If enabled this will build install/preview
  • /werft with-preview
  • /werft with-integration-tests=all
    Valid options are all, workspace, webapp, ide

@andreafalzetti andreafalzetti marked this pull request as ready for review October 20, 2022 17:40
@andreafalzetti andreafalzetti requested a review from a team October 20, 2022 17:40
@andreafalzetti andreafalzetti force-pushed the afalz/fix-gp-ports-exposed-4 branch 2 times, most recently from 22c028a to 6a03a88 Compare October 20, 2022 18:57
@felladrin
Copy link
Contributor

felladrin commented Oct 21, 2022

ℹ️ I'm reviewing it now!

Copy link
Contributor

@felladrin felladrin left a comment

Choose a reason for hiding this comment

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

Working as described! ✅

image

@andreafalzetti andreafalzetti force-pushed the afalz/fix-gp-ports-exposed-4 branch from 6a03a88 to 967149e Compare October 21, 2022 19:04
@roboquat roboquat merged commit 7c5dc44 into main Oct 21, 2022
@roboquat roboquat deleted the afalz/fix-gp-ports-exposed-4 branch October 21, 2022 19:31
@roboquat roboquat added deployed: IDE IDE change is running in production deployed Change is completely running in production labels Oct 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: gp cli deployed: IDE IDE change is running in production deployed Change is completely running in production release-note size/M team: IDE
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Segmentation fault when running "gp ports list" in a task command
4 participants