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

Pass HOME env var when fetching version #2698

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mvukov
Copy link
Contributor

@mvukov mvukov commented Jun 16, 2024

Fixes #2662.

So, in a github action https://github.com/mvukov/rules_ros2/blob/980afb82f4af92480815e723b47a0cde4bea63a7/.github/workflows/main.yml I use my custom build image https://github.com/mvukov/bazel_builder/blob/49178bdf9c151b1fdb1fb0bac580da5d53a990fd/Dockerfile, no user defined. The github action passes user and HOME folder. The home folder seems to be /github/home and fetching the version seems to have problems with this. Therefore, I just pass the HOME env var here.

Copy link

google-cla bot commented Jun 16, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@mvukov
Copy link
Contributor Author

mvukov commented Jun 19, 2024

@illicitonion Can you provide some feedback on this, please?

@mvukov
Copy link
Contributor Author

mvukov commented Jul 3, 2024

So, the issue seems to be the following: I build code in a container w/o user defined (hence, root). In a github action, I pass --user argument to the container. I think that cargo eventually resorts to read std::env::home that reads /etc/passwd and that fails in my case (as HOME env var is not routed). Hence, I kindly ask for this PR to be taken into consideration.

@illicitonion @UebelAndre PTAL.

mvukov added a commit to mvukov/rules_ros2 that referenced this pull request Jul 7, 2024
Copy link
Collaborator

@UebelAndre UebelAndre left a comment

Choose a reason for hiding this comment

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

Sorry for the delay here! Is #2662 (comment) not the root cause here? Does this fix the behavior inside your container?

@mvukov
Copy link
Contributor Author

mvukov commented Aug 8, 2024

@UebelAndre That's unfortunately not going to work. I removed user from my container, so dockerfile only has root. The thing is that the github action passes user (that's how I got github action working with my container). The action also passes HOME env var which is /github/home (valid folder). Since HOME is not passed to cargo, cargo looks at /etc/passwd. However, when docker passes user via --user that user is "homeless", it doesn't exist in /etc/passwd. Therefore, we need HOME env var for cargo to work.

@mvukov
Copy link
Contributor Author

mvukov commented Aug 17, 2024

@illicitonion @UebelAndre PTAL.

2 similar comments
@mvukov
Copy link
Contributor Author

mvukov commented Sep 1, 2024

@illicitonion @UebelAndre PTAL.

@mvukov
Copy link
Contributor Author

mvukov commented Sep 21, 2024

@illicitonion @UebelAndre PTAL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

crate_universe: "Error: Failed to query cargo version"
2 participants