Skip to content

Commit

Permalink
Merge branch 'format-push' into format-pull-fetch-discover
Browse files Browse the repository at this point in the history
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
  • Loading branch information
qweeah committed Jan 25, 2024
2 parents 58446a5 + 18c15f6 commit 65200aa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions cmd/oras/internal/meta/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ func ToDigestReference(name string, digest string) DigestReference {
// Descriptor is a descriptor with digest reference.
type Descriptor struct {
DigestReference

// MediaType is the media type of the object this schema refers to.
MediaType string

Expand Down
8 changes: 6 additions & 2 deletions test/e2e/suite/command/attach.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"fmt"
"path/filepath"
"regexp"
"strings"

. "github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"
Expand Down Expand Up @@ -126,10 +127,13 @@ var _ = Describe("1.1 registry users:", func() {
subjectRef := RegistryRef(ZOTHost, testRepo, foobar.Tag)
CopyZOTRepo(ImageRepo, testRepo)
// test
ref := ORAS("attach", "--artifact-type", "test/attach", subjectRef, fmt.Sprintf("%s:%s", foobar.AttachFileName, foobar.AttachFileMedia), "--export-manifest", exportName, "--format", "{{.Ref}}").
delimitter := "|"
output := ORAS("attach", "--artifact-type", "test/attach", subjectRef, fmt.Sprintf("%s:%s", foobar.AttachFileName, foobar.AttachFileMedia), "--export-manifest", exportName, "--format", fmt.Sprintf("{{.Ref%s.ArtifactType}}", delimitter)).
WithWorkDir(tempDir).Exec().Out.Contents()
ref, artifactType, _ := strings.Cut(string(output), delimitter)
// validate
fetched := ORAS("manifest", "fetch", string(ref)).Exec().Out.Contents()
Expect(artifactType).To(Equal("test/attach"))
fetched := ORAS("manifest", "fetch", ref).Exec().Out.Contents()
MatchFile(filepath.Join(tempDir, exportName), string(fetched), DefaultTimeout)
})

Expand Down

0 comments on commit 65200aa

Please sign in to comment.