diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-17 15:08:29 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-17 15:08:29 +0000 |
commit | 6c26db46b89172c15ae7b27d938db643721d59cb (patch) | |
tree | ac2f4401213bba4220e205798396f3442a21f4cd /workhorse | |
parent | 6b97ea1f8008a7ddb22b1faa03496cf46c546c05 (diff) | |
download | gitlab-ce-6c26db46b89172c15ae7b27d938db643721d59cb.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'workhorse')
-rw-r--r-- | workhorse/internal/upload/artifacts_uploader.go | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/workhorse/internal/upload/artifacts_uploader.go b/workhorse/internal/upload/artifacts_uploader.go index 98bb5384aa8..debbb9c24db 100644 --- a/workhorse/internal/upload/artifacts_uploader.go +++ b/workhorse/internal/upload/artifacts_uploader.go @@ -34,6 +34,7 @@ var zipSubcommandsErrorsCounter = promauto.NewCounterVec( }, []string{"error"}) type artifactsUploadProcessor struct { + opts *destination.UploadOpts format string SavedFileTracker @@ -42,8 +43,15 @@ type artifactsUploadProcessor struct { // Artifacts is like a Multipart but specific for artifacts upload. func Artifacts(myAPI *api.API, h http.Handler, p Preparer) http.Handler { return myAPI.PreAuthorizeHandler(func(w http.ResponseWriter, r *http.Request, a *api.Response) { + opts, err := p.Prepare(a) + if err != nil { + helper.Fail500(w, r, fmt.Errorf("UploadArtifacts: error preparing file storage options")) + return + } + format := r.URL.Query().Get(ArtifactFormatKey) mg := &artifactsUploadProcessor{ + opts: opts, format: format, SavedFileTracker: SavedFileTracker{Request: r}, } @@ -53,7 +61,10 @@ func Artifacts(myAPI *api.API, h http.Handler, p Preparer) http.Handler { func (a *artifactsUploadProcessor) generateMetadataFromZip(ctx context.Context, file *destination.FileHandler) (*destination.FileHandler, error) { metaOpts := &destination.UploadOpts{ - LocalTempPath: os.TempDir(), + LocalTempPath: a.opts.LocalTempPath, + } + if metaOpts.LocalTempPath == "" { + metaOpts.LocalTempPath = os.TempDir() } fileName := file.LocalPath |