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

fix: artifact v4 upload above 8MB #2402

Merged
merged 3 commits into from
Sep 7, 2024
Merged
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
18 changes: 12 additions & 6 deletions pkg/artifacts/arifacts_v4.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,16 @@

artifactName := req.Name

safeRunPath := safeResolve(r.baseDir, fmt.Sprint(runID))
safePath := safeResolve(safeRunPath, artifactName)
safePath = safeResolve(safePath, artifactName+".zip")
file, err := r.fs.OpenWritable(safePath)

if err != nil {
panic(err)

Check warning on line 280 in pkg/artifacts/arifacts_v4.go

View check run for this annotation

Codecov / codecov/patch

pkg/artifacts/arifacts_v4.go#L280

Added line #L280 was not covered by tests
}
file.Close()

respData := CreateArtifactResponse{
Ok: true,
SignedUploadUrl: r.buildArtifactURL("UploadArtifact", artifactName, runID),
Expand All @@ -292,12 +302,7 @@
safePath := safeResolve(safeRunPath, artifactName)
safePath = safeResolve(safePath, artifactName+".zip")

file, err := func() (WritableFile, error) {
if comp == "appendBlock" {
return r.fs.OpenAppendable(safePath)
}
return r.fs.OpenWritable(safePath)
}()
file, err := r.fs.OpenAppendable(safePath)

if err != nil {
panic(err)
Expand All @@ -317,6 +322,7 @@
if err != nil {
panic(err)
}
file.Close()
ctx.JSON(http.StatusCreated, "appended")
case "blocklist":
ctx.JSON(http.StatusCreated, "created")
Expand Down
Loading