-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Respond PortsStatus with sorted ports #13788
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
Changes from all commits
64c0798
137363e
54f0678
2569216
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1756,6 +1756,7 @@ type PortConfig struct { | |
Visibility string `json:"visibility,omitempty"` | ||
Description string `json:"description,omitempty"` | ||
Name string `json:"name,omitempty"` | ||
Sort uint32 `json:"sort,omitempty"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it something only for internal usage of supervisor? I don’t think we should have such property here then. These are types for gitpod config. cc @mustard-mh could you remove it to avoid confusion please |
||
} | ||
|
||
// TaskConfig is the TaskConfig message type | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ type RangeConfig struct { | |
*gitpod.PortsItems | ||
Start uint32 | ||
End uint32 | ||
Sort uint32 | ||
} | ||
|
||
// Configs provides access to port configurations. | ||
|
@@ -79,6 +80,7 @@ func (configs *Configs) Get(port uint32) (*gitpod.PortConfig, ConfigKind, bool) | |
Visibility: rangeConfig.Visibility, | ||
Description: rangeConfig.Description, | ||
Name: rangeConfig.Name, | ||
Sort: rangeConfig.Sort, | ||
}, RangeConfigKind, true | ||
} | ||
} | ||
|
@@ -184,7 +186,7 @@ func parseWorkspaceConfigs(ports []*gitpod.PortConfig) (portConfigs map[uint32]* | |
} | ||
|
||
func parseInstanceConfigs(ports []*gitpod.PortsItems) (portConfigs map[uint32]*gitpod.PortConfig, rangeConfigs []*RangeConfig) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we instead return an ordered list and avoid specifying the sort order as a property on a map of items? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I want to do it too (my first implement), but we have ranged ports (i.e. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this a concern around the number of bytes needed to store or some other size? I'd expect that the resulting size in bytes would be nearly identical, we're storing n items in both cases. The extra property of Index probably costs us more as its repeated on each item as opposed to have the sorting implicit which is what a list would do. Anyhow, just to wanted to flag this up as it felt odd. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. # user can define ranged port like this, and ignore if this num of port is validate or not
ports:
- port: 100001
- port: 1-100000 With But if we use a new variable like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could store it as
Which would give us the same result. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It's this case There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's leave it open, and make it a follow-up PR if we are going to change it. |
||
for _, config := range ports { | ||
for index, config := range ports { | ||
if config == nil { | ||
continue | ||
} | ||
|
@@ -204,6 +206,7 @@ func parseInstanceConfigs(ports []*gitpod.PortsItems) (portConfigs map[uint32]*g | |
Visibility: config.Visibility, | ||
Description: config.Description, | ||
Name: config.Name, | ||
Sort: uint32(index), | ||
} | ||
} | ||
continue | ||
|
@@ -224,6 +227,7 @@ func parseInstanceConfigs(ports []*gitpod.PortsItems) (portConfigs map[uint32]*g | |
PortsItems: config, | ||
Start: uint32(start), | ||
End: uint32(end), | ||
Sort: uint32(index), | ||
}) | ||
} | ||
return portConfigs, rangeConfigs | ||
|
Uh oh!
There was an error while loading. Please reload this page.