-
Notifications
You must be signed in to change notification settings - Fork 11
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
Add support for --registry
and --index
parameters
#15
Comments
I'm not familiar with alternative registries, but implementing version resolution as currently done with crates.io will not be possible without an easy way to query all available versions. This might be possible with sparse indexes, but not all registries support them, and even then it will require parsing the index configuration and registry configuration. For now, the best option is - as you suggested - to support only exact version requirements. I'll try to find some time to implement this in the next few days. If supporting version wildcards is a requirement for some use cases, you can always use a more generic caching action like the awesome |
Hey @Veetaha, I've implemented this in #18. Can you test if everything works for you before I merge it? You can use the PR's branch like this: - uses: baptiste0928/cargo-install@feat/custom-registry
with:
crate: my-awesome-crate
version: 1.0.0 # exact version, except if using sparse index
# index or registry parameters Let me know if it works or if run into any issue. |
Hey, I gave it a test run with the following setup (I redacted the names, since it uses a private registry): uses: baptiste0928/cargo-install@b3ea78257dd2498a1656a5faa4aabbff8e287fd1
with:
args: --bin bin-name
crate: package-name
index: https://dl.cloudsmith.io/basic/org-name/repo-name/cargo/index.git This failed with the following output
Unfortunately, we don't use a sparse index due to the lack of support for auth (rust-lang/cargo#10474). Then I tried specifying an exact version and it worked uses: baptiste0928/cargo-install@b3ea78257dd2498a1656a5faa4aabbff8e287fd1
with:
args: --bin bin-name
crate: package-name
index: https://dl.cloudsmith.io/basic/org-name/repo-name/cargo/index.git
version: x.y.z
and caching works
But would it be possible to support the use case at the top where the version is not specified? Meaning it should install just the latest version? I suppose there will be a problem of setting the cache key since no version is known at this point? |
You're right, the cache key needs the exact version being installed so it can restore from the cache and skip For registries that do not support the sparse index, it will need to clone the registry index locally to do version resolution. It can be implemented, but I don't have time to do it right now. I'm open to contributions if you (or anyone else reading this issue) would like to try to implement it. |
I don't think I have bandwidth for this contribution now, and it's not critical for me right now. I created a separate issue #19 targeted for supporting version wildcards so that we can close this one and have support for pinned package version installations, which is already good |
I published the new version with registry support (v2.2.0) |
For the use case when the installation happens from an alternative crates registry (e.g. a registry like Cloudsmith)
cargo install
provides a--registry
and--index
parameters.It should be simple to provide a way to pass a
registry
andindex
input parameters for the action. It's important that the values of these parameters is then used in the cache key.These parameters are mutually exclusive. The
--registry
is just a named index. I.e. the user has to have the following in the config.I am not sure how hard it will be to support version wildcards with alternative registries. I suppose listing the registry isn't included in the registry web API requirements. It would be at least something if only exact versions are supported for alternative registries
The text was updated successfully, but these errors were encountered: