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

✨ (go/v4): Allows container tool to be configured in Makefile #3371

Conversation

redhatrises
Copy link
Contributor

  • This allows building with other container tools like podman. Keeps docker as the default.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Apr 27, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: redhatrises / name: Gabe Alford (d16c021)

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Apr 27, 2023
@k8s-ci-robot
Copy link
Contributor

Welcome @redhatrises!

It looks like this is your first PR to kubernetes-sigs/kubebuilder 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/kubebuilder has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
Copy link
Contributor

Hi @redhatrises. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 27, 2023
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Apr 27, 2023
@@ -71,6 +71,10 @@ else
GOBIN=$(shell go env GOBIN)
endif

# CONTAINER_TOOL defines the container tool to be used for building images.
Copy link
Member

Choose a reason for hiding this comment

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

All makefile targets does not work with ANY other container tool
For example docker-buildx: test ## Build and push docker image for the manager for cross-platform support will really work within any container tool or podman?

So, if you would like to create the env var here it is fine but I do not think that we can say that it can be used with podman . Also, we would need to highlight that it is only tested/support with docker by default. We do not test other tools within.

Is that make sense?

Therefore, if we provide the further clarifications I am OK within.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hello @camilamacedo86

Iirc podman does have a buildx subcommand, but I agree as well that not all container tools will support all Makefile targets. Where would you prefer to add verbiage on this? Where the $CONTAINER_TOOL variable is set?

Copy link
Member

@camilamacedo86 camilamacedo86 Apr 29, 2023

Choose a reason for hiding this comment

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

Hi @redhatrises,

Thank you for the contribution and for share that.
Please, feel free to wording it as you see fit. I think anything like follows would be great.

CONTAINER_TOOL defines the container tool to be used for building images. Be aware that the target commands are only tested with Docker which is scaffolded by default. However, you might want to replace it to use other tools. (i.e. podman)

Also, could you please only apply the change in the go/v4 plugin?
The plugin v3 is deprecated so ideally we should only perform changes on it if is some critical bug. So we avoid introduce regressions either motivate users to upgrade their projects.

Again, thank you a lot for your contribution 🥇

/ok-to-test

Copy link
Member

Choose a reason for hiding this comment

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

Thoughts on taking in a build-cmd directly? Something like this. If the user provides an entire cmd through an envVar we run it, or we default to docker commands. This will enable customizations on path of where binary can be located too.
cc: @camilamacedo86

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @redhatrises,

Thank you for the contribution and for share that. Please, feel free to wording it as you see fit. I think anything like follows would be great.

CONTAINER_TOOL defines the container tool to be used for building images. Be aware that the target commands are only tested with Docker which is scaffolded by default. However, you might want to replace it to use other tools. (i.e. podman)

Also, could you please only apply the change in the go/v4 plugin? The plugin v3 is deprecated so ideally we should only perform changes on it if is some critical bug. So we avoid introduce regressions either motivate users to upgrade their projects.

Again, thank you a lot for your contribution 🥇

/ok-to-test

@camilamacedo86 I added your wording, because it works well. I also removed updates to the v3 plugin.

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Apr 29, 2023
@@ -11,6 +11,10 @@ else
GOBIN=$(shell go env GOBIN)
endif

# CONTAINER_TOOL defines the container tool to be used for building images.
# You can use docker or podman
CONTAINER_TOOL ?= docker
Copy link

Choose a reason for hiding this comment

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

I've seen this pattern be successful and useful in other projects. It uses podman if it's installed, otherwise defaults to docker. That seems to match people's usage fairly well, because typically the only reason someone appears to have both installed is if they use podman and have some sort of alias of docker to podman (see dnf info podman-docker for example).

CONTAINER_TOOL=$( command -v podman &> /dev/null && echo "podman" || echo "docker")

- This allows building with other container tools like podman. Keeps docker as the default.

Signed-off-by: Gabe Alford <redhatrises@gmail.com>
@redhatrises redhatrises force-pushed the make_container_tool_variable branch from d16c021 to 1075dbf Compare May 2, 2023 18:58
Copy link
Member

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution 🥇

/lgtm
/approved

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 4, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: camilamacedo86, redhatrises

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 4, 2023
@camilamacedo86 camilamacedo86 changed the title ✨ allow container tool to be configured in Makefile ✨ (go/v4): Allows container tool to be configured in Makefile May 4, 2023
@k8s-ci-robot k8s-ci-robot merged commit 2a97944 into kubernetes-sigs:master May 4, 2023
12 checks passed
@redhatrises redhatrises deleted the make_container_tool_variable branch May 4, 2023 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants