-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Support for filtering extension catalog returned from a registry by offerings #34516
base: main
Are you sure you want to change the base?
Conversation
offering names configured in platform member extension catalogs
Although I don't not very fond of the term |
|
This way we can add any kind of metadata matching? |
Not sure what you mean @maxandersen. Extension matching isn't touched by this PR. Only the "origins" are, i.e. here we are allowing users to control the BOMs in which to look for extensions. |
I'm just not fond of coupling it that hard to boms. Would have been nice to express things like redhat-support: "supported" or other extension level criterias. If we don't have that we 100% are tied to BOM granularity. |
There are two things that end up in projects: BOMs and extension artifacts as dependencies. Which means whatever way we choose we will be looking for both types of things to add to projects. We could let "offerings" in the extension metadata drive BOM imports. Although, from the BOM perspective, it'd be the same, we might even consider collecting the "offering" metadata from all the extensions at the BOM generation time and recording the summary in the catalog to be able to check quickly whether a given BOM is a part of a specific offering. In which case it will look exactly as in this PR. |
Also we do have "redhat-support: supported" already at extension level. Could you elaborate further what you are think of? |
Btw should it be "redhat-offerings" to be consistent in approach to "*-support" ? |
I see it as a general purpose feature not specific to RH. |
@@ -20,4 +20,6 @@ public interface Constants { | |||
String JSON = "json"; | |||
|
|||
String LAST_UPDATED = "last-updated"; | |||
|
|||
String OFFERINGS = "offerings"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we care about the hardcoded key? Could it not be any key in metadata?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the same reason we have other "keys" for other values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you imagine it working otherwise?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That we don't hard code the key and make it wherever users put in their config?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would still have to be under some key, which one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct - a recent case for example with microsft and azure extensions - they want to be able to express they support the extension but we would not want that to be mingled in with redhat's own notion of support.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would Azure re-publish RHBQ?
The example you gave is exactly hardcoding of a support provider-specific keys in both: json model and implementation of the tools handling those keys.
I don't see it as a good but a bad design decision.
It makes it impossible to implement non-vendor-specific tools that could display all support options.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They know that *-support is for support and they be grouped that way.
If they were all in one key called support you would instead have to prefix every value with I.e. redhat.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually didn't realize we used property name expressions to represent categories. It would have been cleaner to have e.g. support
as a parent and then nested support provider key.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes but we Also wanted it to possible to capture in a hashmap and not have to repeatedly change the typed apis across different versions.
Failing Jobs - Building 3e66f64
Failures⚙️ JVM Tests - JDK 19 #- Failing: extensions/reactive-pg-client/deployment
! Skipped: extensions/hibernate-reactive/deployment extensions/panache/hibernate-reactive-panache-common/deployment extensions/panache/hibernate-reactive-panache-kotlin/deployment and 14 more 📦 extensions/reactive-pg-client/deployment✖ |
private static Map<ArtifactKey, Set<ArtifactCoords>> toExtensionMap(ExtensionCatalog catalog) { | ||
final Map<ArtifactKey, Set<ArtifactCoords>> extensionMap = new HashMap<>(catalog.getExtensions().size()); | ||
for (Extension e : catalog.getExtensions()) { | ||
final Set<ArtifactCoords> boms = new HashSet<>(e.getOrigins().size()); | ||
for (ExtensionOrigin o : e.getOrigins()) { | ||
boms.add(o.getBom()); | ||
} | ||
extensionMap.put(e.getArtifact().getKey(), boms); | ||
} | ||
return extensionMap; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be useful as an utility method inside ExtensionCatalog
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, the test class name has an extra r
, just noticed 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is also the possibility of writing it using Streams, but the actual is okay:
return catalog.getExtensions().stream()
.collect(Collectors.toMap(
e -> e.getArtifact().getKey(),
e -> e.getOrigins().stream().map(ExtensionOrigin::getBom).collect(Collectors.toUnmodifiableSet()))
);
Yes. Thus why limit it and not allow for specialization? |
|
This is based on the assumption that platform member extension catalogs may include
offerings
metadata in their extension catalogs, that would be a list of offering names they are a part of.For example, a member extension catalog could look like:
and the
.quarkus/config.yaml
could be configured as