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

kube: honor --build=false if specified. #13286

Merged

Conversation

flouthoc
Copy link
Collaborator

podman play kube tries to build images even if --build is set to
false so lets honor that and make --build , true by default so it
matches the original behavior.

Closes: #13285

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 18, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: flouthoc

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 openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 18, 2022
@Luap99
Copy link
Member

Luap99 commented Feb 20, 2022

I think the problem with this is that the image is build every time. The current behaviour is build when image not exists now it will build every time. I don't think this is a good user experience.

@@ -486,7 +486,7 @@ func (ic *ContainerEngine) getImageAndLabelInfo(ctx context.Context, cwd string,
if err != nil {
return nil, nil, err
}
if (len(buildFile) > 0 && !existsLocally) || (len(buildFile) > 0 && options.Build) {
if options.Build && ((len(buildFile) > 0 && !existsLocally) || (len(buildFile) > 0)) {
Copy link
Member

Choose a reason for hiding this comment

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

The (len(buildFile) > 0 && !existsLocally) is unnecessary because you also check for only (len(buildFile) > 0)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed.

I think the problem with this is that the image is build every time. The current behaviour is build when image not exists now it will build every time. I don't think this is a good user experience.

@Luap99 For this i think previous behavior was wrong, we should never try to build if --build is not set. I am fine to move back default value of --build=false but it changes behavior. Hence to be as close as to the previous behviour i am setting default value of build to true.

Copy link
Member

Choose a reason for hiding this comment

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

But this changes behaviour, if I have a bigger Containerfile and it start building every time this will be super annoying.
IMO it should be:
--build or --build=true means always build.
when --build is not set it means only build when image not found locally
--build=false should mean never build

You can check if a flag is set on the cli with flags.Changed("build")

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@Luap99 I am still confused why do we want to build if user does not specifies --build but sure I agree lets keep the old behavior intact. I think recent commit should addresses this.

@flouthoc flouthoc force-pushed the kube-build-false-default branch 2 times, most recently from a5b9c4b to 763d143 Compare February 21, 2022 10:49
@flouthoc flouthoc requested a review from Luap99 February 21, 2022 10:52
@flouthoc
Copy link
Collaborator Author

@Luap99 @containers/podman-maintainers PTAL

Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

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

Can you clarify the build behaviour in the man page.
otherwise LGTM, @baude PTAL

`podman play kube` tries to build images even if `--build` is set to
false so lets honor that and make `--build` , `true` by default so it
matches the original behviour.

Signed-off-by: Aditya R <arajan@redhat.com>
@flouthoc flouthoc changed the title kube: honor --build=false and make --build=true by default kube: honor --build=false if specified. Feb 21, 2022
@rhatdan
Copy link
Member

rhatdan commented Feb 21, 2022

/lgtm
/hold

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 21, 2022
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Feb 21, 2022
@baude
Copy link
Member

baude commented Feb 21, 2022

/hold cancel

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 21, 2022
@openshift-merge-robot openshift-merge-robot merged commit a746a61 into containers:main Feb 21, 2022
@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 21, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 21, 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.

Prevent automatic image building in kube play
6 participants