diff --git a/channel_test.go b/channel_test.go index 04dd427aa021e9d780dcb75fab4d28197cd655d5..e3c0600bc126b584c192bba196d42bdde345370d 100644 --- a/channel_test.go +++ b/channel_test.go @@ -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") diff --git a/internal/upstream/routes.go b/internal/upstream/routes.go index 765936714e120343ed4b62784dd082b4bd6a652a..453324d4d4d4aea7e778c2e3516cc450d541fc67 100644 --- a/internal/upstream/routes.go +++ b/internal/upstream/routes.go @@ -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),