-
Notifications
You must be signed in to change notification settings - Fork 435
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
Usage of sparse registries not working #1854
Comments
I have a draft PR locally to support this, but need to wait on some internal approvals before I can publish it - will try to get this out soon |
See #1857 - please give it a go and see if it works for you! |
@illicitonion Thanks for the quick feedback. I'll check it now. Need to reproduce the github actions first to build the release |
See https://github.com/bazelbuild/rules_rust/blob/main/crate_universe/DEVELOPMENT.md for instructions for how to use a custom cargo-bazel binary. (You'll need to be configuring your WORKSPACE to use 1.68.0 or newer to use the feature) |
Thanks for the pointers 👍 |
Ok, managed to build and test it. However it fails with another error.
[net]
git-fetch-with-cli = true
[registry]
default = "artifactory"
[source.crates-io]
replace-with = "artifactory"
[registries.artifactory]
index = "sparse+https://my.artifactory.sub.company.net/artifactory/api/cargo/external-index-crates-io-remote/index/"
token = ""
[source.artifactory]
registry = "sparse+https://my.artifactory.sub.company.net/artifactory/api/cargo/external-index-crates-io-remote/index/" |
Using rules_rust at HEAD of your branch:
I checked that the newly built cargo-bazel is used:
And the rust toolchain version that i configured in my
I merged your fork-branch with Also when using rules_rust with release |
Just to check, is this saying |
In terms of debugging the issue, I would expect this block to be getting hit for your index: https://github.com/bazelbuild/rules_rust/pull/1857/files#diff-8e0f53a4c6423a010464dacf0b46519b5e50994ae4a2bafc8c1dd0898532609eR303-R305 (because If you could do some debugging around the |
I ran this to test the execution (Workspace bazelrc only contains the beta channel and output base config hence the --nohome_rc)
I tested with the released tldr; |
Hm, true... |
(Also, I don't actually have a custom sparse index to test against, so I've only tested the first branch there, the "override crates.io to use sparse", so... You're running into some completely untested code, sorry!) |
Had a bit of trouble with debugging so far. For some reason the LockGenerator was complaining about the
Could not get around this without 'building' with bazel so far. Regarding the url.starts_with; i saw in the debugger that the |
I checked the generated lock file in the temporary manifest_dir. And it contains the github.com/rust-lang/crates.io-index urls.
Compared to a regular
|
I looked a bit futher. I tracked the creation of the initial Cargo.toml and the subsequent calls to cargo. The original Cargo.toml contains the dependencies as declared in the Workspace. I did the same with If i then modify the I suppose the error with the url is just a followup one. When doing this manual modification the Lockfile fails to be loaded with:
|
I gave it another go @illicitonion, I still have some Thanks!! |
@illicitonion Just wanted to followup after i solved my artifactory access issues and after the 0.19.0 release was cut. My testing setup: #!/bin/bash
set -euxo pipefail
# Should fail to check that no connection to outside can be made
curl -XGET -L https://index.crates.io || true
curl -XGET -L https://crates.io || true
curl -XGET -L https://github.com/ || true
echo '' > Cargo.lock
echo '' > Cargo.Bazel.lock
bazel shutdown
bazel clean --expunge
CARGO_BAZEL_REPIN=true bazel sync --only=crate_index
bazel run //parse_command_lines My Cargo config (also setup along https://www.jfrog.com/confluence/display/JFROG/Cargo+Package+Registry#CargoPackageRegistry-SettingUpCargoIndexingUsingSparseIndexing) [net]
git-fetch-with-cli = true
# Makes artifactory the default registry and saves passing --registry parameter
[registry]
default = "artifactory"
[source.crates-io]
replace-with = "artifactory"
[registries.artifactory]
index = "sparse+https://my.artifactory.instance.net/artifactory/api/cargo/external-index-crates-io-remote/index/"
token = ""
[source.artifactory]
registry = "sparse+https://my.artifactory.instance.net/artifactory/api/cargo/external-index-crates-io-remote/index/" |
Hurrah, I'm glad! Thanks for circling back! |
https://blog.rust-lang.org/2022/06/22/sparse-registry-testing.html introduced usage of a sparse registry.
The feature is stablized and will become available in the stable channel in a few days:
crate-index is used here to parse the config that would hold the configuration:
However this fails to parse with:
There is already an issue i could find since the feature is not yet supported by rust-crates-index:
frewsxcv/rust-crates-index#87
The text was updated successfully, but these errors were encountered: