Skip to content
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

feat: add new /api/kg/webhooks path #639

Merged
merged 1 commit into from
May 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cmd/revproxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ func setupServer(config revProxyConfig) *echo.Echo {
// Routing for Renku services
e.Group("/api/auth", logger, authSvcProxy)
e.Group("/api/notebooks", logger, notebooksAuth, noCookies, stripPrefix("/api"), notebooksProxy)
// /api/projects/:projectID/graph will is being deprecated in favour of /api/kg/webhooks, the old endpoint will remain for some time for backward compatibility
e.Group("/api/projects/:projectID/graph", logger, gitlabAuth, noCookies, kgProjectsGraphRewrites, webhookProxy)
e.Group("/api/kg/webhooks", logger, gitlabAuth, noCookies, stripPrefix("/api/kg/webhooks"), webhookProxy)
e.Group("/api/datasets", logger, noCookies, regexRewrite("^/api(.*)", "/knowledge-graph$1"), kgProxy)
e.Group("/api/kg", logger, gitlabAuth, noCookies, regexRewrite("^/api/kg(.*)", "/knowledge-graph$1"), kgProxy)
e.Group("/api/renku", logger, renkuAuth, noCookies, stripPrefix("/api"), coreProxy)
Expand Down
18 changes: 18 additions & 0 deletions cmd/revproxy/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,24 @@ func TestInternalSvcRoutes(t *testing.T) {
ExternalGitlab: false,
Expected: TestResults{Path: "/gitlab/api/v4/projects/some.username%2Ftest-project", VisitedServerIDs: []string{"auth", "upstream"}},
},
{
Path: "/api/kg/webhooks/projects/123456/events/status/something/else",
Expected: TestResults{Path: "/projects/123456/events/status/something/else", VisitedServerIDs: []string{"auth", "upstream"}},
},
{
Path: "/api/kg/webhooks/projects/123456/events/status",
QueryParams: map[string]string{"test1": "value1", "test2": "value2"},
Expected: TestResults{Path: "/projects/123456/events/status", VisitedServerIDs: []string{"auth", "upstream"}},
},
{
Path: "/api/kg/webhooks/projects/123456/webhooks/something/else",
Expected: TestResults{Path: "/projects/123456/webhooks/something/else", VisitedServerIDs: []string{"auth", "upstream"}},
},
{
Path: "/api/kg/webhooks/projects/123456/webhooks",
QueryParams: map[string]string{"test1": "value1", "test2": "value2"},
Expected: TestResults{Path: "/projects/123456/webhooks", VisitedServerIDs: []string{"auth", "upstream"}},
},
}
for _, testCase := range testCases {
// Test names show up poorly in vscode if the name contains "/"
Expand Down