Skip to content

manifest create,add,inspect#5843

Merged
openshift-merge-robot merged 1 commit into
containers:masterfrom
QiWang19:manifest_create
Apr 23, 2020
Merged

manifest create,add,inspect#5843
openshift-merge-robot merged 1 commit into
containers:masterfrom
QiWang19:manifest_create

Conversation

@QiWang19
Copy link
Copy Markdown
Member

Implememts manifest subcommands create, add, inspect.

Signed-off-by: Qi Wang qiwan@redhat.com

Comment thread cmd/podmanV2/manifest/add.go Outdated
Comment on lines 46 to 47
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
case 0, 1:
return errors.New("At least a list image and an image to add must be specified")

Args: cobra.MinimumNArgs(2) Ensures this case will never be true.

Comment thread cmd/podmanV2/manifest/add.go Outdated
Comment on lines 57 to 58
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given this default, I would change to Args.ExactArgs(2) and remove the switch.

Comment thread cmd/podmanV2/manifest/create.go Outdated
Comment on lines 37 to 39
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if len(args) == 0 {
return errors.New("At least a name must be specified for the list")
}
``
Args: cobra.MinimumNArgs(1) ensures this is always false.

Comment thread cmd/podmanV2/manifest/inspect.go Outdated
Comment on lines 31 to 40
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
switch len(args) {
case 0:
return errors.New("At least a source list ID must be specified")
case 1:
if args[0] == "" {
return errors.Errorf(`Invalid image name "%s"`, args[0])
}
default:
return errors.New("Only one argument is necessary for inspect: an image name")
}

Args: cobra.ExactArgs(1) will take care of this switch

Comment thread cmd/podmanV2/manifest/manifest.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
PersistentPreRunE: preRunE,

As of #5848 this is no longer required.

Comment thread pkg/domain/infra/abi/manifest.go Outdated
Comment on lines 28 to 30
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cannot use Printf() in this layer. Need to return data to caller.

Comment thread pkg/domain/infra/abi/manifest.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_, err = alltransports.ParseImageName(fmt.Sprintf("%s%s", dockerPrefix, name))
_, err = alltransports.ParseImageName(dockerPrefix + name)

Comment thread pkg/domain/infra/abi/manifest.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fmt.Printf("%s\n", buf)
return buf, nil

This needs to be returned to caller, not printed at this layer.

Comment thread pkg/domain/entities/engine_image.go Outdated
Comment on lines 26 to 28
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ManifestCreate(ctx context.Context, names, images []string, opts ManifestCreateOptions) error
ManifestInspect(ctx context.Context, name string) error
ManifestAdd(ctx context.Context, opts ManifestAddOptions) error
ManifestCreate(ctx context.Context, names, images []string, opts ManifestCreateOptions) (<report>, error)
ManifestInspect(ctx context.Context, name string) (<report>, error)
ManifestAdd(ctx context.Context, opts ManifestAddOptions) (<report>, error)

You cannot present data to user in these functions, needs to be done in the manifest/*.go files.

Comment thread test/e2e/manifest_test.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should print out err to help with debugging issues.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked other tests. Integration tests don't log errors in BeforeEach(). Does this need for manifest?

@rh-atomic-bot
Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (presumably #5848) made this pull request unmergeable. Please resolve the merge conflicts.

@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 17, 2020
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 17, 2020
@QiWang19 QiWang19 changed the title podmanV2:manifest create,add,inspect manifest create,add,inspect Apr 17, 2020
@QiWang19 QiWang19 force-pushed the manifest_create branch 7 times, most recently from 5d1c59d to 768bd6b Compare April 17, 2020 20:59
@QiWang19
Copy link
Copy Markdown
Member Author

@jwhonce PTAL

@QiWang19 QiWang19 force-pushed the manifest_create branch 4 times, most recently from cc2ff7d to 8880f60 Compare April 22, 2020 19:46
@QiWang19
Copy link
Copy Markdown
Member Author

Comment thread completions/bash/podman Outdated
Copy link
Copy Markdown
Member

@TomSweeneyRedHat TomSweeneyRedHat Apr 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to have an extra couple of spaces before the last three lines here?

Comment thread completions/bash/podman Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spacing?

Comment thread completions/bash/podman Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spacing?

@TomSweeneyRedHat
Copy link
Copy Markdown
Member

A couple of spacing/tab nits, otherwise LGTM

Implememts manifest subcommands create, add, inspect.

Signed-off-by: Qi Wang <qiwan@redhat.com>
@rhatdan
Copy link
Copy Markdown
Member

rhatdan commented Apr 23, 2020

/approve

@openshift-ci-robot
Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: QiWang19, rhatdan

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 23, 2020
flags := addCmd.Flags()
flags.BoolVar(&manifestAddOpts.All, "all", false, "add all of the list's images if the image is a list")
flags.StringSliceVar(&manifestAddOpts.Annotation, "annotation", nil, "set an `annotation` for the specified image")
flags.StringVar(&manifestAddOpts.Arch, "arch", "", "override the `architecture` of the specified image")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Buildah has --os as well?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to change libpod/image/manifests.go to support --os, I can fix it in another PR.

@rhatdan
Copy link
Copy Markdown
Member

rhatdan commented Apr 23, 2020

Buildah also has
buildah-manifest-annotate.1 buildah-manifest-push.1
buildah-manifest-remove.1

@QiWang19
Copy link
Copy Markdown
Member Author

Buildah also has
buildah-manifest-annotate.1 buildah-manifest-push.1
buildah-manifest-remove.1

I plan to finish the rest implementation in a different PR.

@rhatdan
Copy link
Copy Markdown
Member

rhatdan commented Apr 23, 2020

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 23, 2020
@openshift-merge-robot openshift-merge-robot merged commit 397dcc3 into containers:master Apr 23, 2020
@QiWang19 QiWang19 deleted the manifest_create branch June 26, 2020 15:12
@github-actions github-actions Bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 24, 2023
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Sep 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants