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

chore: align naming of pack option to oras-go #1073

Merged
merged 1 commit into from
Aug 24, 2023
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
8 changes: 4 additions & 4 deletions cmd/oras/internal/option/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ const (

// ImageSpec option struct.
type ImageSpec struct {
flag string
PackType oras.PackManifestVersion
flag string
PackVersion oras.PackManifestVersion
}

// Parse parses flags into the option.
func (opts *ImageSpec) Parse() error {
switch opts.flag {
case ImageSpecV1_1:
opts.PackType = oras.PackManifestVersion1_1_RC4
opts.PackVersion = oras.PackManifestVersion1_1_RC4
case ImageSpecV1_0:
opts.PackType = oras.PackManifestVersion1_0
opts.PackVersion = oras.PackManifestVersion1_0
default:
return fmt.Errorf("unknown image specification flag: %q", opts.flag)
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/oras/root/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Example - Push file "hi.txt" into an OCI image layout folder 'layout-dir' with t
if err := option.Parse(&opts); err != nil {
return err
}
switch opts.PackType {
switch opts.PackVersion {
case oras.PackManifestVersion1_0:
if opts.manifestConfigRef != "" && opts.artifactType != "" {
return errors.New("--artifact-type and --config cannot both be provided for 1.0 OCI image")
Expand Down Expand Up @@ -161,7 +161,7 @@ func runPush(ctx context.Context, opts pushOptions) error {
packOpts.Layers = descs
memoryStore := memory.New()
pack := func() (ocispec.Descriptor, error) {
root, err := oras.PackManifest(ctx, memoryStore, opts.PackType, opts.artifactType, packOpts)
root, err := oras.PackManifest(ctx, memoryStore, opts.PackVersion, opts.artifactType, packOpts)
if err != nil {
return ocispec.Descriptor{}, err
}
Expand Down