From 8aa394ca6b327710694040bd48b2f9f72b5a0788 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira da Silva Date: Thu, 10 Mar 2022 16:54:56 -0300 Subject: [PATCH] Update to Liquibase 4.8.0 Closes #10678 Co-authored-by: Stefan Guilhen Co-authored-by: Martin Kanis --- .../main/resources/licenses/keycloak/licenses.xml | 4 ++-- ...ase-core,4.8.0,Apache Software License 2.0.txt} | 0 .../main/resources/licenses/rh-sso/licenses.xml | 4 ++-- ...0.redhat-00001,Apache Software License 2.0.txt} | 0 .../keycloak-server-galleon-pack-licenses.xml | 4 ++-- .../rh-sso-server-galleon-pack-licenses.xml | 4 ++-- .../conn/DefaultLiquibaseConnectionProvider.java | 2 ++ pom.xml | 2 +- .../QuarkusLiquibaseConnectionProvider.java | 14 ++++++++++++++ 9 files changed, 25 insertions(+), 9 deletions(-) rename distribution/feature-packs/server-feature-pack/src/main/resources/licenses/keycloak/{org.liquibase,liquibase-core,4.6.2,Apache Software License 2.0.txt => org.liquibase,liquibase-core,4.8.0,Apache Software License 2.0.txt} (100%) rename distribution/feature-packs/server-feature-pack/src/main/resources/licenses/rh-sso/{org.liquibase,liquibase-core,4.6.2.redhat-00001,Apache Software License 2.0.txt => org.liquibase,liquibase-core,4.8.0.redhat-00001,Apache Software License 2.0.txt} (100%) diff --git a/distribution/feature-packs/server-feature-pack/src/main/resources/licenses/keycloak/licenses.xml b/distribution/feature-packs/server-feature-pack/src/main/resources/licenses/keycloak/licenses.xml index 7be0c2395f..33b664437f 100644 --- a/distribution/feature-packs/server-feature-pack/src/main/resources/licenses/keycloak/licenses.xml +++ b/distribution/feature-packs/server-feature-pack/src/main/resources/licenses/keycloak/licenses.xml @@ -81,11 +81,11 @@ org.liquibase liquibase-core - 4.6.2 + 4.8.0 Apache Software License 2.0 - https://raw.githubusercontent.com/liquibase/liquibase/v4.6.2/LICENSE.txt + https://raw.githubusercontent.com/liquibase/liquibase/v4.8.0/LICENSE.txt diff --git a/distribution/feature-packs/server-feature-pack/src/main/resources/licenses/keycloak/org.liquibase,liquibase-core,4.6.2,Apache Software License 2.0.txt b/distribution/feature-packs/server-feature-pack/src/main/resources/licenses/keycloak/org.liquibase,liquibase-core,4.8.0,Apache Software License 2.0.txt similarity index 100% rename from distribution/feature-packs/server-feature-pack/src/main/resources/licenses/keycloak/org.liquibase,liquibase-core,4.6.2,Apache Software License 2.0.txt rename to distribution/feature-packs/server-feature-pack/src/main/resources/licenses/keycloak/org.liquibase,liquibase-core,4.8.0,Apache Software License 2.0.txt diff --git a/distribution/feature-packs/server-feature-pack/src/main/resources/licenses/rh-sso/licenses.xml b/distribution/feature-packs/server-feature-pack/src/main/resources/licenses/rh-sso/licenses.xml index 90b9c040b5..23bfe041e6 100644 --- a/distribution/feature-packs/server-feature-pack/src/main/resources/licenses/rh-sso/licenses.xml +++ b/distribution/feature-packs/server-feature-pack/src/main/resources/licenses/rh-sso/licenses.xml @@ -81,11 +81,11 @@ org.liquibase liquibase-core - 4.6.2.redhat-00001 + 4.8.0.redhat-00001 Apache Software License 2.0 - https://raw.githubusercontent.com/liquibase/liquibase/v4.6.2/LICENSE.txt + https://raw.githubusercontent.com/liquibase/liquibase/v4.8.0/LICENSE.txt diff --git a/distribution/feature-packs/server-feature-pack/src/main/resources/licenses/rh-sso/org.liquibase,liquibase-core,4.6.2.redhat-00001,Apache Software License 2.0.txt b/distribution/feature-packs/server-feature-pack/src/main/resources/licenses/rh-sso/org.liquibase,liquibase-core,4.8.0.redhat-00001,Apache Software License 2.0.txt similarity index 100% rename from distribution/feature-packs/server-feature-pack/src/main/resources/licenses/rh-sso/org.liquibase,liquibase-core,4.6.2.redhat-00001,Apache Software License 2.0.txt rename to distribution/feature-packs/server-feature-pack/src/main/resources/licenses/rh-sso/org.liquibase,liquibase-core,4.8.0.redhat-00001,Apache Software License 2.0.txt diff --git a/distribution/galleon-feature-packs/server-galleon-pack/src/license/keycloak-server-galleon-pack-licenses.xml b/distribution/galleon-feature-packs/server-galleon-pack/src/license/keycloak-server-galleon-pack-licenses.xml index 9a2df23d2d..bf367e1c6d 100644 --- a/distribution/galleon-feature-packs/server-galleon-pack/src/license/keycloak-server-galleon-pack-licenses.xml +++ b/distribution/galleon-feature-packs/server-galleon-pack/src/license/keycloak-server-galleon-pack-licenses.xml @@ -96,11 +96,11 @@ org.liquibase liquibase-core - 3.6.2 + 4.8.0 Apache Software License 2.0 - https://raw.githubusercontent.com/liquibase/liquibase/v4.6.2/LICENSE.txt + https://raw.githubusercontent.com/liquibase/liquibase/v4.8.0/LICENSE.txt diff --git a/distribution/galleon-feature-packs/server-galleon-pack/src/license/rh-sso-server-galleon-pack-licenses.xml b/distribution/galleon-feature-packs/server-galleon-pack/src/license/rh-sso-server-galleon-pack-licenses.xml index 3466f26090..7f22aa0f3e 100644 --- a/distribution/galleon-feature-packs/server-galleon-pack/src/license/rh-sso-server-galleon-pack-licenses.xml +++ b/distribution/galleon-feature-packs/server-galleon-pack/src/license/rh-sso-server-galleon-pack-licenses.xml @@ -81,11 +81,11 @@ org.liquibase liquibase-core - 4.6.2.redhat-00001 + 4.8.0.redhat-00001 Apache Software License 2.0 - https://raw.githubusercontent.com/liquibase/liquibase/v4.6.2/LICENSE.txt + https://raw.githubusercontent.com/liquibase/liquibase/v4.8.0/LICENSE.txt diff --git a/model/jpa/src/main/java/org/keycloak/connections/jpa/updater/liquibase/conn/DefaultLiquibaseConnectionProvider.java b/model/jpa/src/main/java/org/keycloak/connections/jpa/updater/liquibase/conn/DefaultLiquibaseConnectionProvider.java index 896136584a..0cd6c0bac1 100644 --- a/model/jpa/src/main/java/org/keycloak/connections/jpa/updater/liquibase/conn/DefaultLiquibaseConnectionProvider.java +++ b/model/jpa/src/main/java/org/keycloak/connections/jpa/updater/liquibase/conn/DefaultLiquibaseConnectionProvider.java @@ -26,6 +26,7 @@ import liquibase.database.jvm.JdbcConnection; import liquibase.exception.LiquibaseException; import liquibase.resource.ClassLoaderResourceAccessor; import liquibase.resource.ResourceAccessor; +import liquibase.ui.LoggerUIService; import org.jboss.logging.Logger; import org.keycloak.Config; import org.keycloak.connections.jpa.updater.liquibase.LiquibaseJpaUpdaterProvider; @@ -81,6 +82,7 @@ public class DefaultLiquibaseConnectionProvider implements LiquibaseConnectionPr final Map scopeValues = new HashMap<>(); scopeValues.put(Scope.Attr.resourceAccessor.name(), new ClassLoaderResourceAccessor(this.getClass().getClassLoader())); scopeValues.put(Scope.Attr.classLoader.name(), this.getClass().getClassLoader()); + scopeValues.put(Scope.Attr.ui.name(), new LoggerUIService()); try { Scope.enter(scopeValues); } catch (Exception e) { diff --git a/pom.xml b/pom.xml index 1b3aa476b1..836e741366 100644 --- a/pom.xml +++ b/pom.xml @@ -137,7 +137,7 @@ 2.3.31 ${jetty92.version} - 4.6.2 + 4.8.0 4.2.0 7.1.0 1.0.2.Final diff --git a/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/storage/database/liquibase/QuarkusLiquibaseConnectionProvider.java b/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/storage/database/liquibase/QuarkusLiquibaseConnectionProvider.java index 097be18343..5ab0ea2a69 100644 --- a/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/storage/database/liquibase/QuarkusLiquibaseConnectionProvider.java +++ b/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/storage/database/liquibase/QuarkusLiquibaseConnectionProvider.java @@ -19,9 +19,13 @@ package org.keycloak.quarkus.runtime.storage.database.liquibase; import java.lang.reflect.Method; import java.sql.Connection; +import java.util.HashMap; +import java.util.Map; import javax.xml.parsers.SAXParserFactory; +import liquibase.Scope; +import liquibase.ui.LoggerUIService; import org.jboss.logging.Logger; import org.keycloak.Config; import org.keycloak.connections.jpa.updater.liquibase.conn.LiquibaseConnectionProvider; @@ -63,6 +67,16 @@ public class QuarkusLiquibaseConnectionProvider implements LiquibaseConnectionPr protected void baseLiquibaseInitialization(KeycloakSession session) { resourceAccessor = new ClassLoaderResourceAccessor(getClass().getClassLoader()); + // initialize Liquibase using a custom scope + final Map scopeValues = new HashMap<>(); + scopeValues.put(Scope.Attr.ui.name(), new LoggerUIService()); + try { + Scope scope = Scope.getCurrentScope(); + scope.enter(scopeValues); + } catch (Exception e) { + throw new RuntimeException("Failed to initialize Liquibase: " + e.getMessage(), e); + } + // disables XML validation for (ChangeLogParser parser : ChangeLogParserFactory.getInstance().getParsers()) { if (parser instanceof XMLChangeLogSAXParser) {