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

CLI registry clear-cache command #18467

Merged
merged 1 commit into from
Jul 13, 2021

Conversation

aloubyansky
Copy link
Member

@aloubyansky aloubyansky commented Jul 6, 2021

An attempt to add registry clear-cache CLI command to clear the local registry cache.

Other registry sub-commands could include:

  • list to list currently enabled registries;
  • add to add another registry to the devtools config;
  • remove to remove a registry from the config;
  • disable to temporarily disable a registry in the config;
  • enable to (re-)enable a registry in the config.

A config file could be either a global (in the user home dir) or in the project dir.

@quarkus-bot quarkus-bot bot added area/cli Related to quarkus cli (not maven/gradle/etc.) area/devtools Issues/PR related to maven, gradle, platform and cli tooling/plugins area/platform Issues related to definition and interaction with Quarkus Platform labels Jul 6, 2021
@maxandersen
Copy link
Contributor

A config file could be either a global (in the user home dir) or in the project dir.

what does "in project dir" means in a multimodule project ?

@maxandersen
Copy link
Contributor

btw. +1 on having registry command for add/remove etc. but shouldn't clear-cache more be something doable by a flag on a command that uses the registry ?

i.e. quarkus create --clean-registry-cache or similar ?

@aloubyansky
Copy link
Member Author

A config file could be either a global (in the user home dir) or in the project dir.

what does "in project dir" means in a multimodule project ?

The root project dir.

@aloubyansky
Copy link
Member Author

aloubyansky commented Jul 7, 2021

btw. +1 on having registry command for add/remove etc. but shouldn't clear-cache more be something doable by a flag on a command that uses the registry ?

i.e. quarkus create --clean-registry-cache or similar ?

I'd personally prefer a separate command. It could have more arguments, e.g. clear cache for a specific registry, clear cache for platform catalog only, for a particular stream, etc. The impl in this PR is cleaning everything.

@aloubyansky
Copy link
Member Author

[aloubyansky@localhost test]$ qs registry
Available Quarkus extension registries:
registry.quarkus.io
[aloubyansky@localhost test]$ qs registry list
Available Quarkus extension registries:
registry.quarkus.io
[aloubyansky@localhost test]$ qs registry --refresh
Refreshing the local extension catalog cache of registry.quarkus.io
Available Quarkus extension registries:
registry.quarkus.io
[aloubyansky@localhost test]$ qs registry list --refresh
Refreshing the local extension catalog cache of registry.quarkus.io
Available Quarkus extension registries:
registry.quarkus.io

With debug enabled in the .quarkus/config.yaml

[aloubyansky@localhost test]$ qs registry list --refresh
Refreshing the local extension catalog cache of registry.quarkus.io
Downloading from registry.quarkus.io: https://registry.quarkus.io/maven/io/quarkus/registry/quarkus-registry-descriptor/1.0-SNAPSHOT/maven-metadata.xml
Downloaded from registry.quarkus.io: https://registry.quarkus.io/maven/io/quarkus/registry/quarkus-registry-descriptor/1.0-SNAPSHOT/maven-metadata.xml (736 B at 942 B/s)
Downloading from registry.quarkus.io: https://registry.quarkus.io/maven/io/quarkus/registry/quarkus-registry-descriptor/1.0-SNAPSHOT/quarkus-registry-descriptor-1.0-20210713.112505-1.json
Downloaded from registry.quarkus.io: https://registry.quarkus.io/maven/io/quarkus/registry/quarkus-registry-descriptor/1.0-SNAPSHOT/quarkus-registry-descriptor-1.0-20210713.112505-1.json (470 B at 2.1 kB/s)
Available Quarkus extension registries:
registry.quarkus.io

}

output.info("Available Quarkus extension registries:");
final RegistriesConfig config = RegistriesConfigLocator.resolveConfig();
Copy link
Contributor

Choose a reason for hiding this comment

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

Should the BaseRegistryCommand also bring in the RegistryClient mixin? And shouldn't that mixin be used to find the catalog resolver so that it is consistent?

Copy link
Member Author

Choose a reason for hiding this comment

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

The registry command isn't actually using the registry client. At least at this point. It's basically a config reading/editing command.

Copy link
Contributor

@ebullient ebullient Jul 13, 2021

Choose a reason for hiding this comment

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

QuarkusProjectHelper.getCatalogResolver().clearRegistryCache(); -- that is what the RegistryClient currently encapsulates (discovery of CatalogResolver based on what it knows about the project and/or global config)

Copy link
Member Author

Choose a reason for hiding this comment

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

Perhaps, once we enable the registry client by default that could make more sense. While all of this is related to the registry client, the RegistryClientMixin is currently used to provide the --registry-client option and QuarkusProject with an ExtensionCatalog. Atm, none of that is relevant for the registry command.

Copy link
Contributor

@ebullient ebullient Jul 13, 2021

Choose a reason for hiding this comment

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

hmm. true. but would/should --refresh apply everywhere that the registry client is used? (this gets back to @maxandersen comment earlier/somewhere)

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure about that.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, refactored to add the --refresh option to the RegistryClientMixin.

@aloubyansky aloubyansky force-pushed the registry-clear-cache branch 2 times, most recently from 1b3a408 to d6ffeba Compare July 13, 2021 16:33
@quarkus-bot
Copy link

quarkus-bot bot commented Jul 13, 2021

This workflow status is outdated as a new workflow run has been triggered.

🚫 This workflow run has been cancelled.

Failing Jobs - Building 1b3a408

⚠️ Artifacts of the workflow run were not available thus the report misses some details.

Status Name Step Test failures Logs Raw logs
Initial JDK 11 Build ⚠️ Check → Logs Raw logs
Attach pull request number ⚠️ Check → Logs Raw logs
CI Sanity Check ⚠️ Check → Logs Raw logs

@quarkus-bot
Copy link

quarkus-bot bot commented Jul 13, 2021

This workflow status is outdated as a new workflow run has been triggered.

🚫 This workflow run has been cancelled.

Failing Jobs - Building d6ffeba

⚠️ Artifacts of the workflow run were not available thus the report misses some details.

Status Name Step Test failures Logs Raw logs
Initial JDK 11 Build ⚠️ Check → Logs Raw logs
Attach pull request number ⚠️ Check → Logs Raw logs
CI Sanity Check ⚠️ Check → Logs Raw logs

@aloubyansky aloubyansky merged commit 6629d18 into quarkusio:main Jul 13, 2021
@quarkus-bot quarkus-bot bot added this to the 2.1 - main milestone Jul 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cli Related to quarkus cli (not maven/gradle/etc.) area/devtools Issues/PR related to maven, gradle, platform and cli tooling/plugins area/platform Issues related to definition and interaction with Quarkus Platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants