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

Add third party registry support #945

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

Conversation

drewkett
Copy link

@drewkett drewkett commented Sep 25, 2024

This adds a --registry command line flag to the check release capabilities. The argument to the flag is the name of the registry to use to lookup the crates when using the default behavior or --baseline-version. If left unset, the default behavior remains of --checking crates.io.

This is intended to address #160.

I avoided trying to do any auto detection based on publish fields. That seemed like it might be less obvious from a behavior perspective to me, but maybe it would make things smoother for the user.

This adds a `--registry` command line flag to the check release
capabilities. The argument to the flag is the name of the registry to
use to lookup the crates when using the default behavior or
--baseline-version. If left unset, the default behavior remains of
--checking crates.io.
@@ -16,6 +16,8 @@ pub struct GlobalConfig {
stdout: AutoStream<Box<dyn Write + 'static>>,
stderr: AutoStream<Box<dyn Write + 'static>>,
feature_flags: HashSet<FeatureFlag>,
/// Registry name to look up crates in
registry: Option<String>,
Copy link
Author

Choose a reason for hiding this comment

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

I wasn't sure if this was the best place to stash the registry flag from the cli. It seems like its okay, but I can't say I did a deep dive of the code to fully understand all the components.

@drewkett
Copy link
Author

I haven't added any tests for this. I'm not sure what the easiest way to add tests for a third party registry. Do you have any ideas on that front?

I could wire up a test to basically just pass --registry crates.io to validate that the flag works in that case.

As far as third party registries, one thought I had was to setup a static file based registry with margo. That does require at least spinning up a local host based web server, but I think that wouldn't be too much trouble to make work.

Let me know what route you would prefer and some pointers on where exactly the tests should go.

@suaviloquence
Copy link
Contributor

As far as third party registries, one thought I had was to setup a static file based registry with margo. That does require at least spinning up a local host based web server, but I think that wouldn't be too much trouble to make work.

See also #879 for some discussion about using margo for testing.

@fujiapple852
Copy link

Rebased and reworked this PR against the latest main and also added an integration test: #1048

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.

3 participants