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

crate_universe: "Error: Failed to query cargo version" #2662

Closed
mvukov opened this issue May 18, 2024 · 1 comment · May be fixed by #2698
Closed

crate_universe: "Error: Failed to query cargo version" #2662

mvukov opened this issue May 18, 2024 · 1 comment · May be fixed by #2698

Comments

@mvukov
Copy link
Contributor

mvukov commented May 18, 2024

Computing main repo mapping: 
INFO: Repository rules_ros2_crate_index instantiated at:
  /__w/rules_ros2/rules_ros2/examples/WORKSPACE:68:19: in <toplevel>
  /github/home/.cache/bazel/_bazel_runner/0f445b8fd31f922fe083ae63ab47da39/external/com_github_mvukov_rules_ros2/repositories/rust_setup_stage_3.bzl:4:22: in rust_setup_stage_3
Repository rule crates_repository defined at:
  /github/home/.cache/bazel/_bazel_runner/0f445b8fd31f922fe083ae63ab47da39/external/rules_rust/crate_universe/private/crates_repository.bzl:107:36: in <toplevel>
ERROR: An error occurred during the fetch of repository 'rules_ros2_crate_index':
   Traceback (most recent call last):
	File "/github/home/.cache/bazel/_bazel_runner/0f445b8fd31f922fe083ae63ab47da39/external/rules_rust/crate_universe/private/crates_repository.bzl", line 45, column 28, in _crates_repository_impl
		repin = determine_repin(
	File "/github/home/.cache/bazel/_bazel_runner/0f445b8fd31f922fe083ae63ab47da39/external/rules_rust/crate_universe/private/generate_utils.bzl", line 395, column 21, in determine_repin
		result = execute(
	File "/github/home/.cache/bazel/_bazel_runner/0f445b8fd31f922fe083ae63ab47da39/external/rules_rust/crate_universe/private/common_utils.bzl", line 54, column 13, in execute
		fail(_EXECUTE_ERROR_MESSAGE.format(
Error in fail: Command [/github/home/.cache/bazel/_bazel_runner/0f445b8fd31f922fe083ae63ab47da39/external/rules_ros2_crate_index/cargo-bazel, "query", "--lockfile", /github/home/.cache/bazel/_bazel_runner/0f445b8fd31f922fe083ae63ab47da39/external/com_github_mvukov_rules_ros2/repositories/rust/Cargo.Bazel.lock, "--config", /github/home/.cache/bazel/_bazel_runner/0f445b8fd31f922fe083ae63ab47da39/external/rules_ros2_crate_index/cargo-bazel.json, "--splicing-manifest", /github/home/.cache/bazel/_bazel_runner/0f445b8fd31f922fe083ae63ab47da39/external/rules_ros2_crate_index/splicing_manifest.json, "--cargo", /github/home/.cache/bazel/_bazel_runner/0f445b8fd31f922fe083ae63ab47da39/external/rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/bin/cargo, "--rustc", /github/home/.cache/bazel/_bazel_runner/0f445b8fd31f922fe083ae63ab47da39/external/rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/bin/rustc] failed with exit code 1.
STDOUT ------------------------------------------------------------------------

STDERR ------------------------------------------------------------------------

error: Cargo couldn't find your home directory. This probably means that $HOME was not set.

Error: Failed to query cargo version

ERROR: /__w/rules_ros2/rules_ros2/examples/WORKSPACE:68:19: fetching crates_repository rule //external:rules_ros2_crate_index: Traceback (most recent call last):
	File "/github/home/.cache/bazel/_bazel_runner/0f445b8fd31f922fe083ae63ab47da39/external/rules_rust/crate_universe/private/crates_repository.bzl", line 45, column 28, in _crates_repository_impl
		repin = determine_repin(
	File "/github/home/.cache/bazel/_bazel_runner/0f445b8fd31f922fe083ae63ab47da39/external/rules_rust/crate_universe/private/generate_utils.bzl", line 395, column 21, in determine_repin
		result = execute(
	File "/github/home/.cache/bazel/_bazel_runner/0f445b8fd31f922fe083ae63ab47da39/external/rules_rust/crate_universe/private/common_utils.bzl", line 54, column 13, in execute
		fail(_EXECUTE_ERROR_MESSAGE.format(
Error in fail: Command [/github/home/.cache/bazel/_bazel_runner/0f445b8fd31f922fe083ae63ab47da39/external/rules_ros2_crate_index/cargo-bazel, "query", "--lockfile", /github/home/.cache/bazel/_bazel_runner/0f445b8fd31f922fe083ae63ab47da39/external/com_github_mvukov_rules_ros2/repositories/rust/Cargo.Bazel.lock, "--config", /github/home/.cache/bazel/_bazel_runner/0f445b8fd31f922fe083ae63ab47da39/external/rules_ros2_crate_index/cargo-bazel.json, "--splicing-manifest", /github/home/.cache/bazel/_bazel_runner/0f445b8fd31f922fe083ae63ab47da39/external/rules_ros2_crate_index/splicing_manifest.json, "--cargo", /github/home/.cache/bazel/_bazel_runner/0f445b8fd31f922fe083ae63ab47da39/external/rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/bin/cargo, "--rustc", /github/home/.cache/bazel/_bazel_runner/0f445b8fd31f922fe083ae63ab47da39/external/rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/bin/rustc] failed with exit code 1.
STDOUT ------------------------------------------------------------------------

STDERR ------------------------------------------------------------------------

error: Cargo couldn't find your home directory. This probably means that $HOME was not set.

Error: Failed to query cargo version

ERROR: Error computing the main repository mapping: no such package '@@rules_ros2_crate_index//': Command [/github/home/.cache/bazel/_bazel_runner/0f445b8fd31f922fe083ae63ab47da39/external/rules_ros2_crate_index/cargo-bazel, "query", "--lockfile", /github/home/.cache/bazel/_bazel_runner/0f445b8fd31f922fe083ae63ab47da39/external/com_github_mvukov_rules_ros2/repositories/rust/Cargo.Bazel.lock, "--config", /github/home/.cache/bazel/_bazel_runner/0f445b8fd31f922fe083ae63ab47da39/external/rules_ros2_crate_index/cargo-bazel.json, "--splicing-manifest", /github/home/.cache/bazel/_bazel_runner/0f445b8fd31f922fe083ae63ab47da39/external/rules_ros2_crate_index/splicing_manifest.json, "--cargo", /github/home/.cache/bazel/_bazel_runner/0f445b8fd31f922fe083ae63ab47da39/external/rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/bin/cargo, "--rustc", /github/home/.cache/bazel/_bazel_runner/0f445b8fd31f922fe083ae63ab47da39/external/rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools/bin/rustc] failed with exit code 1.
STDOUT ------------------------------------------------------------------------

STDERR ------------------------------------------------------------------------

error: Cargo couldn't find your home directory. This probably means that $HOME was not set.

Error: Failed to query cargo version

from https://github.com/mvukov/rules_ros2/actions/runs/9140229502/job/25133348788#step:5:74

I am new to Rust and this ruleset, don't know how to approach this. I tried defining HOME env var, but that didn't help, I got the same message.

My crate_universe setup is as in https://github.com/mvukov/rules_ros2/pull/316/files#diff-203680549cad884425809b6ac45297d81d082167f3caedabe80e630b576799b2R4.

BTW, the CI setup uses a custom image, as in https://github.com/mvukov/rules_ros2/blob/main/.github/workflows/main.yml#L51, the Dockerfile is https://github.com/mvukov/bazel_builder/blob/main/Dockerfile.

@illicitonion
Copy link
Collaborator

I tried running in your docker container and it looks like you're running as used builder, but $HOME is set to /root which builder doesn't have permission to read.

When I ran export HOME=/home/builder things started to work.

@illicitonion illicitonion closed this as not planned Won't fix, can't repro, duplicate, stale Jun 6, 2024
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 a pull request may close this issue.

2 participants