Skip to content

hack: ensure py3 user local bin is checked and used accordingly#1945

Open
egypcio wants to merge 5 commits intokubernetes-sigs:mainfrom
egypcio:ensure-py3-user-local-bin
Open

hack: ensure py3 user local bin is checked and used accordingly#1945
egypcio wants to merge 5 commits intokubernetes-sigs:mainfrom
egypcio:ensure-py3-user-local-bin

Conversation

@egypcio
Copy link
Copy Markdown

@egypcio egypcio commented Feb 28, 2026

Change description

by merging these changes, we:

  • ignore artifact downloaded to bootstrap pip3 under capi/ in git;
  • apply changes to allow make deps to get a bit further without depending on root privileges;
  • verify if binary is available under $HOME/.local/bin, once pip3_install used --user parameter already;
  • check that we are NOT running as 'root' before using --break-system-packages with pip3 (not done before);
  • set ansible commands as variables, respecting local PATH under $HOME/.local/bin if binary exists;
  • get packer to be installed under $HOME/.local/bin to get a sharp and consistent use of $PATH.

are these changes related to new provider or OS?

  • Is this change including a new Provider or a new OS? (y/n) n
  • If yes, has the Provider/OS matrix been updated in the readme? (y/n) n
  • If adding a new provider, are you a representative of that provider? (y/n) n

Related issues

no issues or PR are affected by these changes

Additional context

there's no need to run make deps with root privileges. therefore the possibility of installing local user binaries was taking to consideration here.

tested on Linux and macOS

on top of that, the code in upstream repository would be taking care of setting up dependencies for end users in a more convenient way -- e.g.: they would no longer need additional steps to install pip3 or ansible using sudo.

Next steps

should this be merged:

  • a minor additional documentation should be updated;
  • mention easier way to get dependencies installed and make better use of PATH while building images;
  • document the usage of PATH=$HOME/.local/bin:$PATH make ...

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign kkeshavamurthy for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

Welcome @egypcio!

It looks like this is your first PR to kubernetes-sigs/image-builder 🎉. 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/image-builder 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
Copy Markdown
Contributor

Hi @egypcio. 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.

Details

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-sigs/prow 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/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Feb 28, 2026
@egypcio egypcio changed the title hack: ensure py3 user local bin is checked and used hack: ensure py3 user local bin is checked and used accordingly Feb 28, 2026
Signed-off-by: vinícius <651124+egypcio@users.noreply.github.com>
  * get-pip.py is used to bootstrap pip3 only

Signed-off-by: vinícius <651124+egypcio@users.noreply.github.com>
  * pip3_install used --user parameter before, so they assumed things
    were installed under $HOME/.local/bin already;
  * apply changes to allow `make deps` to get a bit further without
    depending on root privileges;
  * check that we are NOT running as 'root' before using
    --break-system-packages with pip3 (not done before).

Signed-off-by: vinícius <651124+egypcio@users.noreply.github.com>
Signed-off-by: vinícius <651124+egypcio@users.noreply.github.com>
Signed-off-by: vinícius <651124+egypcio@users.noreply.github.com>
@egypcio egypcio force-pushed the ensure-py3-user-local-bin branch from 93bc689 to b6939e4 Compare February 28, 2026 20:13
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

PR needs rebase.

Details

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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants