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

add --pull flag for podman create&run #3617

Merged
merged 1 commit into from
Aug 17, 2019

Conversation

QiWang19
Copy link
Contributor

@QiWang19 QiWang19 commented Jul 22, 2019

Requirement from #3575 (comment)
Fixes: #3734

Added --pull for podman create and pull to match the newly added flag in docker CLI.
missing: default value, podman will pull the image if it does not exist in the local.
always: podman will always pull the image.
never: podman will never pull the image.

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

**--pull**=*missing*

Pull image before creating ("always"|"missing"|"never") (default "missing").
'missing': default value, podman will pull the image if it does not exist in the local.
Copy link
Member

Choose a reason for hiding this comment

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

Suggest: "exist in the local" to "exist locally". If you take the change, make it throughout. That lines this up with the Buildah verbiage.

func (r *LocalRuntime) New(ctx context.Context, name, signaturePolicyPath, authfile string, writer io.Writer, dockeroptions *image.DockerRegistryOptions, signingoptions image.SigningOptions, forcePull bool, label *string) (*ContainerImage, error) {
img, err := r.Runtime.ImageRuntime().New(ctx, name, signaturePolicyPath, authfile, writer, dockeroptions, signingoptions, forcePull, label)
func (r *LocalRuntime) New(ctx context.Context, name, signaturePolicyPath, authfile string, writer io.Writer, dockeroptions *image.DockerRegistryOptions, signingoptions image.SigningOptions, forcePull bool, label *string, pull string) (*ContainerImage, error) {
img, err := r.Runtime.ImageRuntime().New(ctx, name, signaturePolicyPath, authfile, writer, dockeroptions, signingoptions, forcePull, label, pull)
Copy link
Member

Choose a reason for hiding this comment

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

I'd prefer "pullType" for the variable name "pull", just specifies better what the variable is used for and easier to grep for. I'll let @mheon break the tie on the name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do we need to keep both focePull and pullType as arguments?

Copy link
Member

Choose a reason for hiding this comment

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

please drop forcePull

@TomSweeneyRedHat
Copy link
Member

Does this line up with Docker functionality? Or at least it's just added functionality and won't break previous scripts?

@QiWang19
Copy link
Contributor Author

I think this lines up with Docker functionality. And this hasn't been added to the current docker release. I just tried this functionality with nightly build of the docker CLI https://download.docker.com/linux/static/nightly/x86_64/

@TomSweeneyRedHat
Copy link
Member

@QiWang19 all kinds of test unhappiness

@mheon
Copy link
Member

mheon commented Jul 22, 2019

I think we had reservations about the old patches for this from @haircommander but I don't think they're related to the code as written here.

@haircommander
Copy link
Collaborator

@mheon there were reservations about that patch (#2618) because it was addressing functionality that seemed like it existed in upstream docker, but didn't. this patch is much better, as it actually mirrors docker functionality that made it in.

@QiWang19 QiWang19 force-pushed the create_pull branch 7 times, most recently from 3157c7d to 27d9c0c Compare July 25, 2019 18:32
@rh-atomic-bot
Copy link
Collaborator

☔ The latest upstream changes (presumably #3656) 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 Jul 29, 2019
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 1, 2019
@mheon
Copy link
Member

mheon commented Aug 2, 2019

/approve

Tagging for 1.5.1

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

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

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

The pull request process is described here

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 Aug 2, 2019
@abitrolly
Copy link
Contributor

@QiWang19

always: podman will always pull the image.

Is there an option to pull only when there is a newer image? (newer of not exist)

@QiWang19
Copy link
Contributor Author

QiWang19 commented Aug 5, 2019

Is there an option to pull only when there is a newer image? (newer of not exist)

@abitrolly I think this PR https://github.com/containers/libpod/pull/2618/files implemented --update can check the newer image and pull it. But this PR hasn't been merged.
@rhatdan @haircommander do we want to reopen that PR and add --update?

@haircommander
Copy link
Collaborator

@QiWang19 there were some fundamental problems that @mtrmac found with that PR, and I never found any corresponding functionality in the docker cli. The closest they have is what you're adding here. I am not inclined to reopen #2618 and rebase, but feel free to take it over if you want it :)

@QiWang19 QiWang19 force-pushed the create_pull branch 2 times, most recently from f0d3c61 to 4b98ccc Compare August 6, 2019 20:39
@rhatdan
Copy link
Member

rhatdan commented Aug 7, 2019

@QiWang19 Lets get this merged, then we can look at Buildah.

@rh-atomic-bot
Copy link
Collaborator

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

@vrothberg
Copy link
Member

For now no plan to support --pull("always"|"missing"|"never") for build.
build also has --pull(pull the image if not present (default true))
Do we want to change build? make --pull and --pull-aways to --pull same as create and run in this PR.

I definitely prefer the "new" --pull flag of this PR but it is causing an inconsistency in our CLI since the one for build is a simple boolean. I am certain that this will confuse users if it's being released as is.

@QiWang19 Lets get this merged, then we can look at Buildah.

This is affecting podman-build already. Merging this PR will cause the inconsistency.

I think we can fix the inconsistency by cheating a bit and make podman build --pull understand missing,always,never,true,false ... true,false to be backward compatible.

@QiWang19
Copy link
Contributor Author

QiWang19 commented Aug 9, 2019

the podman build --pull bool flag is defined in BudResults buildah/pkg/cli/common.go, it should be changed in build so podman build can accept string "missing|always|never"
😨 hard to cheat

@QiWang19 QiWang19 force-pushed the create_pull branch 2 times, most recently from 8dd99d4 to e6851f1 Compare August 9, 2019 19:19
@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 9, 2019
Requirement from containers#3575 (comment)

Added --pull for podman create and pull to match the newly added flag in docker CLI.
`missing`: default value, podman will pull the image if it does not exist in the local.
`always`: podman will always pull the image.
`never`: podman will never pull the image.

Signed-off-by: Qi Wang <qiwan@redhat.com>
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 9, 2019
@mheon
Copy link
Member

mheon commented Aug 15, 2019

Code LGTM

@QiWang19
Copy link
Contributor Author

This patch can get in. Can not change or cheat --pull for podman build or buildah bud in this PR.

@rhatdan
Copy link
Member

rhatdan commented Aug 17, 2019

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 17, 2019
@openshift-merge-robot openshift-merge-robot merged commit 76f327f into containers:master Aug 17, 2019
@vrothberg
Copy link
Member

This patch can get in. Can not change or cheat --pull for podman build or buildah bud in this PR.

I think we should have first applied that change to Buildah, then revendor and change the code here. @QiWang19, can you open a PR at Buildah to address it? I really want this flag to be consistent across commands (and tools).

@QiWang19 QiWang19 deleted the create_pull branch June 26, 2020 15:10
@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.

support --pull-always for create/run