Commit 8b613a84 authored by Nick Thomas's avatar Nick Thomas

Merge branch 'fj-proxy-webide-services' into 'master'

Add new endpoint to add support to proxy websocket requests to build's services

Closes #205 and gitlab-ee#5276

See merge request gitlab-org/gitlab-workhorse!370
parents be9f0805 294a36a8
......@@ -20,8 +20,9 @@ import (
)
var (
envTerminalPath = fmt.Sprintf("%s/environments/1/terminal.ws", testProject)
jobTerminalPath = fmt.Sprintf("%s/-/jobs/1/terminal.ws", testProject)
envTerminalPath = fmt.Sprintf("%s/environments/1/terminal.ws", testProject)
jobTerminalPath = fmt.Sprintf("%s/-/jobs/1/terminal.ws", testProject)
servicesProxyWSPath = fmt.Sprintf("%s/-/jobs/1/proxy.ws", testProject)
)
type connWithReq struct {
......@@ -36,6 +37,7 @@ func TestChannelHappyPath(t *testing.T) {
}{
{"environments", envTerminalPath},
{"jobs", jobTerminalPath},
{"services", servicesProxyWSPath},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
......@@ -74,15 +76,16 @@ func TestChannelHappyPath(t *testing.T) {
func TestChannelHappyPathWithTerminalResponse(t *testing.T) {
tests := []struct {
name string
terminalPath string
name string
channelPath string
}{
{"environments", envTerminalPath},
{"jobs", jobTerminalPath},
{"services", servicesProxyWSPath},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
serverConns, clientURL, close := wireupTerminal(test.terminalPath, nil, "channel.k8s.io")
serverConns, clientURL, close := wireupTerminal(test.channelPath, nil, "channel.k8s.io")
defer close()
client, _, err := dialWebsocket(clientURL, nil, "terminal.gitlab.com")
......
......@@ -190,6 +190,9 @@ func (u *upstream) configureRoutes() {
wsRoute(projectPattern+`environments/[0-9]+/terminal.ws\z`, channel.Handler(api)),
wsRoute(projectPattern+`-/jobs/[0-9]+/terminal.ws\z`, channel.Handler(api)),
// Proxy Job Services
wsRoute(projectPattern+`-/jobs/[0-9]+/proxy.ws\z`, channel.Handler(api)),
// Long poll and limit capacity given to jobs/request and builds/register.json
route("", apiPattern+`v4/jobs/request\z`, ciAPILongPolling),
route("", ciAPIPattern+`v1/builds/register.json\z`, ciAPILongPolling),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment