parent
69466777c0
commit
c9d93019c2
16 changed files with 17 additions and 89 deletions
|
@ -78,3 +78,11 @@ New code example:
|
|||
When running on OpenShift, with ingress enabled, and with the spec.ingress.classname set to openshift-default, you may leave the spec.hostname.hostname unpopulated in the Keycloak CR.
|
||||
The operator will assign a default hostname to the stored version of the CR similar to what would be created by an OpenShift Route without an explicit host - that is ingress-namespace.appsDomain
|
||||
If the appsDomain changes, or should you need a different hostname for any reason, then update the Keycloak CR.
|
||||
|
||||
= The deprecated `auto-build` CLI option was removed
|
||||
|
||||
The `auto-build` CLI option has been marked as deprecated for a long time.
|
||||
In this release, it was completely removed, and it is no longer supported.
|
||||
|
||||
When executing the `start` command, the server is automatically built based on the configuration.
|
||||
In order to prevent this behavior, set the `--optimized` flag.
|
|
@ -23,12 +23,11 @@ import static org.keycloak.quarkus.runtime.Environment.getProfileOrDefault;
|
|||
import static org.keycloak.quarkus.runtime.Environment.isImportExportMode;
|
||||
import static org.keycloak.quarkus.runtime.Environment.isTestLaunchMode;
|
||||
import static org.keycloak.quarkus.runtime.cli.Picocli.parseAndRun;
|
||||
import static org.keycloak.quarkus.runtime.cli.command.AbstractStartCommand.*;
|
||||
import static org.keycloak.quarkus.runtime.cli.command.AbstractStartCommand.OPTIMIZED_BUILD_OPTION_LONG;
|
||||
import static org.keycloak.quarkus.runtime.cli.command.Start.isDevProfileNotAllowed;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
|
@ -74,7 +73,7 @@ public class KeycloakMain implements QuarkusApplication {
|
|||
ExecutionExceptionHandler errorHandler = new ExecutionExceptionHandler();
|
||||
PrintWriter errStream = new PrintWriter(System.err, true);
|
||||
|
||||
if (isDevProfileNotAllowed(Arrays.asList(args))) {
|
||||
if (isDevProfileNotAllowed()) {
|
||||
errorHandler.error(errStream, Messages.devProfileNotAllowedError(Start.NAME), null);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -21,8 +21,6 @@ import static java.util.Optional.ofNullable;
|
|||
import static java.util.stream.StreamSupport.stream;
|
||||
import static org.keycloak.quarkus.runtime.Environment.isRebuildCheck;
|
||||
import static org.keycloak.quarkus.runtime.Environment.isRebuilt;
|
||||
import static org.keycloak.quarkus.runtime.cli.command.AbstractStartCommand.*;
|
||||
import static org.keycloak.quarkus.runtime.cli.command.AbstractStartCommand.AUTO_BUILD_OPTION_LONG;
|
||||
import static org.keycloak.quarkus.runtime.cli.command.AbstractStartCommand.OPTIMIZED_BUILD_OPTION_LONG;
|
||||
import static org.keycloak.quarkus.runtime.configuration.ConfigArgsConfigSource.parseConfigArgs;
|
||||
import static org.keycloak.quarkus.runtime.configuration.Configuration.OPTION_PART_SEPARATOR;
|
||||
|
@ -57,7 +55,6 @@ import org.eclipse.microprofile.config.spi.ConfigSource;
|
|||
import org.keycloak.config.MultiOption;
|
||||
import org.keycloak.config.OptionCategory;
|
||||
import org.keycloak.quarkus.runtime.cli.command.AbstractCommand;
|
||||
import org.keycloak.quarkus.runtime.cli.command.AbstractStartCommand;
|
||||
import org.keycloak.quarkus.runtime.cli.command.Build;
|
||||
import org.keycloak.quarkus.runtime.cli.command.ImportRealmMixin;
|
||||
import org.keycloak.quarkus.runtime.cli.command.Main;
|
||||
|
@ -527,10 +524,6 @@ public final class Picocli {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!isRebuildCheck() && (arg.startsWith(AbstractStartCommand.AUTO_BUILD_OPTION_SHORT) || arg.startsWith(AUTO_BUILD_OPTION_LONG))) {
|
||||
System.out.println(DEFAULT_WARN_MESSAGE_REPEATED_AUTO_BUILD_OPTION);
|
||||
}
|
||||
}
|
||||
|
||||
return args;
|
||||
|
@ -544,11 +537,6 @@ public final class Picocli {
|
|||
}
|
||||
|
||||
private static boolean isRuntimeOption(String arg) {
|
||||
// remove this once auto-build option is removed
|
||||
if (AUTO_BUILD_OPTION_LONG.equals(arg) || AUTO_BUILD_OPTION_SHORT.equals(arg)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return arg.startsWith(ImportRealmMixin.IMPORT_REALM);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,12 +23,7 @@ import org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler;
|
|||
import picocli.CommandLine;
|
||||
|
||||
public abstract class AbstractStartCommand extends AbstractCommand implements Runnable {
|
||||
|
||||
// remove this once auto-build is removed
|
||||
public static final String AUTO_BUILD_OPTION_LONG = "--auto-build";
|
||||
public static final String AUTO_BUILD_OPTION_SHORT = "-b";
|
||||
public static final String OPTIMIZED_BUILD_OPTION_LONG = "--optimized";
|
||||
public static final String DEFAULT_WARN_MESSAGE_REPEATED_AUTO_BUILD_OPTION = "WARNING: The '" + AUTO_BUILD_OPTION_LONG + "' option for 'start' command is DEPRECATED and no longer needed. When executing the '" + Start.NAME + "' command, a new server image is automatically built based on the configuration. If you want to disable this behavior and achieve an optimal startup time, use the '" + OPTIMIZED_BUILD_OPTION_LONG + "' option instead.";
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
package org.keycloak.quarkus.runtime.cli.command;
|
||||
|
||||
import static org.keycloak.quarkus.runtime.Environment.setProfile;
|
||||
import static org.keycloak.quarkus.runtime.cli.Picocli.NO_PARAM_LABEL;
|
||||
import static org.keycloak.quarkus.runtime.cli.command.AbstractStartCommand.OPTIMIZED_BUILD_OPTION_LONG;
|
||||
import static org.keycloak.quarkus.runtime.configuration.Configuration.getRawPersistedProperty;
|
||||
|
||||
|
@ -45,14 +44,6 @@ public final class Start extends AbstractStartCommand implements Runnable {
|
|||
|
||||
public static final String NAME = "start";
|
||||
|
||||
@CommandLine.Option(names = {AUTO_BUILD_OPTION_SHORT, AUTO_BUILD_OPTION_LONG},
|
||||
description = "(Deprecated) Automatically detects whether the server configuration changed and a new server image must be built" +
|
||||
" prior to starting the server. This option provides an alternative to manually running the '" + Build.NAME + "'" +
|
||||
" prior to starting the server. Use this configuration carefully in production as it might impact the startup time.",
|
||||
paramLabel = NO_PARAM_LABEL,
|
||||
order = 1)
|
||||
Boolean autoConfig;
|
||||
|
||||
@CommandLine.Mixin
|
||||
OptimizedMixin optimizedMixin;
|
||||
|
||||
|
@ -68,22 +59,18 @@ public final class Start extends AbstractStartCommand implements Runnable {
|
|||
}
|
||||
|
||||
private void devProfileNotAllowedError() {
|
||||
if (isDevProfileNotAllowed(spec.commandLine().getParseResult().expandedArgs())) {
|
||||
if (isDevProfileNotAllowed()) {
|
||||
executionError(spec.commandLine(), Messages.devProfileNotAllowedError(NAME));
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isDevProfileNotAllowed(List<String> currentCliArgs) {
|
||||
public static boolean isDevProfileNotAllowed() {
|
||||
Optional<String> currentProfile = Optional.ofNullable(Environment.getProfile());
|
||||
Optional<String> persistedProfile = getRawPersistedProperty("kc.profile");
|
||||
|
||||
setProfile(currentProfile.orElse(persistedProfile.orElse("prod")));
|
||||
|
||||
if (Environment.isDevProfile() && (!currentCliArgs.contains(AUTO_BUILD_OPTION_LONG) || !currentCliArgs.contains(AUTO_BUILD_OPTION_SHORT))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return Environment.isDevProfile();
|
||||
}
|
||||
|
||||
public List<OptionCategory> getOptionCategories() {
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.keycloak.quarkus.runtime.Environment;
|
|||
import picocli.CommandLine;
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.Mixin;
|
||||
import picocli.CommandLine.Option;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -39,9 +38,6 @@ public final class StartDev extends AbstractStartCommand implements Runnable {
|
|||
|
||||
public static final String NAME = "start-dev";
|
||||
|
||||
@Option(names = AUTO_BUILD_OPTION_LONG, hidden = true)
|
||||
Boolean autoConfig;
|
||||
|
||||
@Mixin
|
||||
HelpAllMixin helpAllMixin;
|
||||
|
||||
|
|
|
@ -19,8 +19,6 @@ package org.keycloak.quarkus.runtime.configuration;
|
|||
|
||||
import static java.util.Arrays.asList;
|
||||
import static org.keycloak.quarkus.runtime.cli.Picocli.ARG_SHORT_PREFIX;
|
||||
import static org.keycloak.quarkus.runtime.cli.command.AbstractStartCommand.AUTO_BUILD_OPTION_LONG;
|
||||
import static org.keycloak.quarkus.runtime.cli.command.AbstractStartCommand.AUTO_BUILD_OPTION_SHORT;
|
||||
import static org.keycloak.quarkus.runtime.configuration.Configuration.OPTION_PART_SEPARATOR_CHAR;
|
||||
import static org.keycloak.quarkus.runtime.configuration.MicroProfileConfigProvider.NS_KEYCLOAK_PREFIX;
|
||||
|
||||
|
@ -35,6 +33,7 @@ import io.smallrye.config.PropertiesConfigSource;
|
|||
|
||||
import org.keycloak.quarkus.runtime.configuration.mappers.PropertyMapper;
|
||||
import org.keycloak.quarkus.runtime.configuration.mappers.PropertyMappers;
|
||||
import org.keycloak.utils.StringUtil;
|
||||
|
||||
/**
|
||||
* <p>A configuration source for mapping configuration arguments to their corresponding properties so that they can be recognized
|
||||
|
@ -134,10 +133,10 @@ public class ConfigArgsConfigSource extends PropertiesConfigSource {
|
|||
|
||||
public static void parseConfigArgs(BiConsumer<String, String> cliArgConsumer) {
|
||||
// init here because the class might be loaded by CL without init
|
||||
List<String> ignoredArgs = asList("--verbose", "-v", "--help", "-h", AUTO_BUILD_OPTION_LONG, AUTO_BUILD_OPTION_SHORT);
|
||||
List<String> ignoredArgs = asList("--verbose", "-v", "--help", "-h");
|
||||
String rawArgs = getRawConfigArgs();
|
||||
|
||||
if (rawArgs == null || "".equals(rawArgs.trim())) {
|
||||
if (StringUtil.isBlank(rawArgs)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,11 +27,9 @@ import org.keycloak.it.junit5.extension.CLIResult;
|
|||
import org.keycloak.it.junit5.extension.DistributionTest;
|
||||
import org.keycloak.it.junit5.extension.RawDistOnly;
|
||||
import org.keycloak.it.utils.KeycloakDistribution;
|
||||
import org.keycloak.quarkus.runtime.cli.command.AbstractStartCommand;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.keycloak.quarkus.runtime.cli.command.AbstractStartCommand.DEFAULT_WARN_MESSAGE_REPEATED_AUTO_BUILD_OPTION;
|
||||
import static org.keycloak.quarkus.runtime.cli.command.AbstractStartCommand.OPTIMIZED_BUILD_OPTION_LONG;
|
||||
|
||||
@DistributionTest
|
||||
|
@ -40,7 +38,7 @@ import static org.keycloak.quarkus.runtime.cli.command.AbstractStartCommand.OPTI
|
|||
public class StartAutoBuildDistTest {
|
||||
|
||||
@Test
|
||||
@Launch({ "start", AbstractStartCommand.AUTO_BUILD_OPTION_LONG, "--http-enabled=true", "--hostname-strict=false" })
|
||||
@Launch({ "start", "--http-enabled=true", "--hostname-strict=false" })
|
||||
@Order(1)
|
||||
void testStartAutoBuild(LaunchResult result) {
|
||||
CLIResult cliResult = (CLIResult) result;
|
||||
|
@ -50,7 +48,6 @@ public class StartAutoBuildDistTest {
|
|||
cliResult.assertMessage(KeycloakDistribution.SCRIPT_CMD + " show-config");
|
||||
cliResult.assertMessage("Next time you run the server, just run:");
|
||||
cliResult.assertMessage(KeycloakDistribution.SCRIPT_CMD + " start " + OPTIMIZED_BUILD_OPTION_LONG + " --http-enabled=true --hostname-strict=false");
|
||||
cliResult.assertMessage(DEFAULT_WARN_MESSAGE_REPEATED_AUTO_BUILD_OPTION);
|
||||
assertFalse(cliResult.getOutput().contains("--cache"));
|
||||
cliResult.assertStarted();
|
||||
}
|
||||
|
@ -104,7 +101,6 @@ public class StartAutoBuildDistTest {
|
|||
@Order(7)
|
||||
void testShouldReAugWithoutAutoBuildOptionAfterDatabaseChange(LaunchResult result) {
|
||||
CLIResult cliResult = (CLIResult) result;
|
||||
cliResult.assertNoMessage(DEFAULT_WARN_MESSAGE_REPEATED_AUTO_BUILD_OPTION);
|
||||
cliResult.assertBuild();
|
||||
}
|
||||
|
||||
|
|
|
@ -8,11 +8,6 @@ Use this command to run the server in production.
|
|||
|
||||
Options:
|
||||
|
||||
-b, --auto-build (Deprecated) Automatically detects whether the server configuration changed
|
||||
and a new server image must be built prior to starting the server. This
|
||||
option provides an alternative to manually running the 'build' prior to
|
||||
starting the server. Use this configuration carefully in production as it
|
||||
might impact the startup time.
|
||||
-h, --help This help message.
|
||||
--help-all This same help message but with additional options.
|
||||
--import-realm Import realms during startup by reading any realm configuration file from the
|
||||
|
|
|
@ -8,11 +8,6 @@ Use this command to run the server in production.
|
|||
|
||||
Options:
|
||||
|
||||
-b, --auto-build (Deprecated) Automatically detects whether the server configuration changed
|
||||
and a new server image must be built prior to starting the server. This
|
||||
option provides an alternative to manually running the 'build' prior to
|
||||
starting the server. Use this configuration carefully in production as it
|
||||
might impact the startup time.
|
||||
-h, --help This help message.
|
||||
--help-all This same help message but with additional options.
|
||||
--import-realm Import realms during startup by reading any realm configuration file from the
|
||||
|
|
|
@ -8,11 +8,6 @@ Use this command to run the server in production.
|
|||
|
||||
Options:
|
||||
|
||||
-b, --auto-build (Deprecated) Automatically detects whether the server configuration changed
|
||||
and a new server image must be built prior to starting the server. This
|
||||
option provides an alternative to manually running the 'build' prior to
|
||||
starting the server. Use this configuration carefully in production as it
|
||||
might impact the startup time.
|
||||
-h, --help This help message.
|
||||
--help-all This same help message but with additional options.
|
||||
--import-realm Import realms during startup by reading any realm configuration file from the
|
||||
|
|
|
@ -8,11 +8,6 @@ Use this command to run the server in production.
|
|||
|
||||
Options:
|
||||
|
||||
-b, --auto-build (Deprecated) Automatically detects whether the server configuration changed
|
||||
and a new server image must be built prior to starting the server. This
|
||||
option provides an alternative to manually running the 'build' prior to
|
||||
starting the server. Use this configuration carefully in production as it
|
||||
might impact the startup time.
|
||||
-h, --help This help message.
|
||||
--help-all This same help message but with additional options.
|
||||
--import-realm Import realms during startup by reading any realm configuration file from the
|
||||
|
|
|
@ -8,11 +8,6 @@ Use this command to run the server in production.
|
|||
|
||||
Options:
|
||||
|
||||
-b, --auto-build (Deprecated) Automatically detects whether the server configuration changed
|
||||
and a new server image must be built prior to starting the server. This
|
||||
option provides an alternative to manually running the 'build' prior to
|
||||
starting the server. Use this configuration carefully in production as it
|
||||
might impact the startup time.
|
||||
-h, --help This help message.
|
||||
--help-all This same help message but with additional options.
|
||||
--import-realm Import realms during startup by reading any realm configuration file from the
|
||||
|
|
|
@ -8,11 +8,6 @@ Use this command to run the server in production.
|
|||
|
||||
Options:
|
||||
|
||||
-b, --auto-build (Deprecated) Automatically detects whether the server configuration changed
|
||||
and a new server image must be built prior to starting the server. This
|
||||
option provides an alternative to manually running the 'build' prior to
|
||||
starting the server. Use this configuration carefully in production as it
|
||||
might impact the startup time.
|
||||
-h, --help This help message.
|
||||
--help-all This same help message but with additional options.
|
||||
--import-realm Import realms during startup by reading any realm configuration file from the
|
||||
|
|
|
@ -8,11 +8,6 @@ Use this command to run the server in production.
|
|||
|
||||
Options:
|
||||
|
||||
-b, --auto-build (Deprecated) Automatically detects whether the server configuration changed
|
||||
and a new server image must be built prior to starting the server. This
|
||||
option provides an alternative to manually running the 'build' prior to
|
||||
starting the server. Use this configuration carefully in production as it
|
||||
might impact the startup time.
|
||||
-h, --help This help message.
|
||||
--help-all This same help message but with additional options.
|
||||
--import-realm Import realms during startup by reading any realm configuration file from the
|
||||
|
|
|
@ -8,11 +8,6 @@ Use this command to run the server in production.
|
|||
|
||||
Options:
|
||||
|
||||
-b, --auto-build (Deprecated) Automatically detects whether the server configuration changed
|
||||
and a new server image must be built prior to starting the server. This
|
||||
option provides an alternative to manually running the 'build' prior to
|
||||
starting the server. Use this configuration carefully in production as it
|
||||
might impact the startup time.
|
||||
-h, --help This help message.
|
||||
--help-all This same help message but with additional options.
|
||||
--import-realm Import realms during startup by reading any realm configuration file from the
|
||||
|
|
Loading…
Reference in a new issue