mirror of
https://github.com/coder/coder.git
synced 2025-07-12 00:14:10 +00:00
fix(agent/agentcontainers): improve testing of convertDockerInspect, return correct host port (#16887)
* Improves separation of concerns between `runDockerInspect` and `convertDockerInspect`: `runDockerInspect` now just runs the command and returns the output, while `convertDockerInspect` now does all of the conversion and parsing logic. * Improves testing of `convertDockerInspect` using real test fixtures. * Fixes issue where the container port is returned instead of the host port. * Updates UI to link to correct host port. Container port is still displayed in the button text, but the HostIP:HostPort is shown in a popover. * Adds stories for workspace agent UI
This commit is contained in:
@ -410,7 +410,7 @@ type WorkspaceAgentDevcontainer struct {
|
||||
// Running is true if the container is currently running.
|
||||
Running bool `json:"running"`
|
||||
// Ports includes ports exposed by the container.
|
||||
Ports []WorkspaceAgentListeningPort `json:"ports"`
|
||||
Ports []WorkspaceAgentDevcontainerPort `json:"ports"`
|
||||
// Status is the current status of the container. This is somewhat
|
||||
// implementation-dependent, but should generally be a human-readable
|
||||
// string.
|
||||
@ -420,6 +420,19 @@ type WorkspaceAgentDevcontainer struct {
|
||||
Volumes map[string]string `json:"volumes"`
|
||||
}
|
||||
|
||||
// WorkspaceAgentDevcontainerPort describes a port as exposed by a container.
|
||||
type WorkspaceAgentDevcontainerPort struct {
|
||||
// Port is the port number *inside* the container.
|
||||
Port uint16 `json:"port"`
|
||||
// Network is the network protocol used by the port (tcp, udp, etc).
|
||||
Network string `json:"network"`
|
||||
// HostIP is the IP address of the host interface to which the port is
|
||||
// bound. Note that this can be an IPv4 or IPv6 address.
|
||||
HostIP string `json:"host_ip,omitempty"`
|
||||
// HostPort is the port number *outside* the container.
|
||||
HostPort uint16 `json:"host_port,omitempty"`
|
||||
}
|
||||
|
||||
// WorkspaceAgentListContainersResponse is the response to the list containers
|
||||
// request.
|
||||
type WorkspaceAgentListContainersResponse struct {
|
||||
|
Reference in New Issue
Block a user