-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Conditionally enable and disable CLI options #25333
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
Conversation
42e1dee to
df32702
Compare
|
CC @shawkins |
5a8b192 to
0d9a40b
Compare
0d9a40b to
977e1f4
Compare
ba4a136 to
1f34a05
Compare
ghost
left a comment
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.
Unreported flaky test detected, please review
Unreported flaky test detectedIf the below flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR. org.keycloak.testsuite.adapter.servlet.OfflineServletsAdapterTest#testServlet |
3781ac6 to
18702b9
Compare
18702b9 to
941a406
Compare
|
@shawkins This PR should be ready for review. I'd be happy if you'd have a chance to look at it. I still need to finish some additional things:
|
shawkins
left a comment
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.
Just a couple of nits in review comments.
If I understand correctly this will handle enablement as long as it's conditional on properties that are set prior to parsing - which most are. But anything that is set as a side effect of the command, such as the StartDev forceDevProfile that won't be known. Is that correct?
I haven't had a chance to run this, but was wondering will this make both help and help-all conditional? That is if you have something like --log=file --help-all will you see any of the file or gelf options?
...runtime/src/main/java/org/keycloak/quarkus/runtime/configuration/mappers/PropertyMapper.java
Outdated
Show resolved
Hide resolved
...src/main/java/org/keycloak/quarkus/runtime/configuration/mappers/LoggingPropertyMappers.java
Outdated
Show resolved
Hide resolved
quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/cli/Picocli.java
Outdated
Show resolved
Hide resolved
|
@shawkins Thanks for the review! :))
It should handle such situations, but I'll write a test for it and double-check it. I haven't had a chance to run this, but was wondering will this make both help and help-all conditional? That is if you have something like --log=file --help-all will you see any of the file or gelf options?
|
98708fd to
b7eefce
Compare
vmuzikar
left a comment
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.
@mabartos Thanks for the PR! The general approach LGTM, although I haven't yet reviewed line-by-line.
I think we still need to tackle one more case here: when some option has multiple versions, essentially when we add an option with the same key multiple times. I think it doesn't work yet with this version of the PR, right? This will be required for the hostname stuff when some of the options will have new meaning (descriptions, potentially transformers etc.).
Could you also please rebase to incorporate changes from now merged #24811?
b7eefce to
942d51b
Compare
|
Rebased and added test execution order for the
@vmuzikar Yep, I'm aware of it. But the code should be cleaner now and also catch some minor issues.
There should not be any performance degradation even for the startup; I resolved that one I mentioned previously. I made only a small perf analysis and nothing that could impact performance :)) The only thing that has changed is that the initialization of Profile(quite resource-consuming) is done earlier. I can double-check it. @shawkins Could you please review the last commit? Thanks! |
|
Created follow-up tasks and addressed in the parent issue (#13113): |
shawkins
left a comment
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.
@mabartos still LGTM. One minor after thought is at what point could or should we be able to clear some of the static state - how big of a footprint does the parsed command have?
36c031d to
e0a1e08
Compare
|
Rebased and resolved conflicts. |
shawkins
left a comment
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.
still looks good!
@shawkins Sorry, it seems I've missed your comment. I assume you mean the static object However, as the GC was executed before the heap dump, all other @vmuzikar May I ask you for a next round of review? Thanks |
vmuzikar
left a comment
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.
@mabartos LGTM, fantastic work!
I'll rebase it for the last time to be sure we get accurate test results and enable auto-merge.
quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/cli/ShortErrorMessageHandler.java
Outdated
Show resolved
Hide resolved
Closes keycloak#13113 Signed-off-by: Martin Bartoš <[email protected]>
Signed-off-by: Martin Bartoš <[email protected]>
Fixes keycloak#26515 Signed-off-by: Martin Bartoš <[email protected]>
Signed-off-by: Martin Bartoš <[email protected]>
|
@shawkins @radcortez @vmuzikar Thanks for the reviews! :) |
Closes #13113
The intention behind the lazy evaluation of
isEnabled()for property mappers is to have the possibility to enable/disable it based on the current configuration with no need to keep the order of property mapper groups.In that case, we can enable/disable options based on values of other options as f.e. this is enabled only when the property kc.xyz=gold, etc.