diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index c61fddd9..f6a899ca 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -15,12 +15,14 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - - name: Set up JDK 11 - uses: actions/setup-java@v3 - with: - java-version: '11' + - uses: actions/checkout@v4 + + - name: Set up Java Env + uses: actions/setup-java@v4 + with: # The last version will be used by default and available globally via JAVA_HOME. + java-version: | + 17 + 11 distribution: 'temurin' cache: maven @@ -38,11 +40,14 @@ jobs: key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} restore-keys: ${{ runner.os }}-m2 - - name: Build with Maven + - name: Build and Test with Maven + env: + JAVA_HOME: ${{ env.JAVA_HOME_11_X64 }} run: mvn clean install javadoc:javadoc - - name: Build and analyze + - name: Analyze with SonarQube env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=aecu + JAVA_HOME: ${{ env.JAVA_HOME_17_X64 }} + run: mvn -B org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=aecu diff --git a/HISTORY b/HISTORY index d225737b..69b05a9c 100644 --- a/HISTORY +++ b/HISTORY @@ -1,6 +1,12 @@ +2024-30-05 6.5.1 + - Store result output data in binary property in case data is too big for string property (#233) + - Remove reindex=true property in index definition as it is not allowed (#230) + - Documentation updates on logging + - Documentation update on upgrade for index move + 2023-12-07 6.5.0 - Move of aecu.ui.content to /apps/settings to avoid overwrite of the configured weekly operations window (#225) - - New filter method: filterByPropertyIsMultiple() (# + - New filter method: filterByPropertyIsMultiple() - Documentation update for filter concatenation semantics with regards of AND/OR (#212) - Documentation update for re-execute logic of groovy scripts installed through InstallHook - Documentation update for filterWith diff --git a/Readme.md b/Readme.md index 26729641..6914826a 100644 --- a/Readme.md +++ b/Readme.md @@ -25,7 +25,8 @@ Table of contents 4. [Execution of Migration Scripts](#execution) 1. [Startup Hook](#startupHook) 2. [Install Hook](#installHook) - 2. [Manual Execution](#manualExecution) + 3. [Manual Execution](#manualExecution) + 4. [Execution Details](#executionDetails) 5. [History of Past Runs](#history) 6. [Extension to Groovy Console](#groovy) 1. [Content Upgrades](#content_upgrades) @@ -163,6 +164,10 @@ Then delete "aem-groovy-console" packages in package manager. +## Upgrade from version lower than 5.0.0 (On Premise) + +The index was moved from /var/aecu to /oak:index for cloud compatibility reasons, please remove the /var/aecu/oak:index/aecuHistory to avoid duplicate index definitions + # File and Folder Structure All migration scripts need to be located in: @@ -259,6 +264,17 @@ Once execution is done you will see if the script(s) succeeded. Click on the his + + +## Execution Details and Output +When executing, `de.valtech.aecu.core.service.AecuServiceImpl` will emit a log statement to inform script is currently being executed, and when execution is done, a second log statement including the result (success, failure, skipped if prechecks failed) is emitted. +To capture these logs, configure a logger on `de.valtech.aecu` with level `INFO` to append/emit logs as you desire. +These logs are helpful if you are executing scripts via hook. + +Additionally, as stated above, manual execution provides the UI to indicate which script is currently running. Please note however that if you leave the page while execution is in progress, you will not be able to go back to it to see the execution details again. + +In both cases, you can see more details on the execution in the history. See below for more information. + # History of Past Runs diff --git a/api/pom.xml b/api/pom.xml index f3d3b77e..ebabad91 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -4,7 +4,7 @@ de.valtech.aecu aecu - 6.5.0 + 6.5.1 aecu.api diff --git a/cloud.startup.hook/pom.xml b/cloud.startup.hook/pom.xml index d1af0937..b05dfaf1 100644 --- a/cloud.startup.hook/pom.xml +++ b/cloud.startup.hook/pom.xml @@ -4,7 +4,7 @@ de.valtech.aecu aecu - 6.5.0 + 6.5.1 aecu.cloud.startup.hook diff --git a/complete-cloud/pom.xml b/complete-cloud/pom.xml index bb4f9360..d2efb744 100644 --- a/complete-cloud/pom.xml +++ b/complete-cloud/pom.xml @@ -5,7 +5,7 @@ de.valtech.aecu aecu - 6.5.0 + 6.5.1 aecu.complete.cloud diff --git a/complete/pom.xml b/complete/pom.xml index b7b055e3..0e195709 100644 --- a/complete/pom.xml +++ b/complete/pom.xml @@ -5,7 +5,7 @@ de.valtech.aecu aecu - 6.5.0 + 6.5.1 aecu.complete diff --git a/core/pom.xml b/core/pom.xml index f0d28073..f5e6facc 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -4,7 +4,7 @@ de.valtech.aecu aecu - 6.5.0 + 6.5.1 aecu.core diff --git a/core/src/main/java/de/valtech/aecu/core/history/HistoryUtil.java b/core/src/main/java/de/valtech/aecu/core/history/HistoryUtil.java index 3f16c533..57a9978e 100644 --- a/core/src/main/java/de/valtech/aecu/core/history/HistoryUtil.java +++ b/core/src/main/java/de/valtech/aecu/core/history/HistoryUtil.java @@ -18,6 +18,9 @@ */ package de.valtech.aecu.core.history; +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Calendar; import java.util.GregorianCalendar; @@ -50,6 +53,12 @@ import de.valtech.aecu.api.service.HistoryEntry.STATE; import de.valtech.aecu.core.service.HistoryEntryImpl; +import javax.jcr.Binary; +import javax.jcr.Node; +import javax.jcr.RepositoryException; +import javax.jcr.Session; +import javax.jcr.ValueFactory; + /** * Reads and writes history entries. * @@ -69,6 +78,7 @@ public class HistoryUtil { public static final String ATTR_PATH = "path"; protected static final String ATTR_RUN_OUTPUT = "runOutput"; + protected static final String ATTR_RUN_OUTPUT_FULL = "runOutputFull"; protected static final String ATTR_RUN_STATE = "runState"; protected static final String ATTR_RUN_RESULT = "runResult"; protected static final String ATTR_RUN_TIME = "runTime"; @@ -77,6 +87,9 @@ public class HistoryUtil { protected static final String ATTR_START = "start"; protected static final String ATTR_END = "end"; private static final String NAME_INDEX = "oak:index"; + // This size is limited by the LuceneDocumentMaker to be able to read the property and create the new index + // The limit is 102400 but just to be in the safe side, is set to a bit lower number + private static final int MAXIMUM_PROPERTY_SIZE = 100000; private Random random = new Random(); @@ -358,7 +371,23 @@ private void saveExecutionResultInHistory(ExecutionResult result, String path, R values.put(ATTR_RUN_STATE, result.getState().name()); values.put(ATTR_PATH, result.getPath()); if (StringUtils.isNotBlank(result.getOutput())) { - values.put(ATTR_RUN_OUTPUT, result.getOutput()); + if (result.getOutput().getBytes(StandardCharsets.UTF_8).length < MAXIMUM_PROPERTY_SIZE) { + values.put(ATTR_RUN_OUTPUT, result.getOutput()); + } else { + values.put(ATTR_RUN_OUTPUT, "Output data too big, full data is stored as a binary in runOutputFull"); + LOG.info("Script result is bigger than 100 000 bytes. Full data can be found as a binary in property runOutputFull for path {}", path ); + try { + Node node = entry.adaptTo(Node.class); + Session session = node.getSession(); + ValueFactory factory = session.getValueFactory(); + InputStream is = new ByteArrayInputStream(result.getOutput().getBytes()); + Binary binary = factory.createBinary(is); + node.setProperty(ATTR_RUN_OUTPUT_FULL, binary); + session.save(); + } catch (RepositoryException e) { + LOG.error("Not able to save the output of the script as binary on the History node [{}]", entry.getPath()); + } + } } if (StringUtils.isNotBlank(result.getResult())) { values.put(ATTR_RUN_RESULT, result.getResult()); diff --git a/docs/developers.md b/docs/developers.md index 68374081..1f34ef93 100644 --- a/docs/developers.md +++ b/docs/developers.md @@ -1,12 +1,12 @@ # AEM Server Setup -By default AEM is expected to listen on localhost on port 5702. This setting can be overridden by adding parameters: +By default AEM is expected to listen on localhost on port 4502. This setting can be overridden by adding parameters: * -Daem.port=5702 * -Daem.host=localhost * -Daem.publish.port=5703 * -Daem.publish.host=localhost -You need AEM 6.3 with service pack 2 or AEM 6.4. +You need AEM 6.5 with Servicepack 13 or AEM Cloud SDK. # Build and Deploy diff --git a/examples-cloud/pom.xml b/examples-cloud/pom.xml index 760f1967..30a74d0a 100644 --- a/examples-cloud/pom.xml +++ b/examples-cloud/pom.xml @@ -5,7 +5,7 @@ de.valtech.aecu aecu - 6.5.0 + 6.5.1 aecu.examples-cloud diff --git a/examples/pom.xml b/examples/pom.xml index 0af32e54..9966982b 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -5,7 +5,7 @@ de.valtech.aecu aecu - 6.5.0 + 6.5.1 aecu.examples diff --git a/oak.index/pom.xml b/oak.index/pom.xml index 13ee5fcc..a49ae64c 100644 --- a/oak.index/pom.xml +++ b/oak.index/pom.xml @@ -5,7 +5,7 @@ de.valtech.aecu aecu - 6.5.0 + 6.5.1 aecu.oak.index diff --git a/oak.index/src/main/content/jcr_root/_oak_index/aecuHistory-custom-1/.content.xml b/oak.index/src/main/content/jcr_root/_oak_index/aecuHistory-custom-1/.content.xml index ce1e370c..0b92742c 100644 --- a/oak.index/src/main/content/jcr_root/_oak_index/aecuHistory-custom-1/.content.xml +++ b/oak.index/src/main/content/jcr_root/_oak_index/aecuHistory-custom-1/.content.xml @@ -4,7 +4,6 @@ async="async" compatVersion="{Long}2" evaluatePathRestrictions="{Boolean}true" - reindex="{Boolean}false" reindexCount="{Long}0" type="lucene" includedPaths="[/var/aecu]" diff --git a/pom.xml b/pom.xml index d58113e9..b5082db8 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ de.valtech.aecu aecu pom - 6.5.0 + 6.5.1 AECU AEM Easy Content Upgrade https://github.com/valtech/aem-easy-content-upgrade diff --git a/ui.apps/pom.xml b/ui.apps/pom.xml index 14a2fc66..d6fc64d2 100644 --- a/ui.apps/pom.xml +++ b/ui.apps/pom.xml @@ -5,7 +5,7 @@ de.valtech.aecu aecu - 6.5.0 + 6.5.1 aecu.ui.apps