Skip to content

Commit

Permalink
Re-augment at start after a previous dev mode (keycloak#30461)
Browse files Browse the repository at this point in the history
Closes keycloak#30460

Signed-off-by: Alexander Schwartz <[email protected]>
  • Loading branch information
ahus1 authored Jun 26, 2024
1 parent 1dcd07a commit 1edf444
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
import org.keycloak.quarkus.runtime.cli.command.ImportRealmMixin;
import org.keycloak.quarkus.runtime.cli.command.Main;
import org.keycloak.quarkus.runtime.cli.command.ShowConfig;
import org.keycloak.quarkus.runtime.cli.command.Start;
import org.keycloak.quarkus.runtime.cli.command.StartDev;
import org.keycloak.quarkus.runtime.cli.command.Tools;
import org.keycloak.quarkus.runtime.configuration.ConfigArgsConfigSource;
Expand Down Expand Up @@ -193,6 +194,14 @@ private static boolean shouldSkipRebuild(List<String> cliArgs, String currentCom
}

private static boolean requiresReAugmentation(CommandLine cmdCommand) {
if (ConfigArgsConfigSource.getAllCliArgs().contains(Start.NAME)
// run time dev mode is not set
&& !org.keycloak.common.util.Environment.isDevMode()
// build time dev mode was set
&& org.keycloak.common.util.Environment.DEV_PROFILE_VALUE.equals(getBuildTimeProperty(org.keycloak.common.util.Environment.PROFILE).orElse(null))) {
return true;
}

if (hasConfigChanges(cmdCommand)) {
if (!ConfigArgsConfigSource.getAllCliArgs().contains(StartDev.NAME) && "dev".equals(getConfig().getOptionalValue("kc.profile", String.class).orElse(null))) {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,16 @@ void testWarningWhenOverridingBuildOptionsDuringStart(KeycloakDistribution dist)
cliResult.assertNoMessage("The previous optimized build will be overridden with the following build options:"); // no message, same values provided during auto-build
}

@Test
@RawDistOnly(reason = "Containers are immutable")
void testStartAfterStartDev(KeycloakDistribution dist) {
CLIResult cliResult = dist.run("start-dev");
cliResult.assertStartedDevMode();

cliResult = dist.run("start", "--http-enabled", "true", "--hostname-strict", "false");
cliResult.assertStarted();
}

@Test
@RawDistOnly(reason = "Containers are immutable")
void testWarningWhenOverridingNonCliBuildOptionsDuringStart(KeycloakDistribution dist) {
Expand Down

0 comments on commit 1edf444

Please sign in to comment.