Skip to content

Commit

Permalink
Merge branch 'main' into on-completed
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiaoxuan Wang committed Dec 11, 2024
2 parents f05cc66 + 0844004 commit 36dcba1
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release-github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: setup go environment
uses: actions/setup-go@v5
with:
go-version: '1.23.0'
go-version: '1.23.4'
- name: run goreleaser
uses: goreleaser/goreleaser-action@v6
with:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.23.0-alpine as builder
FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.23.4-alpine as builder
ARG TARGETPLATFORM
RUN apk add git make
ENV ORASPKG /oras
Expand Down
8 changes: 6 additions & 2 deletions cmd/oras/internal/display/content/manifest_fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,18 @@ type manifestFetch struct {
outputPath string
}

func (h *manifestFetch) OnContentFetched(desc ocispec.Descriptor, manifest []byte) error {
func (h *manifestFetch) OnContentFetched(desc ocispec.Descriptor, manifest []byte) (eventErr error) {
out := h.stdout
if h.outputPath != "-" && h.outputPath != "" {
f, err := os.Create(h.outputPath)
if err != nil {
return fmt.Errorf("failed to open %q: %w", h.outputPath, err)
}
defer f.Close()
defer func() {
if err := f.Close(); eventErr == nil {
eventErr = err
}
}()
out = f
}
return output.PrintJSON(out, manifest, h.pretty)
Expand Down
8 changes: 6 additions & 2 deletions cmd/oras/internal/display/content/manifest_index.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,18 @@ func NewManifestIndexCreateHandler(out io.Writer, pretty bool, outputPath string
}

// OnContentCreated is called after index content is created.
func (h *manifestIndexCreate) OnContentCreated(manifest []byte) error {
func (h *manifestIndexCreate) OnContentCreated(manifest []byte) (eventErr error) {
out := h.stdout
if h.outputPath != "" && h.outputPath != "-" {
f, err := os.Create(h.outputPath)
if err != nil {
return fmt.Errorf("failed to open %q: %w", h.outputPath, err)
}
defer f.Close()
defer func() {
if err := f.Close(); eventErr == nil {
eventErr = err
}
}()
out = f
}
return output.PrintJSON(out, manifest, h.pretty)
Expand Down
8 changes: 6 additions & 2 deletions cmd/oras/root/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ Example - Pull artifact files from an OCI layout archive 'layout.tar':
return oerrors.Command(cmd, &opts.Target)
}

func runPull(cmd *cobra.Command, opts *pullOptions) error {
func runPull(cmd *cobra.Command, opts *pullOptions) (pullError error) {
ctx, logger := command.GetLogger(cmd, &opts.Common)
statusHandler, metadataHandler, err := display.NewPullHandler(opts.Printer, opts.Format, opts.Path, opts.TTY)
if err != nil {
Expand All @@ -148,7 +148,11 @@ func runPull(cmd *cobra.Command, opts *pullOptions) error {
if err != nil {
return err
}
defer dst.Close()
defer func() {
if err := dst.Close(); pullError == nil {
pullError = err
}
}()
dst.AllowPathTraversalOnWrite = opts.PathTraversal
dst.DisableOverwrite = opts.KeepOldFiles

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module oras.land/oras

go 1.23.0
go 1.23.1

require (
github.com/Masterminds/sprig/v3 v3.3.0
Expand Down
2 changes: 1 addition & 1 deletion internal/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package version

var (
// Version is the current version of the oras.
Version = "1.2.0"
Version = "1.3.0-beta.1"
// BuildMetadata is the extra build time data
BuildMetadata = "unreleased"
// GitCommit is the git sha1
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module oras.land/oras/test/e2e

go 1.23.0
go 1.23.1

require (
github.com/onsi/ginkgo/v2 v2.22.0
github.com/onsi/gomega v1.36.0
github.com/onsi/gomega v1.36.1
github.com/opencontainers/go-digest v1.0.0
github.com/opencontainers/image-spec v1.1.0
gopkg.in/yaml.v2 v2.4.0
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db h1:097atOisP2aRj7vFgY
github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144=
github.com/onsi/ginkgo/v2 v2.22.0 h1:Yed107/8DjTr0lKCNt7Dn8yQ6ybuDRQoMGrNFKzMfHg=
github.com/onsi/ginkgo/v2 v2.22.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo=
github.com/onsi/gomega v1.36.0 h1:Pb12RlruUtj4XUuPUqeEWc6j5DkVVVA49Uf6YLfC95Y=
github.com/onsi/gomega v1.36.0/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog=
github.com/onsi/gomega v1.36.1 h1:bJDPBO7ibjxcbHMgSCoo4Yj18UWbKDlLwX1x9sybDcw=
github.com/onsi/gomega v1.36.1/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog=
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQb2IpWsCzug=
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/go.work
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
go 1.23.0
go 1.23.1

use (
.
Expand Down

0 comments on commit 36dcba1

Please sign in to comment.