Skip to content

Handle ignored artifacts separately - #21440

Merged
vmuzikar merged 1 commit into
keycloak:mainfrom
mabartos:ignoredArtifacts
Sep 12, 2023
Merged

Handle ignored artifacts separately#21440
vmuzikar merged 1 commit into
keycloak:mainfrom
mabartos:ignoredArtifacts

Conversation

@mabartos

@mabartos mabartos commented Jul 4, 2023

Copy link
Copy Markdown
Member

Closes #22430
Follow-up of #20976

These changes separate the handling of the ignored artifacts from the property mapper for better manageability of ignored artifacts. As we can consider, we're gonna also exclude artifacts for various JDBC vendors and health/metrics based on the configuration. The property mapper handling would be pretty messy.

@mabartos
mabartos requested a review from a team July 4, 2023 16:03
@mabartos
mabartos requested review from a team as code owners July 4, 2023 16:03
@mabartos
mabartos marked this pull request as draft July 6, 2023 12:51
@mabartos
mabartos force-pushed the ignoredArtifacts branch 2 times, most recently from c184053 to 88cac68 Compare August 14, 2023 11:23
@mabartos
mabartos marked this pull request as ready for review August 14, 2023 11:23
@mabartos

Copy link
Copy Markdown
Member Author

@pedroigor @ahus1 Could you please check it?

I'm about to send another PRs similar to this: #22438

@mabartos

Copy link
Copy Markdown
Member Author

Sorry, one minor refactoring.

@ahus1 ahus1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm ok to proceed here. Still I'm concerned by the complexity we of the code we have here to make things work. It is a burden for future enhancements, still I don't know a better solution here.

Just approving, will give someone more familiar with Quarkus the change to review this as well.

@mabartos

Copy link
Copy Markdown
Member Author

@ahus1 Thanks. For this PR, it might look as it's more complicated than it should be, but it's the starting point for other PRs. I prefer to have it easily manageable. Modularized Keycloak is far away, so I think this approach is suitable for the stuff we want to achieve :))

@vmuzikar Could you please check it?

@mabartos
mabartos requested a review from vmuzikar August 15, 2023 08:19
@mabartos

Copy link
Copy Markdown
Member Author

@vmuzikar @pedroigor Any input on this?

@pedroigor pedroigor left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I also see a bit more complexity for no real benefit. You are basically moving the resolution of ignored artifacts to another place.

Don't you also need to update https://github.com/keycloak/keycloak/blob/main/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/cli/command/Build.java?

The way artifacts are ignored now after one of the latest changes we got from Quarkus, I think we don't even need the option transformer in ClassLoaderPropertyMappers, do we?

@vmuzikar vmuzikar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I also see a bit more complexity for no real benefit. You are basically moving the resolution of ignored artifacts to another place.

I agree there's no real benefit but it's a baseline for follow-ups:

@mabartos

Copy link
Copy Markdown
Member Author

@pedroigor Thanks for the review

I also see a bit more complexity for no real benefit. You are basically moving the resolution of ignored artifacts to another place.

As I mentioned, this baseline PR might look quite complex, but IMO, after providing all these changes within the follow-up PRs, the major complexity would be in the ClassLoader mapper. I think separating the logic behind it is reasonable.

Don't you also need to update https://github.com/keycloak/keycloak/blob/main/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/cli/command/Build.java?

AFAIK, there shouldn't be any changes necessary in the Build command as it works already with the transformed values in the property.

The way artifacts are ignored now after one of the latest changes we got from Quarkus, I think we don't even need the option transformer in ClassLoaderPropertyMappers, do we?

Can you point me to the changes we got from Quarkus? I'm probably not familiar with that as I still think the transformer is necessary there.

@mabartos mabartos self-assigned this Aug 24, 2023
@mabartos

Copy link
Copy Markdown
Member Author

@pedroigor Are you ok with this PR?

@ghost ghost added the flaky-test label Sep 5, 2023
@pedroigor

pedroigor commented Sep 5, 2023

Copy link
Copy Markdown
Contributor

@mabartos I'm not quite sure about the changes and how much they help to improve or make it simpler.

I'll leave it for @vmuzikar as he knows more about how this change will fit into your future plans.

@mabartos

mabartos commented Sep 5, 2023

Copy link
Copy Markdown
Member Author

@pedroigor What would be your suggestion for this? I consider the solution cleaner than handling all the logic in the ClassLoaderPropertyMappers. When you take a look at this follow-up PR #22443, you can see there are quite a lot of things we need to do.

@pedroigor

Copy link
Copy Markdown
Contributor

I don't have any proposal. That is why I'm not against it. I only think we have now more code rather than everything within the mapper.

In terms of testing, we can only catch if the ignored artifacts are correct if we actually run integration tests, as we have for FIPS and the new store. Some errors might happen only when loading classes at runtime.

@vmuzikar vmuzikar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, thanks @mabartos.

Comment on lines +81 to +95
private static final class Builder {
private final Set<String> finalIgnoredArtifacts;

public Builder() {
this.finalIgnoredArtifacts = new HashSet<>();
}

public Builder append(Set<String> ignoredArtifacts) {
finalIgnoredArtifacts.addAll(ignoredArtifacts);
return this;
}

public Set<String> build() {
return finalIgnoredArtifacts;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This feels to me like a bit overkill. ;) Could be easily replaced e.g. by Stream.of(...).flatMap(Collection::stream).collect(Collectors.toSet());. But not a blocker for me...

@vmuzikar
vmuzikar merged commit ebc9fae into keycloak:main Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handle ignored artifacts separately

4 participants