Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
0794d819
Commit
0794d819
authored
Feb 09, 2022
by
Jacob Vosmaer
Committed by
Patrick Bajao
Feb 14, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Workhorse: rename upload.Accelerate to upload.Multipart
parent
de73d152
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
22 deletions
+22
-22
workhorse/internal/upload/accelerate.go
workhorse/internal/upload/accelerate.go
+2
-2
workhorse/internal/upstream/routes.go
workhorse/internal/upstream/routes.go
+20
-20
No files found.
workhorse/internal/upload/accelerate.go
View file @
0794d819
...
@@ -17,13 +17,13 @@ type MultipartClaims struct {
...
@@ -17,13 +17,13 @@ type MultipartClaims struct {
jwt
.
StandardClaims
jwt
.
StandardClaims
}
}
func
Accelerate
(
rails
PreAuthorizer
,
h
http
.
Handler
,
p
Preparer
)
http
.
Handler
{
func
Multipart
(
rails
PreAuthorizer
,
h
http
.
Handler
,
p
Preparer
)
http
.
Handler
{
return
rails
.
PreAuthorizeHandler
(
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
,
a
*
api
.
Response
)
{
return
rails
.
PreAuthorizeHandler
(
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
,
a
*
api
.
Response
)
{
s
:=
&
SavedFileTracker
{
Request
:
r
}
s
:=
&
SavedFileTracker
{
Request
:
r
}
opts
,
_
,
err
:=
p
.
Prepare
(
a
)
opts
,
_
,
err
:=
p
.
Prepare
(
a
)
if
err
!=
nil
{
if
err
!=
nil
{
helper
.
Fail500
(
w
,
r
,
fmt
.
Errorf
(
"
Accelerate
: error preparing file storage options"
))
helper
.
Fail500
(
w
,
r
,
fmt
.
Errorf
(
"
Multipart
: error preparing file storage options"
))
return
return
}
}
...
...
workhorse/internal/upstream/routes.go
View file @
0794d819
...
@@ -228,8 +228,8 @@ func configureRoutes(u *upstream) {
...
@@ -228,8 +228,8 @@ func configureRoutes(u *upstream) {
preparers
:=
createUploadPreparers
(
u
.
Config
)
preparers
:=
createUploadPreparers
(
u
.
Config
)
uploadPath
:=
path
.
Join
(
u
.
DocumentRoot
,
"uploads/tmp"
)
uploadPath
:=
path
.
Join
(
u
.
DocumentRoot
,
"uploads/tmp"
)
uploadAccelerateProxy
:=
upload
.
Accelerate
(
&
upload
.
SkipRailsAuthorizer
{
TempPath
:
uploadPath
},
proxy
,
preparers
.
uploads
)
tempfileMultipartProxy
:=
upload
.
Multipart
(
&
upload
.
SkipRailsAuthorizer
{
TempPath
:
uploadPath
},
proxy
,
preparers
.
uploads
)
ciAPIProxyQueue
:=
queueing
.
QueueRequests
(
"ci_api_job_requests"
,
uploadAccelerate
Proxy
,
u
.
APILimit
,
u
.
APIQueueLimit
,
u
.
APIQueueTimeout
)
ciAPIProxyQueue
:=
queueing
.
QueueRequests
(
"ci_api_job_requests"
,
tempfileMultipart
Proxy
,
u
.
APILimit
,
u
.
APIQueueLimit
,
u
.
APIQueueTimeout
)
ciAPILongPolling
:=
builds
.
RegisterHandler
(
ciAPIProxyQueue
,
redis
.
WatchKey
,
u
.
APICILongPollingDuration
)
ciAPILongPolling
:=
builds
.
RegisterHandler
(
ciAPIProxyQueue
,
redis
.
WatchKey
,
u
.
APICILongPollingDuration
)
dependencyProxyInjector
.
SetUploadHandler
(
upload
.
BodyUploader
(
api
,
signingProxy
,
preparers
.
packages
))
dependencyProxyInjector
.
SetUploadHandler
(
upload
.
BodyUploader
(
api
,
signingProxy
,
preparers
.
packages
))
...
@@ -238,7 +238,7 @@ func configureRoutes(u *upstream) {
...
@@ -238,7 +238,7 @@ func configureRoutes(u *upstream) {
defaultUpstream
:=
static
.
ServeExisting
(
defaultUpstream
:=
static
.
ServeExisting
(
u
.
URLPrefix
,
u
.
URLPrefix
,
staticpages
.
CacheDisabled
,
staticpages
.
CacheDisabled
,
static
.
DeployPage
(
static
.
ErrorPagesUnless
(
u
.
DevelopmentMode
,
staticpages
.
ErrorFormatHTML
,
uploadAccelerate
Proxy
)),
static
.
DeployPage
(
static
.
ErrorPagesUnless
(
u
.
DevelopmentMode
,
staticpages
.
ErrorFormatHTML
,
tempfileMultipart
Proxy
)),
)
)
probeUpstream
:=
static
.
ErrorPagesUnless
(
u
.
DevelopmentMode
,
staticpages
.
ErrorFormatJSON
,
proxy
)
probeUpstream
:=
static
.
ErrorPagesUnless
(
u
.
DevelopmentMode
,
staticpages
.
ErrorFormatJSON
,
proxy
)
healthUpstream
:=
static
.
ErrorPagesUnless
(
u
.
DevelopmentMode
,
staticpages
.
ErrorFormatText
,
proxy
)
healthUpstream
:=
static
.
ErrorPagesUnless
(
u
.
DevelopmentMode
,
staticpages
.
ErrorFormatText
,
proxy
)
...
@@ -286,10 +286,10 @@ func configureRoutes(u *upstream) {
...
@@ -286,10 +286,10 @@ func configureRoutes(u *upstream) {
u
.
route
(
"PUT"
,
apiProjectPattern
+
`packages/generic/`
,
upload
.
BodyUploader
(
api
,
signingProxy
,
preparers
.
packages
)),
u
.
route
(
"PUT"
,
apiProjectPattern
+
`packages/generic/`
,
upload
.
BodyUploader
(
api
,
signingProxy
,
preparers
.
packages
)),
// NuGet Artifact Repository
// NuGet Artifact Repository
u
.
route
(
"PUT"
,
apiProjectPattern
+
`packages/nuget/`
,
upload
.
Accelerate
(
api
,
signingProxy
,
preparers
.
packages
)),
u
.
route
(
"PUT"
,
apiProjectPattern
+
`packages/nuget/`
,
upload
.
Multipart
(
api
,
signingProxy
,
preparers
.
packages
)),
// PyPI Artifact Repository
// PyPI Artifact Repository
u
.
route
(
"POST"
,
apiProjectPattern
+
`packages/pypi`
,
upload
.
Accelerate
(
api
,
signingProxy
,
preparers
.
packages
)),
u
.
route
(
"POST"
,
apiProjectPattern
+
`packages/pypi`
,
upload
.
Multipart
(
api
,
signingProxy
,
preparers
.
packages
)),
// Debian Artifact Repository
// Debian Artifact Repository
u
.
route
(
"PUT"
,
apiProjectPattern
+
`packages/debian/`
,
upload
.
BodyUploader
(
api
,
signingProxy
,
preparers
.
packages
)),
u
.
route
(
"PUT"
,
apiProjectPattern
+
`packages/debian/`
,
upload
.
BodyUploader
(
api
,
signingProxy
,
preparers
.
packages
)),
...
@@ -301,31 +301,31 @@ func configureRoutes(u *upstream) {
...
@@ -301,31 +301,31 @@ func configureRoutes(u *upstream) {
u
.
route
(
"PUT"
,
apiProjectPattern
+
`packages/terraform/modules/`
,
upload
.
BodyUploader
(
api
,
signingProxy
,
preparers
.
packages
)),
u
.
route
(
"PUT"
,
apiProjectPattern
+
`packages/terraform/modules/`
,
upload
.
BodyUploader
(
api
,
signingProxy
,
preparers
.
packages
)),
// Helm Artifact Repository
// Helm Artifact Repository
u
.
route
(
"POST"
,
apiProjectPattern
+
`packages/helm/api/[^/]+/charts\z`
,
upload
.
Accelerate
(
api
,
signingProxy
,
preparers
.
packages
)),
u
.
route
(
"POST"
,
apiProjectPattern
+
`packages/helm/api/[^/]+/charts\z`
,
upload
.
Multipart
(
api
,
signingProxy
,
preparers
.
packages
)),
// We are porting API to disk acceleration
// We are porting API to disk acceleration
// we need to declare each routes until we have fixed all the routes on the rails codebase.
// we need to declare each routes until we have fixed all the routes on the rails codebase.
// Overall status can be seen at https://gitlab.com/groups/gitlab-org/-/epics/1802#current-status
// Overall status can be seen at https://gitlab.com/groups/gitlab-org/-/epics/1802#current-status
u
.
route
(
"POST"
,
apiProjectPattern
+
`wikis/attachments\z`
,
uploadAccelerate
Proxy
),
u
.
route
(
"POST"
,
apiProjectPattern
+
`wikis/attachments\z`
,
tempfileMultipart
Proxy
),
u
.
route
(
"POST"
,
apiPattern
+
`graphql\z`
,
uploadAccelerate
Proxy
),
u
.
route
(
"POST"
,
apiPattern
+
`graphql\z`
,
tempfileMultipart
Proxy
),
u
.
route
(
"POST"
,
apiTopicPattern
,
uploadAccelerate
Proxy
),
u
.
route
(
"POST"
,
apiTopicPattern
,
tempfileMultipart
Proxy
),
u
.
route
(
"PUT"
,
apiTopicPattern
,
uploadAccelerate
Proxy
),
u
.
route
(
"PUT"
,
apiTopicPattern
,
tempfileMultipart
Proxy
),
u
.
route
(
"POST"
,
apiPattern
+
`v4/groups/import`
,
upload
.
Accelerate
(
api
,
signingProxy
,
preparers
.
uploads
)),
u
.
route
(
"POST"
,
apiPattern
+
`v4/groups/import`
,
upload
.
Multipart
(
api
,
signingProxy
,
preparers
.
uploads
)),
u
.
route
(
"POST"
,
apiPattern
+
`v4/projects/import`
,
upload
.
Accelerate
(
api
,
signingProxy
,
preparers
.
uploads
)),
u
.
route
(
"POST"
,
apiPattern
+
`v4/projects/import`
,
upload
.
Multipart
(
api
,
signingProxy
,
preparers
.
uploads
)),
// Project Import via UI upload acceleration
// Project Import via UI upload acceleration
u
.
route
(
"POST"
,
importPattern
+
`gitlab_project`
,
upload
.
Accelerate
(
api
,
signingProxy
,
preparers
.
uploads
)),
u
.
route
(
"POST"
,
importPattern
+
`gitlab_project`
,
upload
.
Multipart
(
api
,
signingProxy
,
preparers
.
uploads
)),
// Group Import via UI upload acceleration
// Group Import via UI upload acceleration
u
.
route
(
"POST"
,
importPattern
+
`gitlab_group`
,
upload
.
Accelerate
(
api
,
signingProxy
,
preparers
.
uploads
)),
u
.
route
(
"POST"
,
importPattern
+
`gitlab_group`
,
upload
.
Multipart
(
api
,
signingProxy
,
preparers
.
uploads
)),
// Metric image upload
// Metric image upload
u
.
route
(
"POST"
,
apiProjectPattern
+
`issues/[0-9]+/metric_images\z`
,
upload
.
Accelerate
(
api
,
signingProxy
,
preparers
.
uploads
)),
u
.
route
(
"POST"
,
apiProjectPattern
+
`issues/[0-9]+/metric_images\z`
,
upload
.
Multipart
(
api
,
signingProxy
,
preparers
.
uploads
)),
// Requirements Import via UI upload acceleration
// Requirements Import via UI upload acceleration
u
.
route
(
"POST"
,
projectPattern
+
`requirements_management/requirements/import_csv`
,
upload
.
Accelerate
(
api
,
signingProxy
,
preparers
.
uploads
)),
u
.
route
(
"POST"
,
projectPattern
+
`requirements_management/requirements/import_csv`
,
upload
.
Multipart
(
api
,
signingProxy
,
preparers
.
uploads
)),
// Uploads via API
// Uploads via API
u
.
route
(
"POST"
,
apiProjectPattern
+
`uploads\z`
,
upload
.
Accelerate
(
api
,
signingProxy
,
preparers
.
uploads
)),
u
.
route
(
"POST"
,
apiProjectPattern
+
`uploads\z`
,
upload
.
Multipart
(
api
,
signingProxy
,
preparers
.
uploads
)),
// Explicitly proxy API requests
// Explicitly proxy API requests
u
.
route
(
""
,
apiPattern
,
proxy
),
u
.
route
(
""
,
apiPattern
,
proxy
),
...
@@ -343,9 +343,9 @@ func configureRoutes(u *upstream) {
...
@@ -343,9 +343,9 @@ func configureRoutes(u *upstream) {
),
),
// Uploads
// Uploads
u
.
route
(
"POST"
,
projectPattern
+
`uploads\z`
,
upload
.
Accelerate
(
api
,
signingProxy
,
preparers
.
uploads
)),
u
.
route
(
"POST"
,
projectPattern
+
`uploads\z`
,
upload
.
Multipart
(
api
,
signingProxy
,
preparers
.
uploads
)),
u
.
route
(
"POST"
,
snippetUploadPattern
,
upload
.
Accelerate
(
api
,
signingProxy
,
preparers
.
uploads
)),
u
.
route
(
"POST"
,
snippetUploadPattern
,
upload
.
Multipart
(
api
,
signingProxy
,
preparers
.
uploads
)),
u
.
route
(
"POST"
,
userUploadPattern
,
upload
.
Accelerate
(
api
,
signingProxy
,
preparers
.
uploads
)),
u
.
route
(
"POST"
,
userUploadPattern
,
upload
.
Multipart
(
api
,
signingProxy
,
preparers
.
uploads
)),
// health checks don't intercept errors and go straight to rails
// health checks don't intercept errors and go straight to rails
// TODO: We should probably not return a HTML deploy page?
// TODO: We should probably not return a HTML deploy page?
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment