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

rules_rust 0.57.1 cargo login is ineffective #3261

Open
aignas opened this issue Feb 12, 2025 · 4 comments
Open

rules_rust 0.57.1 cargo login is ineffective #3261

aignas opened this issue Feb 12, 2025 · 4 comments

Comments

@aignas
Copy link

aignas commented Feb 12, 2025

I have a very simple project that works with 0.56 but not with 0.57.1 and I found the offending PR.

Error msg:

  failed to query replaced source registry `crates-io`

Caused by:
  no token found for `artifactory`, please run `cargo login --registry artifactory`
  or use environment variable CARGO_REGISTRIES_ARTIFACTORY_TOKEN

The MODULE.bazel:

bazel_dep(name = "rules_rust", version = "0.57.1")
bazel_dep(name = "platforms", version = "0.0.11")
git_override(
    module_name = "rules_rust",
    # commit = "5e904830", # [x] Updated crate_universe bzlmod to support skipping splicing (#3148) is breaking us.
    commit = "1d0fe8a1", # [o] Replace symlinks in the output of cargo build scripts (#3067)
    remote = "https://github.com/bazelbuild/rules_rust.git",
)

# dev dependencies
bazel_dep(name = "toolchains_musl", version = "0.1.20", dev_dependency = True)


rust = use_extension("@rules_rust//rust:extensions.bzl", "rust")
rust.toolchain(
    edition = "2021",
    versions = ["1.81.0"],
    extra_target_triples = ["x86_64-unknown-linux-musl"],
)

crate = use_extension("@rules_rust//crate_universe:extensions.bzl", "crate")

crate.from_cargo(
    name = "crates",
    cargo_lockfile = "//:Cargo.lock",
    cargo_config = "//:.cargo/config.toml",
    manifests = [
        "//my_project:Cargo.toml"
    ],
)
use_repo(crate, "crates")

toolchains_musl = use_extension("@toolchains_musl//:toolchains_musl.bzl", "toolchains_musl", dev_dependency = True)
toolchains_musl.config()

I am running cargo login after the error message, but continue getting the same error.

@ericmcbride
Copy link
Contributor

Be nice to run something like this for testing in the future running a private crates io locally so we can ensure major changes do not break private crates repositories

@UebelAndre
Copy link
Collaborator

Sorry for the breakage! Definitely having some testing would help. Ideally something that doesn't need as much infrastructure though. I'd be happy to review a PR from anyone with a repro case and help stand up some regression test!

@aignas
Copy link
Author

aignas commented Feb 18, 2025

Just a heads up that I personally don't plan to work on this as all my bazel time allowance is consumed by rules_python. But if anyone wants me to test a fix, I would be more than willing to.

@ericmcbride
Copy link
Contributor

ericmcbride commented Feb 19, 2025

I ended up digging thru the code and debugging and the culprit seems to be the isolated = true default argument. If i run

CARGO_BAZEL_ISOLATED=false bazel build //...

It seems to work. @aignas can you confirm this fixes your issue?

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

No branches or pull requests

3 participants