Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 1 addition & 2 deletions .github/workflows/oci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ name: "oci: lint"
on:
pull_request:
paths:
- "./**"
- ".github/workflows/oci-lint.yml"
- "**"

permissions:
contents: read
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/oci-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ on:
branches:
- main
paths:
- "./**"
- ".github/workflows/oci-tag.yml"
- "**"

permissions:
contents: write
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/oci-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ name: "oci: test"
on:
pull_request:
paths:
- "./**"
- ".github/workflows/oci-test.yml"
- "**"

permissions:
contents: read
Expand Down
5 changes: 3 additions & 2 deletions ocilarge/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/opencontainers/go-digest"
)

// UploadLargeBlob uploads a large blob in chunks with retries so that uploads can be resumed in case of network error
func UploadLargeBlob(ctx context.Context, reg oci.Interface, repo string, f io.ReadCloser, chunkSize int) (oci.Descriptor, error) {
defer f.Close()
if chunkSize <= 0 {
Expand All @@ -18,7 +19,7 @@ func UploadLargeBlob(ctx context.Context, reg oci.Interface, repo string, f io.R
if err != nil {
return oci.Descriptor{}, fmt.Errorf("starting chunked upload: %w", err)
}
defer bw.Cancel() // no-op after a successful Commit
defer func() { _ = bw.Cancel() }() // no-op after a successful Commit

buf := make([]byte, chunkSize)
dgstr := digest.Canonical.Digester()
Expand All @@ -28,7 +29,7 @@ func UploadLargeBlob(ctx context.Context, reg oci.Interface, repo string, f io.R
dgstr.Hash().Write(buf[:n])

var writeErr error
for i := 0; i < 3; i++ { // try writing each chunk three times
for range 3 { // try writing each chunk three times
_, writeErr = bw.Write(buf[:n])
if writeErr == nil {
break
Expand Down
Loading