Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix: should use request context (#1131)
Cluasa883a5841d91
diff --git a/server/acl.go b/server/acl.goindex 186c7bdb8c..488e270552 100644--- a/server/acl.go+++ b/server/acl.go@@ -25,7 +25,7 @@ func getRoleContextKey() string {func aclMiddleware(l *zap.Logger, s *Server, ce *casbin.Enforcer, next echo.HandlerFunc, readonly bool) echo.HandlerFunc {return func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()// Skips auth, actuator, planif common.HasPrefixes(c.Path(), "/api/auth", "/api/actuator", "/api/plan", "/api/oauth") {return next(c)diff --git a/server/activity.go b/server/activity.goindex b7f6976d2e..8d1020545e 100644--- a/server/activity.go+++ b/server/activity.go@@ -1,7 +1,6 @@package serverimport (- "context""encoding/json""fmt""net/http"@@ -15,7 +14,7 @@ import (func (s *Server) registerActivityRoutes(g *echo.Group) {g.POST("/activity", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()activityCreate := &api.ActivityCreate{}if err := jsonapi.UnmarshalPayload(c.Request().Body, activityCreate); err != nil {return echo.NewHTTPError(http.StatusBadRequest, "Malformatted create activity request").SetInternal(err)@@ -65,7 +64,7 @@ func (s *Server) registerActivityRoutes(g *echo.Group) {})g.GET("/activity", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()activityFind := &api.ActivityFind{}if creatorIDStr := c.QueryParams().Get("user"); creatorIDStr != "" {creatorID, err := strconv.Atoi(creatorIDStr)@@ -108,7 +107,7 @@ func (s *Server) registerActivityRoutes(g *echo.Group) {})g.PATCH("/activity/:activityID", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()id, err := strconv.Atoi(c.Param("activityID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("activityID"))).SetInternal(err)@@ -138,7 +137,7 @@ func (s *Server) registerActivityRoutes(g *echo.Group) {})g.DELETE("/activity/:activityID", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()id, err := strconv.Atoi(c.Param("activityID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("activityID"))).SetInternal(err)diff --git a/server/actuator.go b/server/actuator.goindex 03c80984fc..e6e4c62e75 100644--- a/server/actuator.go+++ b/server/actuator.go@@ -1,7 +1,6 @@package serverimport (- "context""net/http""strconv"@@ -11,7 +10,7 @@ import (func (s *Server) registerActuatorRoutes(g *echo.Group) {g.GET("/actuator/info", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()serverInfo := api.ServerInfo{Version: s.version,Readonly: s.readonly,diff --git a/server/auth.go b/server/auth.goindex 8fb10d6535..a1fd4e620d 100644--- a/server/auth.go+++ b/server/auth.go@@ -18,7 +18,7 @@ func (s *Server) registerAuthRoutes(g *echo.Group) {// for now, we only support Gitlabg.GET("/auth/provider", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()vcsFind := &api.VCSFind{}vcsList, err := s.store.FindVCS(ctx, vcsFind)if err != nil {@@ -46,7 +46,7 @@ func (s *Server) registerAuthRoutes(g *echo.Group) {})g.POST("/auth/login/:auth_provider", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()var user *api.PrincipalauthProvider := api.PrincipalAuthProvider(c.Param("auth_provider"))@@ -189,7 +189,7 @@ func (s *Server) registerAuthRoutes(g *echo.Group) {})g.POST("/auth/signup", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()signUp := &api.SignUp{}if err := jsonapi.UnmarshalPayload(c.Request().Body, signUp); err != nil {return echo.NewHTTPError(http.StatusBadRequest, "Malformatted sign up request").SetInternal(err)diff --git a/server/bookmark.go b/server/bookmark.goindex ba0e8cf24c..9a6868c794 100644--- a/server/bookmark.go+++ b/server/bookmark.go@@ -1,7 +1,6 @@package serverimport (- "context""fmt""net/http""strconv"@@ -14,7 +13,7 @@ import (func (s *Server) registerBookmarkRoutes(g *echo.Group) {g.POST("/bookmark", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()bookmarkCreate := &api.BookmarkCreate{}if err := jsonapi.UnmarshalPayload(c.Request().Body, bookmarkCreate); err != nil {return echo.NewHTTPError(http.StatusBadRequest, "Malformatted create bookmark request").SetInternal(err)@@ -38,7 +37,7 @@ func (s *Server) registerBookmarkRoutes(g *echo.Group) {})g.GET("/bookmark/user/:userID", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()userID, err := strconv.Atoi(c.Param("userID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("User ID is not a number: %s", c.Param("userID"))).SetInternal(err)@@ -60,7 +59,7 @@ func (s *Server) registerBookmarkRoutes(g *echo.Group) {})g.DELETE("/bookmark/:bookmarkID", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()id, err := strconv.Atoi(c.Param("bookmarkID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("bookmarkID"))).SetInternal(err)diff --git a/server/database.go b/server/database.goindex 4e8dc2c389..4e8b404730 100644--- a/server/database.go+++ b/server/database.go@@ -18,7 +18,7 @@ import (func (s *Server) registerDatabaseRoutes(g *echo.Group) {g.POST("/database", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()databaseCreate := &api.DatabaseCreate{}if err := jsonapi.UnmarshalPayload(c.Request().Body, databaseCreate); err != nil {return echo.NewHTTPError(http.StatusBadRequest, "Malformatted create database request").SetInternal(err)@@ -81,7 +81,7 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {})g.GET("/database", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()databaseFind := new(api.DatabaseFind)if instanceIDStr := c.QueryParam("instance"); instanceIDStr != "" {instanceID, err := strconv.Atoi(instanceIDStr)@@ -137,7 +137,7 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {})g.GET("/database/:id", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()id, err := strconv.Atoi(c.Param("id"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("id"))).SetInternal(err)@@ -167,7 +167,7 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {})g.PATCH("/database/:id", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()id, err := strconv.Atoi(c.Param("id"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Database ID is not a number: %s", c.Param("id"))).SetInternal(err)@@ -359,7 +359,7 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {})g.GET("/database/:id/table", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()id, err := strconv.Atoi(c.Param("id"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("id"))).SetInternal(err)@@ -423,7 +423,7 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {})g.GET("/database/:id/table/:tableName", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()id, err := strconv.Atoi(c.Param("id"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("id"))).SetInternal(err)@@ -487,7 +487,7 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {})g.GET("/database/:id/view", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()id, err := strconv.Atoi(c.Param("id"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("id"))).SetInternal(err)@@ -532,7 +532,7 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {})g.POST("/database/:id/backup", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()id, err := strconv.Atoi(c.Param("id"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("id"))).SetInternal(err)@@ -629,7 +629,7 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {})g.GET("/database/:id/backup", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()id, err := strconv.Atoi(c.Param("id"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("id"))).SetInternal(err)@@ -662,7 +662,7 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {})g.PATCH("/database/:id/backup-setting", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()id, err := strconv.Atoi(c.Param("id"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("id"))).SetInternal(err)@@ -699,7 +699,7 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {})g.GET("/database/:id/backup-setting", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()id, err := strconv.Atoi(c.Param("id"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("id"))).SetInternal(err)@@ -735,7 +735,7 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {})g.GET("/database/:id/data-source/:dataSourceID", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()databaseID, err := strconv.Atoi(c.Param("id"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Database ID is not a number: %s", c.Param("id"))).SetInternal(err)@@ -779,7 +779,7 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {})g.POST("/database/:id/data-source", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()databaseID, err := strconv.Atoi(c.Param("id"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("id"))).SetInternal(err)@@ -817,7 +817,7 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {})g.PATCH("/database/:id/data-source/:dataSourceID", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()databaseID, err := strconv.Atoi(c.Param("id"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("id"))).SetInternal(err)diff --git a/server/environment.go b/server/environment.goindex 2c69112334..630ca3fd36 100644--- a/server/environment.go+++ b/server/environment.go@@ -1,7 +1,6 @@package serverimport (- "context""errors""fmt""net/http"@@ -16,7 +15,7 @@ import (func (s *Server) registerEnvironmentRoutes(g *echo.Group) {g.POST("/environment", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()envCreate := &api.EnvironmentCreate{}if err := jsonapi.UnmarshalPayload(c.Request().Body, envCreate); err != nil {return echo.NewHTTPError(http.StatusBadRequest, "Malformatted create environment request").SetInternal(err)@@ -40,7 +39,7 @@ func (s *Server) registerEnvironmentRoutes(g *echo.Group) {})g.GET("/environment", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()envFind := &api.EnvironmentFind{}if rowStatusStr := c.QueryParam("rowstatus"); rowStatusStr != "" {rowStatus := api.RowStatus(rowStatusStr)@@ -59,7 +58,7 @@ func (s *Server) registerEnvironmentRoutes(g *echo.Group) {})g.PATCH("/environment/:id", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()id, err := strconv.Atoi(c.Param("id"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Environment ID is not a number: %s", c.Param("id"))).SetInternal(err)@@ -89,7 +88,7 @@ func (s *Server) registerEnvironmentRoutes(g *echo.Group) {})g.PATCH("/environment/reorder", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()patchList, err := jsonapi.UnmarshalManyPayload(c.Request().Body, reflect.TypeOf(new(api.EnvironmentPatch)))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, "Malformatted environment reorder request").SetInternal(err)diff --git a/server/inbox.go b/server/inbox.goindex 05bb65e46c..bbe37d0082 100644--- a/server/inbox.go+++ b/server/inbox.go@@ -1,7 +1,6 @@package serverimport (- "context""fmt""net/http""strconv"@@ -14,7 +13,7 @@ import (func (s *Server) registerInboxRoutes(g *echo.Group) {g.GET("/inbox/user/:userID", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()userID, err := strconv.Atoi(c.Param("userID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("User ID is not a number: %s", c.Param("userID"))).SetInternal(err)@@ -45,7 +44,7 @@ func (s *Server) registerInboxRoutes(g *echo.Group) {})g.GET("/inbox/user/:userID/summary", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()userID, err := strconv.Atoi(c.Param("userID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("User ID is not a number: %s", c.Param("userID"))).SetInternal(err)@@ -60,7 +59,7 @@ func (s *Server) registerInboxRoutes(g *echo.Group) {})g.PATCH("/inbox/:inboxID", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()id, err := strconv.Atoi(c.Param("inboxID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("inboxID"))).SetInternal(err)diff --git a/server/instance.go b/server/instance.goindex dd48c2cf2c..6e4a40f149 100644--- a/server/instance.go+++ b/server/instance.go@@ -17,7 +17,7 @@ import (func (s *Server) registerInstanceRoutes(g *echo.Group) {// Besides adding the instance to Bytebase, it will also try to create a "bytebase" db in the newly added instance.g.POST("/instance", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()if err := s.instanceCountGuard(ctx); err != nil {return err}@@ -63,7 +63,7 @@ func (s *Server) registerInstanceRoutes(g *echo.Group) {})g.GET("/instance", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()instanceFind := &api.InstanceFind{}if rowStatusStr := c.QueryParam("rowstatus"); rowStatusStr != "" {rowStatus := api.RowStatus(rowStatusStr)@@ -82,7 +82,7 @@ func (s *Server) registerInstanceRoutes(g *echo.Group) {})g.GET("/instance/:instanceID", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()id, err := strconv.Atoi(c.Param("instanceID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("instanceID"))).SetInternal(err)@@ -104,7 +104,7 @@ func (s *Server) registerInstanceRoutes(g *echo.Group) {})g.PATCH("/instance/:instanceID", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()id, err := strconv.Atoi(c.Param("instanceID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("instanceID"))).SetInternal(err)@@ -176,7 +176,7 @@ func (s *Server) registerInstanceRoutes(g *echo.Group) {})g.GET("/instance/:instanceID/user", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()id, err := strconv.Atoi(c.Param("instanceID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("instanceID"))).SetInternal(err)@@ -198,7 +198,7 @@ func (s *Server) registerInstanceRoutes(g *echo.Group) {})g.POST("/instance/:instanceID/migration", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()id, err := strconv.Atoi(c.Param("instanceID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("instanceID"))).SetInternal(err)@@ -231,7 +231,7 @@ func (s *Server) registerInstanceRoutes(g *echo.Group) {})g.GET("/instance/:instanceID/migration/status", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()id, err := strconv.Atoi(c.Param("instanceID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("instanceID"))).SetInternal(err)@@ -271,7 +271,7 @@ func (s *Server) registerInstanceRoutes(g *echo.Group) {})g.GET("/instance/:instanceID/migration/history/:historyID", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()id, err := strconv.Atoi(c.Param("instanceID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Instance ID is not a number: %s", c.Param("instanceID"))).SetInternal(err)@@ -334,7 +334,7 @@ func (s *Server) registerInstanceRoutes(g *echo.Group) {})g.GET("/instance/:instanceID/migration/history", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()id, err := strconv.Atoi(c.Param("instanceID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("instanceID"))).SetInternal(err)diff --git a/server/issue.go b/server/issue.goindex 33ba2369a7..0a6e7602db 100644--- a/server/issue.go+++ b/server/issue.go@@ -20,7 +20,7 @@ import (func (s *Server) registerIssueRoutes(g *echo.Group) {g.POST("/issue", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()issueCreate := &api.IssueCreate{}if err := jsonapi.UnmarshalPayload(c.Request().Body, issueCreate); err != nil {return echo.NewHTTPError(http.StatusBadRequest, "Malformatted create issue request").SetInternal(err)@@ -39,7 +39,7 @@ func (s *Server) registerIssueRoutes(g *echo.Group) {})g.GET("/issue", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()issueFind := &api.IssueFind{}projectIDStr := c.QueryParams().Get("project")if projectIDStr != "" {@@ -93,7 +93,7 @@ func (s *Server) registerIssueRoutes(g *echo.Group) {})g.GET("/issue/:issueID", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()id, err := strconv.Atoi(c.Param("issueID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("issueID"))).SetInternal(err)@@ -115,7 +115,7 @@ func (s *Server) registerIssueRoutes(g *echo.Group) {})g.PATCH("/issue/:issueID", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()id, err := strconv.Atoi(c.Param("issueID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("issueID"))).SetInternal(err)@@ -221,7 +221,7 @@ func (s *Server) registerIssueRoutes(g *echo.Group) {})g.PATCH("/issue/:issueID/status", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()id, err := strconv.Atoi(c.Param("issueID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("issueID"))).SetInternal(err)diff --git a/server/issue_subscriber.go b/server/issue_subscriber.goindex 2bac917d83..dc505ab7fa 100644--- a/server/issue_subscriber.go+++ b/server/issue_subscriber.go@@ -1,7 +1,6 @@package serverimport (- "context""fmt""net/http""strconv"@@ -14,7 +13,7 @@ import (func (s *Server) registerIssueSubscriberRoutes(g *echo.Group) {g.POST("/issue/:issueID/subscriber", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()issueID, err := strconv.Atoi(c.Param("issueID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("issueID"))).SetInternal(err)@@ -43,7 +42,7 @@ func (s *Server) registerIssueSubscriberRoutes(g *echo.Group) {})g.GET("/issue/:issueID/subscriber", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()issueID, err := strconv.Atoi(c.Param("issueID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("issueID"))).SetInternal(err)@@ -65,7 +64,7 @@ func (s *Server) registerIssueSubscriberRoutes(g *echo.Group) {})g.DELETE("/issue/:issueID/subscriber/:subscriberID", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()issueID, err := strconv.Atoi(c.Param("issueID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Issue ID is not a number: %s", c.Param("issueID"))).SetInternal(err)diff --git a/server/jwt.go b/server/jwt.goindex 51246c3878..d0ecf86168 100644--- a/server/jwt.go+++ b/server/jwt.go@@ -1,7 +1,6 @@package serverimport (- "context""errors""fmt""net/http"@@ -219,7 +218,7 @@ func JWTMiddleware(l *zap.Logger, principalStore *store.Store, next echo.Handler// We either have a valid access token or we will attempt to generate new access token and refresh tokenif err == nil {- ctx := context.Background()+ ctx := c.Request().Context()principalID, err := strconv.Atoi(claims.Subject)if err != nil {return echo.NewHTTPError(http.StatusUnauthorized, "Malformatted ID in the token.")diff --git a/server/label.go b/server/label.goindex df80ffe3f9..65ac2142ad 100644--- a/server/label.go+++ b/server/label.go@@ -1,7 +1,6 @@package serverimport (- "context""fmt""net/http""strconv"@@ -12,11 +11,9 @@ import ("github.com/labstack/echo/v4")-var ()-func (s *Server) registerLabelRoutes(g *echo.Group) {g.GET("/label", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()rowStatus := api.Normalfind := &api.LabelKeyFind{RowStatus: &rowStatus,@@ -50,7 +47,7 @@ func (s *Server) registerLabelRoutes(g *echo.Group) {})g.PATCH("/label/:id", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()id, err := strconv.Atoi(c.Param("id"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("id is not a number: %s", c.Param("id"))).SetInternal(err)diff --git a/server/member.go b/server/member.goindex d8dc937ced..e5a7b835e6 100644--- a/server/member.go+++ b/server/member.go@@ -1,7 +1,6 @@package serverimport (- "context""encoding/json""fmt""net/http"@@ -15,7 +14,7 @@ import (func (s *Server) registerMemberRoutes(g *echo.Group) {g.POST("/member", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()memberCreate := &api.MemberCreate{}if err := jsonapi.UnmarshalPayload(c.Request().Body, memberCreate); err != nil {return echo.NewHTTPError(http.StatusBadRequest, "Malformatted create member request").SetInternal(err)@@ -75,7 +74,7 @@ func (s *Server) registerMemberRoutes(g *echo.Group) {})g.GET("/member", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()memberFind := &api.MemberFind{}memberList, err := s.store.FindMember(ctx, memberFind)if err != nil {@@ -90,7 +89,7 @@ func (s *Server) registerMemberRoutes(g *echo.Group) {})g.PATCH("/member/:id", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()id, err := strconv.Atoi(c.Param("id"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("id"))).SetInternal(err)diff --git a/server/policy.go b/server/policy.goindex e14ad200e9..a79d787711 100644--- a/server/policy.go+++ b/server/policy.go@@ -1,7 +1,6 @@package serverimport (- "context""fmt""net/http""strconv"@@ -33,7 +32,7 @@ func (s *Server) hasAccessToUpsertPolicy(policyUpsert *api.PolicyUpsert) error {func (s *Server) registerPolicyRoutes(g *echo.Group) {g.PATCH("/policy/environment/:environmentID", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()environmentID, err := strconv.Atoi(c.Param("environmentID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("environmentID is not a number: %s", c.Param("id"))).SetInternal(err)@@ -69,7 +68,7 @@ func (s *Server) registerPolicyRoutes(g *echo.Group) {})g.GET("/policy/environment/:environmentID", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()environmentID, err := strconv.Atoi(c.Param("environmentID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("environmentID is not a number: %s", c.Param("id"))).SetInternal(err)diff --git a/server/principal.go b/server/principal.goindex 50e375cd06..b609b88b10 100644--- a/server/principal.go+++ b/server/principal.go@@ -1,7 +1,6 @@package serverimport (- "context""fmt""net/http""strconv"@@ -15,7 +14,7 @@ import (func (s *Server) registerPrincipalRoutes(g *echo.Group) {g.POST("/principal", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()principalCreate := &api.PrincipalCreate{}if err := jsonapi.UnmarshalPayload(c.Request().Body, principalCreate); err != nil {return echo.NewHTTPError(http.StatusBadRequest, "Malformatted create principal request").SetInternal(err)@@ -47,7 +46,7 @@ func (s *Server) registerPrincipalRoutes(g *echo.Group) {})g.GET("/principal", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()principalList, err := s.store.GetPrincipalList(ctx)if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, "Failed to fetch principal list").SetInternal(err)@@ -61,7 +60,7 @@ func (s *Server) registerPrincipalRoutes(g *echo.Group) {})g.GET("/principal/:principalID", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()id, err := strconv.Atoi(c.Param("principalID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("principalID"))).SetInternal(err)@@ -83,7 +82,7 @@ func (s *Server) registerPrincipalRoutes(g *echo.Group) {})g.PATCH("/principal/:principalID", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()id, err := strconv.Atoi(c.Param("principalID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("principalID"))).SetInternal(err)diff --git a/server/project.go b/server/project.goindex e50caaa61f..fe230cfff2 100644--- a/server/project.go+++ b/server/project.go@@ -20,7 +20,7 @@ import (func (s *Server) registerProjectRoutes(g *echo.Group) {g.POST("/project", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()projectCreate := &api.ProjectCreate{}if err := jsonapi.UnmarshalPayload(c.Request().Body, projectCreate); err != nil {return echo.NewHTTPError(http.StatusBadRequest, "Malformatted create project request").SetInternal(err)@@ -70,7 +70,7 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {})g.GET("/project", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()projectFind := &api.ProjectFind{}if userIDStr := c.QueryParam("user"); userIDStr != "" {userID, err := strconv.Atoi(userIDStr)@@ -123,7 +123,7 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {})g.GET("/project/:projectID", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()id, err := strconv.Atoi(c.Param("projectID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("projectID"))).SetInternal(err)@@ -145,7 +145,7 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {})g.PATCH("/project/:projectID", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()id, err := strconv.Atoi(c.Param("projectID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("projectID"))).SetInternal(err)@@ -181,7 +181,7 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {// When we link the repository with the project, we will also change the project workflow type to VCSg.POST("/project/:projectID/repository", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()projectID, err := strconv.Atoi(c.Param("projectID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("projectID"))).SetInternal(err)@@ -282,7 +282,7 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {// 1. repository also contains project, which would cause circular dependency when composing it.// 2. repository info is only needed when fetching a particular project by id, thus it's unnecessary to include it in the project list response.g.GET("/project/:projectID/repository", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()projectID, err := strconv.Atoi(c.Param("projectID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project ID is not a number: %s", c.Param("projectID"))).SetInternal(err)@@ -319,7 +319,7 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {// When we unlink the repository with the project, we will also change the project workflow type to UIg.PATCH("/project/:projectID/repository", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()projectID, err := strconv.Atoi(c.Param("projectID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project ID is not a number: %s", c.Param("projectID"))).SetInternal(err)@@ -437,7 +437,7 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {// When we unlink the repository with the project, we will also change the project workflow type to UIg.DELETE("/project/:projectID/repository", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()projectID, err := strconv.Atoi(c.Param("projectID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project ID is not a number: %s", c.Param("projectID"))).SetInternal(err)@@ -503,7 +503,7 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {})g.PATCH("/project/:id/deployment", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()id, err := strconv.Atoi(c.Param("id"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("id"))).SetInternal(err)@@ -539,7 +539,7 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {})g.GET("/project/:id/deployment", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()id, err := strconv.Atoi(c.Param("id"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("id"))).SetInternal(err)diff --git a/server/project_member.go b/server/project_member.goindex 0281084dd3..68433faf2e 100644--- a/server/project_member.go+++ b/server/project_member.go@@ -19,7 +19,7 @@ import (func (s *Server) registerProjectMemberRoutes(g *echo.Group) {// for now we only support sync project member from privately deployed GitLabg.POST("/project/:projectID/sync-member", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()projectID, err := strconv.Atoi(c.Param("projectID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project ID is not a number: %s", c.Param("projectID"))).SetInternal(err)@@ -240,7 +240,7 @@ func (s *Server) registerProjectMemberRoutes(g *echo.Group) {})g.POST("/project/:projectID/member", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()projectID, err := strconv.Atoi(c.Param("projectID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project ID is not a number: %s", c.Param("projectID"))).SetInternal(err)@@ -295,7 +295,7 @@ func (s *Server) registerProjectMemberRoutes(g *echo.Group) {})g.PATCH("/project/:projectID/member/:memberID", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()projectID, err := strconv.Atoi(c.Param("projectID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project ID is not a number: %s", c.Param("projectID"))).SetInternal(err)@@ -364,7 +364,7 @@ func (s *Server) registerProjectMemberRoutes(g *echo.Group) {})g.DELETE("/project/:projectID/member/:memberID", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()projectID, err := strconv.Atoi(c.Param("projectID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project ID is not a number: %s", c.Param("projectID"))).SetInternal(err)diff --git a/server/project_webhook.go b/server/project_webhook.goindex c6cab8a01c..dddd5b8a38 100644--- a/server/project_webhook.go+++ b/server/project_webhook.go@@ -16,7 +16,7 @@ import (func (s *Server) registerProjectWebhookRoutes(g *echo.Group) {g.GET("/project/:projectID/webhook", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()projectID, err := strconv.Atoi(c.Param("projectID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project ID is not a number: %s", c.Param("projectID"))).SetInternal(err)@@ -46,7 +46,7 @@ func (s *Server) registerProjectWebhookRoutes(g *echo.Group) {})g.POST("/project/:projectID/webhook", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()projectID, err := strconv.Atoi(c.Param("projectID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project ID is not a number: %s", c.Param("projectID"))).SetInternal(err)@@ -81,7 +81,7 @@ func (s *Server) registerProjectWebhookRoutes(g *echo.Group) {})g.GET("/project/:projectID/webhook/:webhookID", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()_, err := strconv.Atoi(c.Param("projectID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project ID is not a number: %s", c.Param("projectID"))).SetInternal(err)@@ -116,7 +116,7 @@ func (s *Server) registerProjectWebhookRoutes(g *echo.Group) {})g.PATCH("/project/:projectID/webhook/:webhookID", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()_, err := strconv.Atoi(c.Param("projectID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project ID is not a number: %s", c.Param("projectID"))).SetInternal(err)@@ -159,7 +159,7 @@ func (s *Server) registerProjectWebhookRoutes(g *echo.Group) {})g.DELETE("/project/:projectID/webhook/:webhookID", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()_, err := strconv.Atoi(c.Param("projectID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project ID is not a number: %s", c.Param("projectID"))).SetInternal(err)@@ -184,7 +184,7 @@ func (s *Server) registerProjectWebhookRoutes(g *echo.Group) {})g.GET("/project/:projectID/webhook/:webhookID/test", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()projectID, err := strconv.Atoi(c.Param("projectID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project ID is not a number: %s", c.Param("projectID"))).SetInternal(err)diff --git a/server/server_embed_release.go b/server/server_embed_release.goindex b49e77db47..312ef0582a 100644--- a/server/server_embed_release.go+++ b/server/server_embed_release.go@@ -5,10 +5,11 @@ package serverimport ("embed"- "github.com/labstack/echo/v4"- "go.uber.org/zap""io/fs""net/http"++ "github.com/labstack/echo/v4"+ "go.uber.org/zap")//go:embed distdiff --git a/server/setting.go b/server/setting.goindex 33fd11a499..614fec91e0 100644--- a/server/setting.go+++ b/server/setting.go@@ -20,7 +20,7 @@ var (func (s *Server) registerSettingRoutes(g *echo.Group) {g.GET("/setting", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()find := &api.SettingFind{}settingRawList, err := s.SettingService.FindSettingList(ctx, find)if err != nil {@@ -53,7 +53,7 @@ func (s *Server) registerSettingRoutes(g *echo.Group) {})g.PATCH("/setting/:name", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()settingPatch := &api.SettingPatch{Name: api.SettingName(c.Param("name")),UpdaterID: c.Get(getPrincipalIDContextKey()).(int),diff --git a/server/sheet.go b/server/sheet.goindex 0b01571829..6bd442ce8e 100644--- a/server/sheet.go+++ b/server/sheet.go@@ -20,7 +20,7 @@ import (func (s *Server) registerSheetRoutes(g *echo.Group) {g.POST("/sheet", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()sheetCreate := &api.SheetCreate{}if err := jsonapi.UnmarshalPayload(c.Request().Body, sheetCreate); err != nil {return echo.NewHTTPError(http.StatusBadRequest, "Malformatted create sheet request").SetInternal(err)@@ -74,7 +74,7 @@ func (s *Server) registerSheetRoutes(g *echo.Group) {})g.POST("/sheet/project/:projectID/sync", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()projectID, err := strconv.Atoi(c.Param("projectID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project ID is not a number: %s", c.Param("projectID"))).SetInternal(err)@@ -279,7 +279,7 @@ func (s *Server) registerSheetRoutes(g *echo.Group) {})g.GET("/sheet", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()sheetFind := &api.SheetFind{}if rowStatusStr := c.QueryParam("rowStatus"); rowStatusStr != "" {@@ -338,7 +338,7 @@ func (s *Server) registerSheetRoutes(g *echo.Group) {})g.GET("/sheet/:id", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()id, err := strconv.Atoi(c.Param("id"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("id"))).SetInternal(err)@@ -369,7 +369,7 @@ func (s *Server) registerSheetRoutes(g *echo.Group) {})g.PATCH("/sheet/:id", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()id, err := strconv.Atoi(c.Param("id"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("id"))).SetInternal(err)@@ -404,7 +404,7 @@ func (s *Server) registerSheetRoutes(g *echo.Group) {})g.DELETE("/sheet/:id", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()id, err := strconv.Atoi(c.Param("id"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("id"))).SetInternal(err)diff --git a/server/sql.go b/server/sql.goindex 839552e8a6..91de91c6b8 100644--- a/server/sql.go+++ b/server/sql.go@@ -21,7 +21,7 @@ import (func (s *Server) registerSQLRoutes(g *echo.Group) {g.POST("/sql/ping", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()connectionInfo := &api.ConnectionInfo{}if err := jsonapi.UnmarshalPayload(c.Request().Body, connectionInfo); err != nil {return echo.NewHTTPError(http.StatusBadRequest, "Malformatted sql ping request").SetInternal(err)@@ -78,7 +78,7 @@ func (s *Server) registerSQLRoutes(g *echo.Group) {})g.POST("/sql/sync-schema", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()sync := &api.SQLSyncSchema{}if err := jsonapi.UnmarshalPayload(c.Request().Body, sync); err != nil {return echo.NewHTTPError(http.StatusBadRequest, "Malformatted sql sync schema request").SetInternal(err)@@ -102,7 +102,7 @@ func (s *Server) registerSQLRoutes(g *echo.Group) {})g.POST("/sql/execute", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()exec := &api.SQLExecute{}if err := jsonapi.UnmarshalPayload(c.Request().Body, exec); err != nil {return echo.NewHTTPError(http.StatusBadRequest, "Malformatted sql execute request").SetInternal(err)diff --git a/server/task.go b/server/task.goindex 47ea3eb438..b379b49729 100644--- a/server/task.go+++ b/server/task.go@@ -37,7 +37,7 @@ func isTaskStatusTransitionAllowed(fromStatus, toStatus api.TaskStatus) bool {func (s *Server) registerTaskRoutes(g *echo.Group) {g.PATCH("/pipeline/:pipelineID/task/:taskID", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()taskID, err := strconv.Atoi(c.Param("taskID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Task ID is not a number: %s", c.Param("taskID"))).SetInternal(err)@@ -292,7 +292,7 @@ func (s *Server) registerTaskRoutes(g *echo.Group) {})g.PATCH("/pipeline/:pipelineID/task/:taskID/status", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()taskID, err := strconv.Atoi(c.Param("taskID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Task ID is not a number: %s", c.Param("taskID"))).SetInternal(err)@@ -361,7 +361,7 @@ func (s *Server) registerTaskRoutes(g *echo.Group) {})g.POST("/pipeline/:pipelineID/task/:taskID/check", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()taskID, err := strconv.Atoi(c.Param("taskID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Task ID is not a number: %s", c.Param("taskID"))).SetInternal(err)diff --git a/server/vcs.go b/server/vcs.goindex 236a0514c2..6df436ed44 100644--- a/server/vcs.go+++ b/server/vcs.go@@ -1,7 +1,6 @@package serverimport (- "context""fmt""net/http""strconv"@@ -16,7 +15,7 @@ import (func (s *Server) registerVCSRoutes(g *echo.Group) {g.POST("/vcs", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()vcsCreate := &api.VCSCreate{CreatorID: c.Get(getPrincipalIDContextKey()).(int),}@@ -40,7 +39,7 @@ func (s *Server) registerVCSRoutes(g *echo.Group) {})g.GET("/vcs", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()vcsFind := &api.VCSFind{}vcsList, err := s.store.FindVCS(ctx, vcsFind)if err != nil {@@ -55,7 +54,7 @@ func (s *Server) registerVCSRoutes(g *echo.Group) {})g.GET("/vcs/:vcsID", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()id, err := strconv.Atoi(c.Param("vcsID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("vcsID"))).SetInternal(err)@@ -74,7 +73,7 @@ func (s *Server) registerVCSRoutes(g *echo.Group) {})g.PATCH("/vcs/:vcsID", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()id, err := strconv.Atoi(c.Param("vcsID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("VCS ID is not a number: %s", c.Param("vcsID"))).SetInternal(err)@@ -104,7 +103,7 @@ func (s *Server) registerVCSRoutes(g *echo.Group) {})g.DELETE("/vcs/:vcsID", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()id, err := strconv.Atoi(c.Param("vcsID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("VCS is not a number: %s", c.Param("vcsID"))).SetInternal(err)@@ -124,7 +123,7 @@ func (s *Server) registerVCSRoutes(g *echo.Group) {})g.GET("/vcs/:vcsID/repository", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()id, err := strconv.Atoi(c.Param("vcsID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("vcsID"))).SetInternal(err)@@ -155,7 +154,7 @@ func (s *Server) registerVCSRoutes(g *echo.Group) {})g.GET("/vcs/:vcsID/external-repository", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()id, err := strconv.Atoi(c.Param("vcsID"))if err != nil {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("vcsID"))).SetInternal(err)diff --git a/server/webhook.go b/server/webhook.goindex 6677ed1100..8ecf6203ce 100644--- a/server/webhook.go+++ b/server/webhook.go@@ -27,7 +27,7 @@ var (func (s *Server) registerWebhookRoutes(g *echo.Group) {g.POST("/gitlab/:id", func(c echo.Context) error {- ctx := context.Background()+ ctx := c.Request().Context()var b []byteb, err := io.ReadAll(c.Request().Body)if err != nil {