===== Update CAS ===== update d'une version CAS a une autres, exemple ici passage d'un 7.1.4 a 7.2.6 l'objectif etant de conserver nos parametrage, dependencies ldap, CSS / views etc ... ==== reference ==== * https://fawnoos.com/2024/03/07/cas70x-upgrades-openrewrite/ summary OpenRewrite recipes are produced by CAS itself and are essentially YAML files that make minimally invasive changes to your CAS build allowing you to upgrade from one version to the next with minimal effort. The recipe contains almost everything that is required for a CAS build system to navigate from one version to other and automates tedious aspects of the upgrade such as finding the correct versions of CAS, relevant libraries and plugins as well as any possible structural changes to one’s CAS build. ==== depart cas 7.1.4 ==== [root@cas cas-overlay-template]# ./gradlew casVersion --no-configuration-cache -q Using Amazon Corretto as the JVM vendor for the Java toolchain Building CAS version 7.1.4 with application server -tomcat 7.1.4 ==== liste update a faire ===== ask the build to discover and list all upgrade recipes that might be applicable for the task at hand [root@cas cas-overlay-template]# time ./gradlew --init-script openrewrite.gradle rewriteDiscover -PtargetVersion=7.2.6 --no-configuration-cache --no-daemon | grep "org.apereo.cas" org.apereo.cas.cas726 org.apereo.cas.cas725 org.apereo.cas.cas724 org.apereo.cas.cas720 org.apereo.cas.cas721 org.apereo.cas.cas723 org.apereo.cas.cas722 org.apereo.cas.cas710-RC5 org.apereo.cas.cas710-RC6 org.apereo.cas.cas710-RC2 org.apereo.cas.cas710-RC1 org.apereo.cas.cas720-RC1 org.apereo.cas.cas710 org.apereo.cas.cas720-RC2 org.apereo.cas.cas720-RC3 org.apereo.cas.cas720-RC6 org.apereo.cas.cas700 org.apereo.cas.cas720-RC4 org.apereo.cas.cas720-RC5 real 0m31.579s ==== Dry run ==== Next, we can dry-run our selected recipe, org.apereo.cas.cas702, and see which files would be changed in the build log. This does not alter your source files on disk at all. This goal can be used to preview the changes that would be made by the active recipes. [root@cas cas-overlay-template]# time ./gradlew --init-script openrewrite.gradle rewriteDryRun -PtargetVersion=7.2.6 -DactiveRecipe="org.apereo.cas.cas726" --no-configuration-cache --no-daemon To honour the JVM settings for this build a single-use Daemon process will be forked. For more on this, please refer to https://docs.gradle.org/8.12.1/userguide/gradle_daemon.html#sec:disabling_the_daemon in the Gradle documentation. Daemon will be stopped at the end of the build Configuration on demand is an incubating feature. > Configure project : Using Amazon Corretto as the JVM vendor for the Java toolchain Building CAS version 7.1.4 with application server -tomcat > Task :rewriteDryRun Validating active recipes Scanning sources in project : Using active styles [] There were problems parsing some source files, run with --info to see full stack traces There were problems parsing build.gradle There were problems parsing gradle/tasks.gradle There were problems parsing helm/cas-server/templates/casconfig-configmap.yaml There were problems parsing helm/cas-server/templates/ingress.yaml There were problems parsing helm/cas-server/templates/role.yaml There were problems parsing helm/cas-server/templates/rolebinding.yaml There were problems parsing helm/cas-server/templates/script-configmap.yaml There were problems parsing helm/cas-server/templates/service.yaml There were problems parsing helm/cas-server/templates/serviceaccount.yaml There were problems parsing helm/cas-server/templates/statefulset.yaml There were problems parsing helm/cas-server/templates/tests/test-cas-server.yaml All sources parsed, running active recipes: org.apereo.cas.cas726 These recipes would make changes to gradle.properties: org.openrewrite.gradle.AddProperty: {key=cas.version, value=7.2.6, overwrite=true, filePattern=gradle.properties} org.openrewrite.gradle.AddProperty: {key=version, value=7.2.6, overwrite=true, filePattern=gradle.properties} org.openrewrite.gradle.AddProperty: {key=springBootVersion, value=3.4.4, overwrite=true, filePattern=gradle.properties} org.openrewrite.gradle.UpdateGradleWrapper: {version=8.13, addIfMissing=true} org.openrewrite.gradle.AddProperty: {key=tomcatVersion, value=10.1.43, overwrite=false, filePattern=gradle.properties} org.openrewrite.gradle.AddProperty: {key=jibVersion, value=3.4.5, overwrite=true, filePattern=gradle.properties} These recipes would make changes to gradle/wrapper/gradle-wrapper.jar: org.openrewrite.gradle.UpdateGradleWrapper: {version=8.13, addIfMissing=true} These recipes would make changes to gradlew: org.openrewrite.gradle.UpdateGradleWrapper: {version=8.13, addIfMissing=true} These recipes would make changes to gradlew.bat: org.openrewrite.gradle.UpdateGradleWrapper: {version=8.13, addIfMissing=true} These recipes would make changes to gradle/wrapper/gradle-wrapper.properties: org.openrewrite.gradle.UpdateGradleWrapper: {version=8.13, addIfMissing=true} These recipes would make changes to gradlew: org.openrewrite.gradle.UpdateGradleWrapper: {version=8.13, addIfMissing=true} These recipes would make changes to gradlew.bat: org.openrewrite.gradle.UpdateGradleWrapper: {version=8.13, addIfMissing=true} These recipes would make changes to gradle/wrapper/gradle-wrapper.jar: org.openrewrite.gradle.UpdateGradleWrapper: {version=8.13, addIfMissing=true} These recipes would make changes to gradle/wrapper/gradle-wrapper.properties: org.openrewrite.gradle.UpdateGradleWrapper: {version=8.13, addIfMissing=true} Report available: /opt/cas-src/cas-overlay-template/build/reports/rewrite/rewrite.patch Estimate time saved: 45m Run 'gradle rewriteRun' to apply the recipes. [Incubating] Problems report is available at: file:///opt/cas-src/cas-overlay-template/build/reports/problems/problems-report.html Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0. You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins. For more on this, please refer to https://docs.gradle.org/8.12.1/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation. BUILD SUCCESSFUL in 2m 13s 6 actionable tasks: 2 executed, 4 up-to-date real 2m14.409s user 2m31.799s sys 0m12.976s You can in fact examine the generated .patch file: Report available: /opt/cas-src/cas-overlay-template/build/reports/rewrite/rewrite.patch [root@cas cas-overlay-template]# cat /opt/cas-src/cas-overlay-template/build/reports/rewrite/rewrite.patch diff --git a/gradle.properties b/gradle.properties index b9bcfc0..87cb882 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,19 +1,19 @@ org.apereo.cas.cas726 # This overlay project's version # For consistency and with no other effect, this is set to the CAS version itself. -version=7.1.4 +version=7.2.6 ... ==== update ==== When you are ready, you can run the actual recipe: [root@cas cas-overlay-template]# time ./gradlew --init-script openrewrite.gradle rewriteRun -PtargetVersion=7.2.6 -DactiveRecipe="org.apereo.cas.cas726" --no-configuration-cache --no-daemon To honour the JVM settings for this build a single-use Daemon process will be forked. For more on this, please refer to https://docs.gradle.org/8.12.1/userguide/gradle_daemon.html#sec:disabling_the_daemon in the Gradle documentation. Daemon will be stopped at the end of the build Configuration on demand is an incubating feature. > Configure project : Using Amazon Corretto as the JVM vendor for the Java toolchain Building CAS version 7.1.4 with application server -tomcat > Task :rewriteRun Validating active recipes Scanning sources in project : Using active styles [] There were problems parsing some source files, run with --info to see full stack traces There were problems parsing build.gradle There were problems parsing gradle/tasks.gradle There were problems parsing helm/cas-server/templates/casconfig-configmap.yaml There were problems parsing helm/cas-server/templates/ingress.yaml There were problems parsing helm/cas-server/templates/role.yaml There were problems parsing helm/cas-server/templates/rolebinding.yaml There were problems parsing helm/cas-server/templates/script-configmap.yaml There were problems parsing helm/cas-server/templates/service.yaml There were problems parsing helm/cas-server/templates/serviceaccount.yaml There were problems parsing helm/cas-server/templates/statefulset.yaml There were problems parsing helm/cas-server/templates/tests/test-cas-server.yaml All sources parsed, running active recipes: org.apereo.cas.cas726 Changes have been made to gradle.properties by: org.openrewrite.gradle.AddProperty: {key=cas.version, value=7.2.6, overwrite=true, filePattern=gradle.properties} org.openrewrite.gradle.AddProperty: {key=version, value=7.2.6, overwrite=true, filePattern=gradle.properties} org.openrewrite.gradle.AddProperty: {key=springBootVersion, value=3.4.4, overwrite=true, filePattern=gradle.properties} org.openrewrite.gradle.UpdateGradleWrapper: {version=8.13, addIfMissing=true} org.openrewrite.gradle.AddProperty: {key=tomcatVersion, value=10.1.43, overwrite=false, filePattern=gradle.properties} org.openrewrite.gradle.AddProperty: {key=jibVersion, value=3.4.5, overwrite=true, filePattern=gradle.properties} Changes have been made to gradle/wrapper/gradle-wrapper.properties by: org.openrewrite.gradle.UpdateGradleWrapper: {version=8.13, addIfMissing=true} Changes have been made to gradlew by: org.openrewrite.gradle.UpdateGradleWrapper: {version=8.13, addIfMissing=true} Changes have been made to gradlew.bat by: org.openrewrite.gradle.UpdateGradleWrapper: {version=8.13, addIfMissing=true} Changes have been made to gradle/wrapper/gradle-wrapper.jar by: org.openrewrite.gradle.UpdateGradleWrapper: {version=8.13, addIfMissing=true} Changes have been made to gradlew by: org.openrewrite.gradle.UpdateGradleWrapper: {version=8.13, addIfMissing=true} Changes have been made to gradlew.bat by: org.openrewrite.gradle.UpdateGradleWrapper: {version=8.13, addIfMissing=true} Changes have been made to gradle/wrapper/gradle-wrapper.jar by: org.openrewrite.gradle.UpdateGradleWrapper: {version=8.13, addIfMissing=true} Changes have been made to gradle/wrapper/gradle-wrapper.properties by: org.openrewrite.gradle.UpdateGradleWrapper: {version=8.13, addIfMissing=true} Please review and commit the results. Estimate time saved: 45m [Incubating] Problems report is available at: file:///opt/cas-src/cas-overlay-template/build/reports/problems/problems-report.html Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0. You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins. For more on this, please refer to https://docs.gradle.org/8.12.1/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation. BUILD SUCCESSFUL in 1m 22s 6 actionable tasks: 1 executed, 5 up-to-date real 1m23.020s user 1m46.706s sys 0m11.937s ==== build errors ==== [root@cas7dev cas-overlay-template-7u]# ./gradlew clean copyCasConfiguration build --no-daemon [Incubating] Problems report is available at: file:///opt/cas-src/cas-overlay-template-7u/build/reports/problems/problems-report.html FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring root project 'cas'. > Could not resolve all artifacts for configuration 'classpath'. > Could not find org.apereo.cas:cas-server-core-configuration-metadata-repository:7.2.7. Searched in the following locations: - file:/root/.m2/repository/org/apereo/cas/cas-server-core-configuration-metadata-repository/7.2.7/cas-server-core-configuration-metadata-repository-7.2.7.pom - https://repo.maven.apache.org/maven2/org/apereo/cas/cas-server-core-configuration-metadata-repository/7.2.7/cas-server-core-configuration-metadata-repository-7.2.7.pom - https://plugins.gradle.org/m2/org/apereo/cas/cas-server-core-configuration-metadata-repository/7.2.7/cas-server-core-configuration-metadata-repository-7.2.7.pom - https://repo.spring.io/milestone/org/apereo/cas/cas-server-core-configuration-metadata-repository/7.2.7/cas-server-core-configuration-metadata-repository-7.2.7.pom Required by: root project : * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. > Get more help at https://help.gradle.org. The Fix: Remove that line. The CAS Gradle plugin typically handles what it needs internally. If you need configuration metadata support, ensure you are using the correct CAS Gradle Plugin version that matches your CAS version. [root@cas7dev cas-overlay-template-7u]# vim build.gradle dependencies { classpath "org.springframework.boot:spring-boot-gradle-plugin:${project.springBootVersion}" classpath "io.freefair.gradle:maven-plugin:${project.gradleFreeFairPluginVersion}" classpath "io.freefair.gradle:lombok-plugin:${project.gradleFreeFairPluginVersion}" classpath "com.google.cloud.tools:jib-gradle-plugin:${project.jibVersion}" classpath "com.bmuschko:gradle-docker-plugin:${project.gradleDockerPluginVersion}" classpath "de.undercouch:gradle-download-task:${project.gradleDownloadTaskVersion}" classpath "org.apereo.cas:cas-server-core-api-configuration-model:${project.'cas.version'}" // classpath "org.apereo.cas:cas-server-core-configuration-metadata-repository:${project.'cas.version'}" } } puis erreur * Where: Build file '/opt/cas-src/cas-overlay-template-7u/build.gradle' line: 90 * What went wrong: A problem occurred evaluating root project 'cas'. > Could not resolve all artifacts for configuration 'classpath'. > Could not find org.apereo.cas:cas-server-core-configuration-metadata-repository:7.2.7. Searched in the following locations: - file:/root/.m2/repository/org/apereo/cas/cas-server-core-configuration-metadata-repository/7.2.7/cas-server-core-configuration-metadata-repository-7.2.7.pom - https://repo.maven.apache.org/maven2/org/apereo/cas/cas-server-core-configuration-metadata-repository/7.2.7/cas-server-core-configuration-metadata-repository-7.2.7.pom - https://plugins.gradle.org/m2/org/apereo/cas/cas-server-core-configuration-metadata-repository/7.2.7/cas-server-core-configuration-metadata-repository-7.2.7.pom - https://repo.spring.io/milestone/org/apereo/cas/cas-server-core-configuration-metadata-repository/7.2.7/cas-server-core-configuration-metadata-repository-7.2.7.pom Required by: unspecified:unspecified:unspecified line 90 de build.gradle appel apply from: rootProject.file("gradle/tasks.gradle") # vim /opt/cas-src/cas-overlay-template-7u/gradle/tasks.gradle on comment alors tout le dernier bloc /* task exportConfigMetadata(group: "CAS", description: "Export collection of CAS properties") { def file = new File(project.rootDir, 'config-metadata.properties') def queryType = ConfigurationMetadataCatalogQuery.QueryTypes.CAS ... } println "Configuration metadata is available at ${file.absolutePath}" } } */ cela build enfin [root@cas7dev cas-overlay-template-7u]# ./gradlew clean copyCasConfiguration build --no-daemon To honour the JVM settings for this build a single-use Daemon process will be forked. For more on this, please refer to https://docs.gradle.org/8.13/userguide/gradle_daemon.html#sec:disabling_the_daemon in the Gradle documentation. Daemon will be stopped at the end of the build Configuration on demand is an incubating feature. > Configure project : Using Amazon Corretto as the JVM vendor for the Java toolchain Building CAS version 7.2.7 with application server -tomcat [Incubating] Problems report is available at: file:///opt/cas-src/cas-overlay-template-7u/build/reports/problems/problems-report.html Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0. You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins. For more on this, please refer to https://docs.gradle.org/8.13/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation. BUILD SUCCESSFUL in 1m 6s 9 actionable tasks: 9 executed [root@cas7dev cas-overlay-template-7u]# ls -l ./build/libs/ total 125420 -rwxr--r-- 1 root root 128428810 Feb 1 21:46 cas.war ==== 2 correctifs GPT ==== === premier pb === cf logs 2026-01-26 17:54:40,649 ERROR [org.apereo.cas.authentication.mfa.trigger.GlobalMultifactorAuthenticationTrigger] - [root@cas cas-overlay-template]# ./gradlew clean copyCasConfiguration build --no-daemon To honour the JVM settings for this build a single-use Daemon process will be forked. For more on this, please refer to https://docs.gradle.org/8.13/userguide/gradle_daemon.html#sec:disabling_the_daemon in the Gradle documentation. Daemon will be stopped at the end of the build Configuration on demand is an incubating feature. > Configure project : Using Amazon Corretto as the JVM vendor for the Java toolchain Building CAS version 7.2.6 with application server -tomcat > Task :compileJava FAILED [Incubating] Problems report is available at: file:///opt/cas-src/cas-overlay-template/build/reports/problems/problems-report.html FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':compileJava'. > Could not resolve all files for configuration ':compileClasspath'. > Could not find cas-server-support-simple-mfa-7.2.6-casVersion'.jar (org.apereo.cas:cas-server-support-simple-mfa:7.2.6). Searched in the following locations: https://repo.maven.apache.org/maven2/org/apereo/cas/cas-server-support-simple-mfa/7.2.6/cas-server-support-simple-mfa-7.2.6-casVersion'.jar puis build [root@cas cas-overlay-template]# ./gradlew clean copyCasConfiguration build --no-daemon To honour the JVM settings for this build a single-use Daemon process will be forked. For more on this, please refer to https://docs.gradle.org/8.13/userguide/gradle_daemon.html#sec:disabling_the_daemon in the Gradle documentation. Daemon will be stopped at the end of the build Configuration on demand is an incubating feature. > Configure project : Using Amazon Corretto as the JVM vendor for the Java toolchain Building CAS version 7.2.6 with application server -tomcat [Incubating] Problems report is available at: file:///opt/cas-src/cas-overlay-template/build/reports/problems/problems-report.html Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0. You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins. For more on this, please refer to https://docs.gradle.org/8.13/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation. BUILD SUCCESSFUL in 1m 15s 9 actionable tasks: 9 executed [root@cas cas-overlay-template]# ls -lh build/libs total 123M -rwxr--r-- 1 root root 123M Jan 23 22:44 cas.war ==== backup et installation ===== [root@cas cas-overlay-template]# mv /opt/tomcat/webapps/cas.war /root/cas.war.7.1.4 [root@cas cas-overlay-template]# ls -l /opt/cas-src/cas-overlay-template/build/libs/cas.war -rwxr--r-- 1 root root 128425823 Jan 23 22:44 /opt/cas-src/cas-overlay-template/build/libs/cas.war [root@cas cas-overlay-template]# cp /opt/cas-src/cas-overlay-template/build/libs/cas.war /opt/tomcat/webapps/cas.war