From e75e82eca6473bbfb80d82338624e64575b20bfe Mon Sep 17 00:00:00 2001 From: Arun Venmany Date: Fri, 8 Nov 2024 07:46:02 +0530 Subject: [PATCH 1/6] workflow yaml changes to test ci comon varProcessing branch with ci.maven integration tests Signed-off-by: Arun Venmany --- .github/workflows/maven.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 7e4df153b..5ac5da564 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -48,8 +48,9 @@ jobs: - name: Checkout ci.common uses: actions/checkout@v3 with: - repository: OpenLiberty/ci.common + repository: arunvenmany-ibm/ci.common path: ci.common + ref: varProcessing - name: Checkout ci.ant uses: actions/checkout@v3 with: @@ -102,7 +103,7 @@ jobs: - name: Clone ci.ant, ci.common, ci.maven repos to C drive run: | cp -r D:/a/ci.maven/ci.maven C:/ci.maven - git clone https://github.com/OpenLiberty/ci.common.git C:/ci.common + git clone https://github.com/arunvenmany-ibm/ci.common.git --branch varProcessing --single-branch C:/ci.common git clone https://github.com/OpenLiberty/ci.ant.git C:/ci.ant - name: Set up Maven uses: stCarolas/setup-maven@v4.5 From fd77c5795630343a07de52b6331574d2baa2b6c8 Mon Sep 17 00:00:00 2001 From: Arun Venmany Date: Fri, 8 Nov 2024 13:02:51 +0530 Subject: [PATCH 2/6] using new severconfigdocument constructor Signed-off-by: Arun Venmany --- liberty-maven-plugin/pom.xml | 2 +- .../tools/maven/applications/DeployMojoSupport.java | 3 +-- .../tools/maven/applications/UndeployAppMojo.java | 3 +-- .../tools/maven/server/PluginConfigSupport.java | 11 ++++------- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/liberty-maven-plugin/pom.xml b/liberty-maven-plugin/pom.xml index 20bd2f0d2..f4b6d6268 100644 --- a/liberty-maven-plugin/pom.xml +++ b/liberty-maven-plugin/pom.xml @@ -88,7 +88,7 @@ io.openliberty.tools ci.common - 1.8.35 + 1.8.36-SNAPSHOT org.twdata.maven diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/DeployMojoSupport.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/DeployMojoSupport.java index ef15812f8..326cd9f88 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/DeployMojoSupport.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/DeployMojoSupport.java @@ -315,8 +315,7 @@ protected void verifyAppStarted(String appFile) throws MojoExecutionException { Map libertyDirPropertyFiles = getLibertyDirectoryPropertyFiles(); CommonLogger logger = new CommonLogger(getLog()); setLog(logger.getLog()); - getServerConfigDocument(logger, serverXML, configDirectory, - bootstrapPropertiesFile, combinedBootstrapProperties, serverEnvFile, false, libertyDirPropertyFiles); + scd = getServerConfigDocument(logger, libertyDirPropertyFiles); //appName will be set to a name derived from appFile if no name can be found. appName = scd.findNameForLocation(appFile); diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/UndeployAppMojo.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/UndeployAppMojo.java index a26848824..1479ed381 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/UndeployAppMojo.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/UndeployAppMojo.java @@ -136,8 +136,7 @@ protected void undeployApp(File file) throws MojoExecutionException { Map libertyDirPropertyFiles = getLibertyDirectoryPropertyFiles(); CommonLogger logger = new CommonLogger(getLog()); setLog(logger.getLog()); - getServerConfigDocument(logger, serverXML, configDirectory, - bootstrapPropertiesFile, combinedBootstrapProperties, serverEnvFile, false, libertyDirPropertyFiles); + scd = getServerConfigDocument(logger, libertyDirPropertyFiles); //appName will be set to a name derived from file if no name can be found. appName = scd.findNameForLocation(appName); diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/PluginConfigSupport.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/PluginConfigSupport.java index 1aa5b39f8..1926e92f2 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/PluginConfigSupport.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/PluginConfigSupport.java @@ -374,9 +374,7 @@ protected Set getAppConfigLocationsFromSourceServerXml() { Map libertyDirPropertyFiles = getLibertyDirectoryPropertyFiles(); CommonLogger logger = new CommonLogger(getLog()); setLog(logger.getLog()); - scd = getServerConfigDocument(logger, serverXML, configDirectory, - bootstrapPropertiesFile, combinedBootstrapProperties, serverEnvFile, false, - libertyDirPropertyFiles); + scd = getServerConfigDocument(logger, libertyDirPropertyFiles); } catch (Exception e) { getLog().warn(e.getLocalizedMessage()); getLog().debug(e); @@ -385,10 +383,9 @@ protected Set getAppConfigLocationsFromSourceServerXml() { return scd != null ? scd.getLocations() : new HashSet(); } - protected ServerConfigDocument getServerConfigDocument(CommonLoggerI log, File serverXML, File configDir, File bootstrapFile, - Map bootstrapProp, File serverEnvFile, boolean giveConfigDirPrecedence, Map libertyDirPropertyFiles) throws IOException { - if (scd == null || !scd.getServerXML().getCanonicalPath().equals(serverXML.getCanonicalPath())) { - scd = new ServerConfigDocument(log, serverXML, configDir, bootstrapFile, bootstrapProp, serverEnvFile, giveConfigDirPrecedence, libertyDirPropertyFiles); + protected ServerConfigDocument getServerConfigDocument(CommonLoggerI log, Map libertyDirPropertyFiles) { + if (scd == null) { + scd = new ServerConfigDocument(log, libertyDirPropertyFiles); } return scd; From a09d75f41d9627cefbf64e1cc067d534c7c83419 Mon Sep 17 00:00:00 2001 From: Arun Venmany Date: Mon, 11 Nov 2024 10:43:02 +0530 Subject: [PATCH 3/6] incorparating review comments Signed-off-by: Arun Venmany --- .../openliberty/tools/maven/applications/DeployMojoSupport.java | 2 -- .../openliberty/tools/maven/applications/UndeployAppMojo.java | 2 -- 2 files changed, 4 deletions(-) diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/DeployMojoSupport.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/DeployMojoSupport.java index 326cd9f88..78bb5a18d 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/DeployMojoSupport.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/DeployMojoSupport.java @@ -309,8 +309,6 @@ protected void verifyAppStarted(String appFile) throws MojoExecutionException { String appName = appFile.substring(0, appFile.lastIndexOf('.')); if (getAppsDirectory().equals("apps")) { - File serverXML = new File(serverDirectory, "server.xml"); - try { Map libertyDirPropertyFiles = getLibertyDirectoryPropertyFiles(); CommonLogger logger = new CommonLogger(getLog()); diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/UndeployAppMojo.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/UndeployAppMojo.java index 1479ed381..161199e52 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/UndeployAppMojo.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/UndeployAppMojo.java @@ -131,8 +131,6 @@ protected void undeployApp(File file) throws MojoExecutionException { if (getAppsDirectory().equals("apps")) { try { - File serverXML = new File(serverDirectory.getCanonicalPath(), "server.xml"); - Map libertyDirPropertyFiles = getLibertyDirectoryPropertyFiles(); CommonLogger logger = new CommonLogger(getLog()); setLog(logger.getLog()); From 01f1976a52b34e9387f938dfdf49a6a820689e2f Mon Sep 17 00:00:00 2001 From: Arun Venmany Date: Mon, 11 Nov 2024 15:15:52 +0530 Subject: [PATCH 4/6] rolling back removal of server.xml logic to compare server location and reload serverconfigdocument Signed-off-by: Arun Venmany --- .../tools/maven/applications/DeployMojoSupport.java | 4 +++- .../tools/maven/applications/UndeployAppMojo.java | 4 +++- .../openliberty/tools/maven/server/PluginConfigSupport.java | 6 +++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/DeployMojoSupport.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/DeployMojoSupport.java index 78bb5a18d..ed4ac54c5 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/DeployMojoSupport.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/DeployMojoSupport.java @@ -310,10 +310,12 @@ protected void verifyAppStarted(String appFile) throws MojoExecutionException { if (getAppsDirectory().equals("apps")) { try { + File serverXML = new File(serverDirectory, "server.xml"); + Map libertyDirPropertyFiles = getLibertyDirectoryPropertyFiles(); CommonLogger logger = new CommonLogger(getLog()); setLog(logger.getLog()); - scd = getServerConfigDocument(logger, libertyDirPropertyFiles); + scd = getServerConfigDocument(logger, serverXML, libertyDirPropertyFiles); //appName will be set to a name derived from appFile if no name can be found. appName = scd.findNameForLocation(appFile); diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/UndeployAppMojo.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/UndeployAppMojo.java index 161199e52..ad1d4cd40 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/UndeployAppMojo.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/UndeployAppMojo.java @@ -131,10 +131,12 @@ protected void undeployApp(File file) throws MojoExecutionException { if (getAppsDirectory().equals("apps")) { try { + File serverXML = new File(serverDirectory.getCanonicalPath(), "server.xml"); + Map libertyDirPropertyFiles = getLibertyDirectoryPropertyFiles(); CommonLogger logger = new CommonLogger(getLog()); setLog(logger.getLog()); - scd = getServerConfigDocument(logger, libertyDirPropertyFiles); + scd = getServerConfigDocument(logger, serverXML, libertyDirPropertyFiles); //appName will be set to a name derived from file if no name can be found. appName = scd.findNameForLocation(appName); diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/PluginConfigSupport.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/PluginConfigSupport.java index 1926e92f2..ee95f0070 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/PluginConfigSupport.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/PluginConfigSupport.java @@ -374,7 +374,7 @@ protected Set getAppConfigLocationsFromSourceServerXml() { Map libertyDirPropertyFiles = getLibertyDirectoryPropertyFiles(); CommonLogger logger = new CommonLogger(getLog()); setLog(logger.getLog()); - scd = getServerConfigDocument(logger, libertyDirPropertyFiles); + scd = getServerConfigDocument(logger, serverXML, libertyDirPropertyFiles); } catch (Exception e) { getLog().warn(e.getLocalizedMessage()); getLog().debug(e); @@ -383,8 +383,8 @@ protected Set getAppConfigLocationsFromSourceServerXml() { return scd != null ? scd.getLocations() : new HashSet(); } - protected ServerConfigDocument getServerConfigDocument(CommonLoggerI log, Map libertyDirPropertyFiles) { - if (scd == null) { + protected ServerConfigDocument getServerConfigDocument(CommonLoggerI log, File serverXML, Map libertyDirPropertyFiles) throws IOException { + if (scd == null || !scd.getServerXML().getCanonicalPath().equals(serverXML.getCanonicalPath())) { scd = new ServerConfigDocument(log, libertyDirPropertyFiles); } From 298b1a138717742bfe33e937db2ade8afafe0829 Mon Sep 17 00:00:00 2001 From: Arun Venmany Date: Tue, 12 Nov 2024 12:07:30 +0530 Subject: [PATCH 5/6] changing message incorparate review comments Signed-off-by: Arun Venmany --- .../openliberty/tools/maven/server/PluginConfigSupport.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/PluginConfigSupport.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/PluginConfigSupport.java index ee95f0070..191b9140c 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/PluginConfigSupport.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/PluginConfigSupport.java @@ -384,8 +384,8 @@ protected Set getAppConfigLocationsFromSourceServerXml() { } protected ServerConfigDocument getServerConfigDocument(CommonLoggerI log, File serverXML, Map libertyDirPropertyFiles) throws IOException { - if (scd == null || !scd.getServerXML().getCanonicalPath().equals(serverXML.getCanonicalPath())) { - scd = new ServerConfigDocument(log, libertyDirPropertyFiles); + if (scd == null || !scd.getOriginalServerXMLFile().getCanonicalPath().equals(serverXML.getCanonicalPath())) { + scd = new ServerConfigDocument(log, serverXML, libertyDirPropertyFiles); } return scd; From 717cd7a92b03ca25af73773a00fca27ba08cb171 Mon Sep 17 00:00:00 2001 From: Arun Venmany Date: Wed, 13 Nov 2024 18:43:43 +0530 Subject: [PATCH 6/6] rolling back git workflow yaml to point to main Signed-off-by: Arun Venmany --- .github/workflows/maven.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 5ac5da564..2e2ca70a7 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -48,9 +48,8 @@ jobs: - name: Checkout ci.common uses: actions/checkout@v3 with: - repository: arunvenmany-ibm/ci.common + repository: OpenLiberty/ci.common path: ci.common - ref: varProcessing - name: Checkout ci.ant uses: actions/checkout@v3 with: @@ -103,7 +102,7 @@ jobs: - name: Clone ci.ant, ci.common, ci.maven repos to C drive run: | cp -r D:/a/ci.maven/ci.maven C:/ci.maven - git clone https://github.com/arunvenmany-ibm/ci.common.git --branch varProcessing --single-branch C:/ci.common + git clone https://github.com/OpenLiberty/ci.common.git C:/ci.common git clone https://github.com/OpenLiberty/ci.ant.git C:/ci.ant - name: Set up Maven uses: stCarolas/setup-maven@v4.5