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
f579dd47
Commit
f579dd47
authored
May 28, 2020
by
Georges-Etienne Legendre
Committed by
Jacob Vosmaer
May 28, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Gather gitlab-zip-cat/metadata stderr and log output in the current context
parent
2cbc8edf
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
4 deletions
+11
-4
changelogs/unreleased/fix-issue-249.yml
changelogs/unreleased/fix-issue-249.yml
+5
-0
internal/artifacts/artifacts_upload.go
internal/artifacts/artifacts_upload.go
+2
-1
internal/artifacts/entry.go
internal/artifacts/entry.go
+4
-3
No files found.
changelogs/unreleased/fix-issue-249.yml
0 → 100644
View file @
f579dd47
---
title
:
Gather gitlab-zip-cat/metadata stderr and log output in the current context
merge_request
:
498
author
:
Georges-Etienne Legendre
type
:
fixed
internal/artifacts/artifacts_upload.go
View file @
f579dd47
...
...
@@ -11,6 +11,7 @@ import (
"syscall"
"github.com/prometheus/client_golang/prometheus"
"gitlab.com/gitlab-org/labkit/log"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/api"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/filestore"
...
...
@@ -53,7 +54,7 @@ func (a *artifactsUploadProcessor) generateMetadataFromZip(ctx context.Context,
}
zipMd
:=
exec
.
CommandContext
(
ctx
,
"gitlab-zip-metadata"
,
fileName
)
zipMd
.
Stderr
=
os
.
Stderr
zipMd
.
Stderr
=
log
.
ContextLogger
(
ctx
)
.
Writer
()
zipMd
.
SysProcAttr
=
&
syscall
.
SysProcAttr
{
Setpgid
:
true
}
zipMd
.
Stdout
=
metaWriter
...
...
internal/artifacts/entry.go
View file @
f579dd47
...
...
@@ -2,6 +2,7 @@ package artifacts
import
(
"bufio"
"context"
"fmt"
"io"
"mime"
...
...
@@ -43,7 +44,7 @@ func (e *entry) Inject(w http.ResponseWriter, r *http.Request, sendData string)
return
}
err
:=
unpackFileFromZip
(
params
.
Archive
,
params
.
Entry
,
w
.
Header
(),
w
)
err
:=
unpackFileFromZip
(
r
.
Context
(),
params
.
Archive
,
params
.
Entry
,
w
.
Header
(),
w
)
if
os
.
IsNotExist
(
err
)
{
http
.
NotFound
(
w
,
r
)
...
...
@@ -60,7 +61,7 @@ func detectFileContentType(fileName string) string {
return
contentType
}
func
unpackFileFromZip
(
archivePath
,
encodedFilename
string
,
headers
http
.
Header
,
output
io
.
Writer
)
error
{
func
unpackFileFromZip
(
ctx
context
.
Context
,
archivePath
,
encodedFilename
string
,
headers
http
.
Header
,
output
io
.
Writer
)
error
{
fileName
,
err
:=
zipartifacts
.
DecodeFileEntry
(
encodedFilename
)
if
err
!=
nil
{
return
err
...
...
@@ -71,7 +72,7 @@ func unpackFileFromZip(archivePath, encodedFilename string, headers http.Header,
"ARCHIVE_PATH="
+
archivePath
,
"ENCODED_FILE_NAME="
+
encodedFilename
,
)
catFile
.
Stderr
=
os
.
Stderr
catFile
.
Stderr
=
log
.
ContextLogger
(
ctx
)
.
Writer
()
catFile
.
SysProcAttr
=
&
syscall
.
SysProcAttr
{
Setpgid
:
true
}
stdout
,
err
:=
catFile
.
StdoutPipe
()
if
err
!=
nil
{
...
...
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