From af4c7c1c1a3f21038e1c9e9ebe20f022d9874326 Mon Sep 17 00:00:00 2001 From: labkey-tchad Date: Tue, 7 May 2024 15:29:25 -0700 Subject: [PATCH 1/6] Escape file path properly for properties file --- SequenceAnalysis/build.gradle | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/SequenceAnalysis/build.gradle b/SequenceAnalysis/build.gradle index 41f773aaf..9fa097daf 100644 --- a/SequenceAnalysis/build.gradle +++ b/SequenceAnalysis/build.gradle @@ -177,7 +177,7 @@ dependencies { if (project.findProject(BuildUtils.getTestProjectPath(project.gradle)) != null && project.hasProperty("teamcity")) { project.evaluationDependsOn(BuildUtils.getTestProjectPath(project.gradle)) - def configDir = "${ServerDeployExtension.getServerDeployDirectory(project)}/config" + def configDir = new File(ServerDeployExtension.getServerDeployDirectory(project), "config") def testProject = project.findProject(BuildUtils.getTestProjectPath(project.gradle)) def createPipelineConfigTask = project.tasks.register("createPipelineConfig", Copy) { Copy task -> @@ -197,13 +197,9 @@ if (project.findProject(BuildUtils.getTestProjectPath(project.gradle)) != null & return newLine }) - task.destinationDir = new File(configDir) + task.destinationDir = configDir if (BuildUtils.useEmbeddedTomcat(project)) { - task.doFirst { - new File(new File(BuildUtils.getEmbeddedConfigPath(project)), "application.properties") << "\n${configDir}" - } - rootProject.allprojects { task.mustRunAfter tasks.withType(DoThenSetup) } @@ -213,7 +209,8 @@ if (project.findProject(BuildUtils.getTestProjectPath(project.gradle)) != null & dependsOn(createPipelineConfigTask) if (BuildUtils.useEmbeddedTomcat(project)) { it.doFirst { - new File(new File(BuildUtils.getEmbeddedConfigPath(project)), "application.properties") << "\ncontext.pipelineConfig=${configDir}" + new File(new File(BuildUtils.getEmbeddedConfigPath(project)), "application.properties") + << "\ncontext.pipelineConfig=${configDir.getAbsolutePath().replace("\\", "\\\\")}" } } } From 36e79bab36a2647fe1ea68181416c2131faecd9f Mon Sep 17 00:00:00 2001 From: labkey-tchad Date: Wed, 8 May 2024 10:59:24 -0700 Subject: [PATCH 2/6] Add some debug logging --- .../labkey/sequenceanalysis/SequenceRemoteIntegrationTests.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceRemoteIntegrationTests.java b/SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceRemoteIntegrationTests.java index faa074c82..76197ee07 100644 --- a/SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceRemoteIntegrationTests.java +++ b/SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceRemoteIntegrationTests.java @@ -83,10 +83,12 @@ private File setupConfigDir(File outDir) throws IOException path = path.replaceAll("\\\\", "/"); line = line.replaceAll("@@SEQUENCEANALYSIS_TOOLS@@", path); + _log.info("Writing to pipelineConfig.xml: " + line); } else if (line.contains("@@WORK_DIR@@")) { line = line.replaceAll("@@WORK_DIR@@", outDir.getPath().replaceAll("\\\\", "/")); + _log.info("Writing to pipelineConfig.xml: " + line); } writer.println(line); From 672fba1c395521914e6d632eb2282d377fa064eb Mon Sep 17 00:00:00 2001 From: labkey-tchad Date: Wed, 8 May 2024 11:05:22 -0700 Subject: [PATCH 3/6] Some more logging --- .../labkey/sequenceanalysis/SequenceRemoteIntegrationTests.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceRemoteIntegrationTests.java b/SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceRemoteIntegrationTests.java index 76197ee07..82bcc402e 100644 --- a/SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceRemoteIntegrationTests.java +++ b/SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceRemoteIntegrationTests.java @@ -215,6 +215,8 @@ protected void executeJobRemote(File workDir, @Nullable File jobJson) throws IOE ProcessBuilder pb = new ProcessBuilder(args); pb.directory(workDir); + _log.info("Executing job: " + pb.directory().getAbsolutePath() + " $ " + String.join(" ", pb.command())); + Process proc; try { From c9c66a2fe7472c43fd5502e54b9c2e2ac5c6060a Mon Sep 17 00:00:00 2001 From: labkey-tchad Date: Wed, 8 May 2024 17:02:50 -0700 Subject: [PATCH 4/6] Hack tools dir --- .../labkey/sequenceanalysis/SequenceRemoteIntegrationTests.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceRemoteIntegrationTests.java b/SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceRemoteIntegrationTests.java index 82bcc402e..16fa4ddf5 100644 --- a/SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceRemoteIntegrationTests.java +++ b/SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceRemoteIntegrationTests.java @@ -81,7 +81,7 @@ private File setupConfigDir(File outDir) throws IOException path = PipelineJobService.get().getAppProperties().getToolsDirectory(); } - path = path.replaceAll("\\\\", "/"); + path = path.replaceAll("\\\\", "/").replace("deploy/bin", "deploy/embedded/bin"); line = line.replaceAll("@@SEQUENCEANALYSIS_TOOLS@@", path); _log.info("Writing to pipelineConfig.xml: " + line); } From 24d97795f4f22b7f9ba30dc39f06331dd6f041ce Mon Sep 17 00:00:00 2001 From: labkey-tchad Date: Thu, 9 May 2024 13:16:38 -0700 Subject: [PATCH 5/6] Un-hack tools dir --- .../sequenceanalysis/SequenceRemoteIntegrationTests.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceRemoteIntegrationTests.java b/SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceRemoteIntegrationTests.java index 16fa4ddf5..1beb9388d 100644 --- a/SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceRemoteIntegrationTests.java +++ b/SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceRemoteIntegrationTests.java @@ -81,7 +81,6 @@ private File setupConfigDir(File outDir) throws IOException path = PipelineJobService.get().getAppProperties().getToolsDirectory(); } - path = path.replaceAll("\\\\", "/").replace("deploy/bin", "deploy/embedded/bin"); line = line.replaceAll("@@SEQUENCEANALYSIS_TOOLS@@", path); _log.info("Writing to pipelineConfig.xml: " + line); } @@ -215,7 +214,7 @@ protected void executeJobRemote(File workDir, @Nullable File jobJson) throws IOE ProcessBuilder pb = new ProcessBuilder(args); pb.directory(workDir); - _log.info("Executing job: " + pb.directory().getAbsolutePath() + " $ " + String.join(" ", pb.command())); + _log.info("Executing job in '" + pb.directory().getAbsolutePath() + "': " + String.join(" ", pb.command())); Process proc; try From 1da461c34f81ac1d740e3f7033ec4cc76b8abb3f Mon Sep 17 00:00:00 2001 From: labkey-tchad Date: Thu, 9 May 2024 13:37:51 -0700 Subject: [PATCH 6/6] Don't remove backslash escaping --- .../labkey/sequenceanalysis/SequenceRemoteIntegrationTests.java | 1 + 1 file changed, 1 insertion(+) diff --git a/SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceRemoteIntegrationTests.java b/SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceRemoteIntegrationTests.java index 1beb9388d..3a1ecf590 100644 --- a/SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceRemoteIntegrationTests.java +++ b/SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceRemoteIntegrationTests.java @@ -81,6 +81,7 @@ private File setupConfigDir(File outDir) throws IOException path = PipelineJobService.get().getAppProperties().getToolsDirectory(); } + path = path.replaceAll("\\\\", "/"); line = line.replaceAll("@@SEQUENCEANALYSIS_TOOLS@@", path); _log.info("Writing to pipelineConfig.xml: " + line); }