You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kie.apache.org by "tiagobento (via GitHub)" <gi...@apache.org> on 2025/06/02 21:34:44 UTC

[PR] [DO NOT MERGE] Stop depending on timestamped SNAPSHOTs [incubator-kie-tools]

tiagobento opened a new pull request, #3170:
URL: https://github.com/apache/incubator-kie-tools/pull/3170

   This PR is an attempt to build `drools`, `optaplanner`, `kogito-runtimes`, and `kogito-apps` on-demand, based on Git refs instead of published versions. Skipping most stuff that we can trust is being verified on these repositories' PR checks we're able to reduce our automation load and Apache's Jenkins usage. Even without this cache, developers would have to build it the one time (and it's automatic on `pnpm bootstrap` anyway), so it's just an extra 5-minute wait.
   
   There's one more thing I'd like to do and that is having our CI and PR checks here on `kie-tools` publish a pre-built version of this build, so that developing locally (and PR checks / CI builds too!) is even faster than downloading timestamped SNAPSHOTs from the `apache.snapshots` Maven repository.
   
   There's only one problem with this approach, and that is the JIT Executor native builds, which I think we should be dropping in favor of using a Dockerized version of Extended Services, as proposed by @thiagoelg here: [Zulip > #general > ✔ Issue with Sandbox Extended Services downloads](https://kie.zulipchat.com/#narrow/channel/232659-general/topic/.E2.9C.94.20Issue.20with.20Sandbox.20Extended.20Services.20downloads/with/509959779).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DO NOT MERGE] NO-ISSUE: Stop depending on timestamped SNAPSHOTs [incubator-kie-tools]

Posted by "tiagobento (via GitHub)" <gi...@apache.org>.
tiagobento commented on PR #3170:
URL: https://github.com/apache/incubator-kie-tools/pull/3170#issuecomment-2940767863

   This is ready for review @thiagoelg @porcelli @ricardozanini @yesamer.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] NO-ISSUE: Stop depending on timestamped SNAPSHOTs [incubator-kie-tools]

Posted by "tiagobento (via GitHub)" <gi...@apache.org>.
tiagobento commented on code in PR #3170:
URL: https://github.com/apache/incubator-kie-tools/pull/3170#discussion_r2127089109


##########
packages/drools-and-kogito/install.js:
##########
@@ -0,0 +1,253 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+const execSync = require("child_process").execSync;
+const fs = require("fs");
+const path = require("path");
+const { env } = require("./env");
+const buildEnv = env;
+const execOpts = { stdio: "inherit" };
+
+///
+
+const DIST_REPO = path.resolve("./dist/1st-party-m2/repository");
+
+if (buildEnv.droolsAndKogito.skip) {
+  console.log(`[drools-and-kogito] Skip is on. Exiting.`);
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+}
+
+if (!buildEnv.versions.kogito.endsWith("-local") && !buildEnv.droolsAndKogito.forceBuild) {
+  console.log(`[drools-and-kogito] Detected a non-local version for Drools and Kogito.`);
+  console.log(
+    `[drools-and-kogito] Building will not occur, as this version is expected to be either present on the local Maven repository (E.g., ~/.m2), or published in some publicly available Maven repository so that it can be downloaded.`
+  );
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+}
+
+const buildInfo = getBuildInfo();
+
+console.log(`[drools-and-kogito] Build info:`);
+console.log(JSON.stringify(buildInfo, null, 2));
+
+const buildInfoMatches =
+  buildInfo?.kogitoVersion === buildEnv.versions.kogito &&
+  buildInfo?.droolsRepoGitRef === buildEnv.droolsAndKogito.repos.drools.gitRef &&
+  buildInfo?.optaplannerRepoGitRef === buildEnv.droolsAndKogito.repos.optaplanner.gitRef &&
+  buildInfo?.kogitoRuntimesRepoGitRef === buildEnv.droolsAndKogito.repos.kogitoRuntimes.gitRef &&
+  buildInfo?.kogitoAppsRepoGitRef === buildEnv.droolsAndKogito.repos.kogitoApps.gitRef;
+
+const localM2DirExists = fs.existsSync("./dist/1st-party-m2/repository");
+const forceBuild = buildEnv.droolsAndKogito.forceBuild;
+
+console.log(`[drools-and-kogito] Local m2 exists: ${localM2DirExists}`);
+console.log(`[drools-and-kogito] Build info matches: ${buildInfoMatches}`);
+console.log(`[drools-and-kogito] Force build: ${forceBuild}`);
+
+if (localM2DirExists && buildInfoMatches && !forceBuild) {
+  console.log(`[drools-and-kogito] Nothing to do.`);
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+} else if (localM2DirExists) {
+  console.log(`[drools-and-kogito] Cleaning up 'dist' directory...`);
+  fs.rmSync("./dist", { recursive: true });
+}
+fs.mkdirSync("./dist", { recursive: true });
+
+// TODO: cache restoration
+
+console.log(`[drools-and-kogito] Cleaning up 'dist' directory...`);
+if (fs.existsSync("./dist-tmp")) {
+  fs.rmSync("./dist-tmp", { recursive: true });
+}
+fs.mkdirSync("./dist-tmp", { recursive: true });
+
+// cloning
+
+const droolsRepoDir = path.join("dist-tmp", "drools");
+const optaplannerRepoDir = path.join("dist-tmp", "optaplanner");
+const kogitoRuntimesRepoDir = path.join("dist-tmp", "kogito-runtimes");
+const kogitoAppsRepoDir = path.join("dist-tmp", "kogito-apps");
+
+console.log(`[drools-and-kogito] Cloning Drools...`);
+
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.drools.url} "${droolsRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.drools.gitRef}`, {
+  ...execOpts,
+  cwd: droolsRepoDir,
+});
+
+console.log(`[drools-and-kogito] Cloning OptaPlanner...`);
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.optaplanner.url} "${optaplannerRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.optaplanner.gitRef}`, {
+  ...execOpts,
+  cwd: optaplannerRepoDir,
+});
+
+console.log(`[drools-and-kogito] Cloning Kogito Runtimes...`);
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.kogitoRuntimes.url} "${kogitoRuntimesRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.kogitoRuntimes.gitRef}`, {
+  ...execOpts,
+  cwd: kogitoRuntimesRepoDir,
+});
+
+console.log(`[drools-and-kogito] Cloning Kogito Apps...`);
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.kogitoApps.url} "${kogitoAppsRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.kogitoApps.gitRef}`, {
+  ...execOpts,
+  cwd: kogitoAppsRepoDir,
+});
+
+// update versions
+const streamsMavenVersion =
+  buildEnv.root.streamName === "main"
+    ? `999-SNAPSHOT` //
+    : buildEnv.root.streamName.replace(".x", ".999-SNAPSHOT"); // 10.1.x becomes 10.1.999-SNAPSHOT
+
+console.log(`[drools-and-kogito] Updating versions to ${streamsMavenVersion}...`);
+execSync(`find . -name "pom.xml" -exec sed -i.bak "s/${streamsMavenVersion}/${buildEnv.versions.kogito}/g" {} ";"`, {

Review Comment:
   Same comment as below @porcelli.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] NO-ISSUE: Stop depending on timestamped SNAPSHOTs [incubator-kie-tools]

Posted by "tiagobento (via GitHub)" <gi...@apache.org>.
tiagobento commented on PR #3170:
URL: https://github.com/apache/incubator-kie-tools/pull/3170#issuecomment-2963882687

   PR sent --> https://github.com/apache/incubator-kie-tools/pull/3177


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] NO-ISSUE: Stop depending on timestamped SNAPSHOTs [incubator-kie-tools]

Posted by "thiagoelg (via GitHub)" <gi...@apache.org>.
thiagoelg commented on PR #3170:
URL: https://github.com/apache/incubator-kie-tools/pull/3170#issuecomment-2944634674

   @ricardozanini, there seem to be some errors with the e2e tests of the `swf-vscode-extension`, but I'm not sure what could be causing them... are they just flaky?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] NO-ISSUE: Stop depending on timestamped SNAPSHOTs [incubator-kie-tools]

Posted by "handreyrc (via GitHub)" <gi...@apache.org>.
handreyrc commented on PR #3170:
URL: https://github.com/apache/incubator-kie-tools/pull/3170#issuecomment-2950867919

   Hey @thiagoelg,
   
   I took a look at those two failing tests and I can say that I faced similar timeout issues  in the past.  I triggered the build again some time later and I got through them.
   I also took a look at the latest job and we have a different error there. It seems it couldn't download a resource. 
   
   I  would retrigger the build a couple of times and check if we have those same tests failing or same resource download issue. IMO it seems more an env issue than a code issue, so far.   
   
   WDYT?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] NO-ISSUE: Stop depending on timestamped SNAPSHOTs [incubator-kie-tools]

Posted by "handreyrc (via GitHub)" <gi...@apache.org>.
handreyrc commented on PR #3170:
URL: https://github.com/apache/incubator-kie-tools/pull/3170#issuecomment-2959628979

   @thiagoelg,
   I see we have some changes in the env we do not have in our 10.0.0 release like  JVM opts and I see that "workspace" is now a direct dependency. Anyway, my guess is if somehow the test execution in the CI gets slower it may affect those tests since they are a click and wait thing. 
   I will use this PR as base and work on it. 
   I will let you know once I have have more info to share.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] NO-ISSUE: Stop depending on timestamped SNAPSHOTs [incubator-kie-tools]

Posted by "handreyrc (via GitHub)" <gi...@apache.org>.
handreyrc commented on PR #3170:
URL: https://github.com/apache/incubator-kie-tools/pull/3170#issuecomment-2963975527

   Issue for the failing tests:
   [3178](https://github.com/apache/incubator-kie-tools/issues/3178)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] NO-ISSUE: Stop depending on timestamped SNAPSHOTs [incubator-kie-tools]

Posted by "handreyrc (via GitHub)" <gi...@apache.org>.
handreyrc commented on PR #3170:
URL: https://github.com/apache/incubator-kie-tools/pull/3170#issuecomment-2956889994

   Hey @domhanak,
   
   I remember we had similar issues with tests failing and Selenium timeouts in the past. As you can see in the job logs it is about auto-complete dopdown boxes in text editor (monaco). If you test them manualy or run those tests locally they work ,however ,  they fail in the CI. Do you remember how it was solved? Any clue? 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DO NOT MERGE] NO-ISSUE: Stop depending on timestamped SNAPSHOTs [incubator-kie-tools]

Posted by "github-advanced-security[bot] (via GitHub)" <gi...@apache.org>.
github-advanced-security[bot] commented on code in PR #3170:
URL: https://github.com/apache/incubator-kie-tools/pull/3170#discussion_r2122211836


##########
packages/drools-and-kogito/build.js:
##########
@@ -0,0 +1,214 @@
+#!/bin/bash -el \n node
+
+const execSync = require("child_process").execSync;
+const fs = require("fs");
+const path = require("path");
+const execOpts = { stdio: "inherit" };
+const { env } = require("./env");
+const buildEnv = env;
+
+///
+
+const DIST_REPO = path.resolve("./dist/1st-party-m2/repository");
+
+if (buildEnv.droolsAndKogito.skip) {
+  console.log(`[drools-and-kogito] Skip is on. Exiting.`);
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+}
+
+if (!buildEnv.versions.kogito.endsWith("-local") && !buildEnv.droolsAndKogito.forceBuild) {
+  console.log(`[drools-and-kogito] Detected a non-local version for Drools and Kogito.`);
+  console.log(
+    `[drools-and-kogito] Building will not occur, as this version is expected to be either present on the local Maven repository (E.g., ~/.m2), or published in some publicly available Maven repository so that it can be downloaded.`
+  );
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+}
+
+const buildInfo = getBuildInfo();
+
+console.log();
+
+const buildInfoMatches =
+  buildInfo?.kogitoVersion === buildEnv.versions.kogito &&
+  buildInfo?.droolsRepoGitRef === buildEnv.droolsAndKogito.repos.drools.gitRef &&
+  buildInfo?.optaplannerRepoGitRef === buildEnv.droolsAndKogito.repos.optaplanner.gitRef &&
+  buildInfo?.kogitoRuntimesRepoGitRef === buildEnv.droolsAndKogito.repos.kogitoRuntimes.gitRef &&
+  buildInfo?.kogitoAppsRepoGitRef === buildEnv.droolsAndKogito.repos.kogitoApps.gitRef;
+
+const localM2DirExists = fs.existsSync("./dist/1st-party-m2/repository");
+const forceBuild = buildEnv.droolsAndKogito.forceBuild;
+
+console.log(`[drools-and-kogito] Local m2 exists: ${localM2DirExists}`);
+console.log(`[drools-and-kogito] Build info matches: ${buildInfoMatches}`);
+console.log(`[drools-and-kogito] Force build: ${forceBuild}`);
+
+if (localM2DirExists && buildInfoMatches && !forceBuild) {
+  console.log(`[drools-and-kogito] Nothing to do. Exiting.`);
+  process.exit(0);
+} else {
+  console.log(`[drools-and-kogito] Cleaning up 'dist' and 'dist-tmp' directories...`);
+  fs.rmSync("./dist", { recursive: true });
+}
+
+fs.mkdirSync("./dist", { recursive: true });
+
+if (fs.existsSync("./dist-tmp")) {
+  fs.rmSync("./dist-tmp", { recursive: true });
+}
+fs.mkdirSync("./dist-tmp", { recursive: true });
+
+// cloning
+
+console.log(`[drools-and-kogito] Cloning Drools...`);
+execSync(
+  `git clone $(build-env droolsAndKogito.repos.drools.url) --branch $(build-env root.streamName) --depth 50 ./dist-tmp/drools`,
+  execOpts
+);
+execSync(`git checkout $(build-env droolsAndKogito.repos.drools.gitRef)`, {
+  ...execOpts,
+  cwd: "./dist-tmp/drools",
+});
+
+console.log(`[drools-and-kogito] Cloning OptaPlanner...`);
+execSync(
+  `git clone $(build-env droolsAndKogito.repos.optaplanner.url) --branch $(build-env root.streamName) --depth 50 ./dist-tmp/optaplanner`,
+  execOpts
+);
+execSync(`git checkout $(build-env droolsAndKogito.repos.optaplanner.gitRef)`, {
+  ...execOpts,
+  cwd: "./dist-tmp/optaplanner",
+});
+
+console.log(`[drools-and-kogito] Cloning Kogito Runtimes...`);
+execSync(
+  `git clone $(build-env droolsAndKogito.repos.kogitoRuntimes.url) --branch $(build-env root.streamName) --depth 50 ./dist-tmp/kogito-runtimes`,
+  execOpts
+);
+execSync(`git checkout $(build-env droolsAndKogito.repos.kogitoRuntimes.gitRef)`, {
+  ...execOpts,
+  cwd: "./dist-tmp/kogito-runtimes",
+});
+
+console.log(`[drools-and-kogito] Cloning Kogito Apps...`);
+execSync(
+  `git clone $(build-env droolsAndKogito.repos.kogitoApps.url) --branch $(build-env root.streamName) --depth 50 ./dist-tmp/kogito-apps`,
+  execOpts
+);
+execSync(`git checkout $(build-env droolsAndKogito.repos.kogitoApps.gitRef)`, {
+  ...execOpts,
+  cwd: "./dist-tmp/kogito-apps",
+});
+
+// update versions
+const streamsMavenVersion =
+  buildEnv.root.streamName === "main"
+    ? `999-SNAPSHOT` //
+    : buildEnv.root.streamName.replace(".x", ".999-SNAPSHOT"); // 10.1.x becomes 10.1.999-SNAPSHOT
+
+console.log(`[drools-and-kogito] Updating versions to ${streamsMavenVersion}...`);
+execSync(
+  `find . -name "pom.xml" -exec sed -i.bak 's/${streamsMavenVersion}/${buildEnv.versions.kogito}/g' {} \\; -exec rm {}.bak \\;`,
+  {
+    ...execOpts,
+    cwd: "./dist-tmp",
+  }
+);
+
+// patching
+console.log(`[drools-and-kogito] Patching pom.xml files to remove Tests and Integration Tests modules...`);
+removeMavenModule(`drools\\-test\\-coverage`);
+removeMavenModule(`.*\\-integration\\-tests`);
+removeMavenModule(`integration\\-tests`);
+removeMavenModule(`.*\\-integration\\-test`);
+removeMavenModule(`.*\\-integration\\-test\\-.*`);
+removeMavenModule(`.*\\-integrationtests`);
+removeMavenModule(`.*integration\\-tests\\-.*`);
+removeMavenModule(`.*\\-integrationtest`);
+removeMavenModule(`.*\\-it`);
+removeMavenModule(`kie\\-archetypes`);
+removeMavenModule(`apps\\-integration\\-tests`);
+
+// building
+
+console.log(`[drools-and-kogito] Building Drools...`);
+execSync(
+  `mvn deploy -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -DaltDeploymentRepository=snapshot-repo::default::file:${DIST_REPO}`,

Review Comment:
   ## Shell command built from environment values
   
   This shell command depends on an uncontrolled [absolute path](1).
   
   [Show more details](https://github.com/apache/incubator-kie-tools/security/code-scanning/1022)



##########
packages/drools-and-kogito/build.js:
##########
@@ -0,0 +1,214 @@
+#!/bin/bash -el \n node
+
+const execSync = require("child_process").execSync;
+const fs = require("fs");
+const path = require("path");
+const execOpts = { stdio: "inherit" };
+const { env } = require("./env");
+const buildEnv = env;
+
+///
+
+const DIST_REPO = path.resolve("./dist/1st-party-m2/repository");
+
+if (buildEnv.droolsAndKogito.skip) {
+  console.log(`[drools-and-kogito] Skip is on. Exiting.`);
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+}
+
+if (!buildEnv.versions.kogito.endsWith("-local") && !buildEnv.droolsAndKogito.forceBuild) {
+  console.log(`[drools-and-kogito] Detected a non-local version for Drools and Kogito.`);
+  console.log(
+    `[drools-and-kogito] Building will not occur, as this version is expected to be either present on the local Maven repository (E.g., ~/.m2), or published in some publicly available Maven repository so that it can be downloaded.`
+  );
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+}
+
+const buildInfo = getBuildInfo();
+
+console.log();
+
+const buildInfoMatches =
+  buildInfo?.kogitoVersion === buildEnv.versions.kogito &&
+  buildInfo?.droolsRepoGitRef === buildEnv.droolsAndKogito.repos.drools.gitRef &&
+  buildInfo?.optaplannerRepoGitRef === buildEnv.droolsAndKogito.repos.optaplanner.gitRef &&
+  buildInfo?.kogitoRuntimesRepoGitRef === buildEnv.droolsAndKogito.repos.kogitoRuntimes.gitRef &&
+  buildInfo?.kogitoAppsRepoGitRef === buildEnv.droolsAndKogito.repos.kogitoApps.gitRef;
+
+const localM2DirExists = fs.existsSync("./dist/1st-party-m2/repository");
+const forceBuild = buildEnv.droolsAndKogito.forceBuild;
+
+console.log(`[drools-and-kogito] Local m2 exists: ${localM2DirExists}`);
+console.log(`[drools-and-kogito] Build info matches: ${buildInfoMatches}`);
+console.log(`[drools-and-kogito] Force build: ${forceBuild}`);
+
+if (localM2DirExists && buildInfoMatches && !forceBuild) {
+  console.log(`[drools-and-kogito] Nothing to do. Exiting.`);
+  process.exit(0);
+} else {
+  console.log(`[drools-and-kogito] Cleaning up 'dist' and 'dist-tmp' directories...`);
+  fs.rmSync("./dist", { recursive: true });
+}
+
+fs.mkdirSync("./dist", { recursive: true });
+
+if (fs.existsSync("./dist-tmp")) {
+  fs.rmSync("./dist-tmp", { recursive: true });
+}
+fs.mkdirSync("./dist-tmp", { recursive: true });
+
+// cloning
+
+console.log(`[drools-and-kogito] Cloning Drools...`);
+execSync(
+  `git clone $(build-env droolsAndKogito.repos.drools.url) --branch $(build-env root.streamName) --depth 50 ./dist-tmp/drools`,
+  execOpts
+);
+execSync(`git checkout $(build-env droolsAndKogito.repos.drools.gitRef)`, {
+  ...execOpts,
+  cwd: "./dist-tmp/drools",
+});
+
+console.log(`[drools-and-kogito] Cloning OptaPlanner...`);
+execSync(
+  `git clone $(build-env droolsAndKogito.repos.optaplanner.url) --branch $(build-env root.streamName) --depth 50 ./dist-tmp/optaplanner`,
+  execOpts
+);
+execSync(`git checkout $(build-env droolsAndKogito.repos.optaplanner.gitRef)`, {
+  ...execOpts,
+  cwd: "./dist-tmp/optaplanner",
+});
+
+console.log(`[drools-and-kogito] Cloning Kogito Runtimes...`);
+execSync(
+  `git clone $(build-env droolsAndKogito.repos.kogitoRuntimes.url) --branch $(build-env root.streamName) --depth 50 ./dist-tmp/kogito-runtimes`,
+  execOpts
+);
+execSync(`git checkout $(build-env droolsAndKogito.repos.kogitoRuntimes.gitRef)`, {
+  ...execOpts,
+  cwd: "./dist-tmp/kogito-runtimes",
+});
+
+console.log(`[drools-and-kogito] Cloning Kogito Apps...`);
+execSync(
+  `git clone $(build-env droolsAndKogito.repos.kogitoApps.url) --branch $(build-env root.streamName) --depth 50 ./dist-tmp/kogito-apps`,
+  execOpts
+);
+execSync(`git checkout $(build-env droolsAndKogito.repos.kogitoApps.gitRef)`, {
+  ...execOpts,
+  cwd: "./dist-tmp/kogito-apps",
+});
+
+// update versions
+const streamsMavenVersion =
+  buildEnv.root.streamName === "main"
+    ? `999-SNAPSHOT` //
+    : buildEnv.root.streamName.replace(".x", ".999-SNAPSHOT"); // 10.1.x becomes 10.1.999-SNAPSHOT
+
+console.log(`[drools-and-kogito] Updating versions to ${streamsMavenVersion}...`);
+execSync(
+  `find . -name "pom.xml" -exec sed -i.bak 's/${streamsMavenVersion}/${buildEnv.versions.kogito}/g' {} \\; -exec rm {}.bak \\;`,
+  {
+    ...execOpts,
+    cwd: "./dist-tmp",
+  }
+);
+
+// patching
+console.log(`[drools-and-kogito] Patching pom.xml files to remove Tests and Integration Tests modules...`);
+removeMavenModule(`drools\\-test\\-coverage`);
+removeMavenModule(`.*\\-integration\\-tests`);
+removeMavenModule(`integration\\-tests`);
+removeMavenModule(`.*\\-integration\\-test`);
+removeMavenModule(`.*\\-integration\\-test\\-.*`);
+removeMavenModule(`.*\\-integrationtests`);
+removeMavenModule(`.*integration\\-tests\\-.*`);
+removeMavenModule(`.*\\-integrationtest`);
+removeMavenModule(`.*\\-it`);
+removeMavenModule(`kie\\-archetypes`);
+removeMavenModule(`apps\\-integration\\-tests`);
+
+// building
+
+console.log(`[drools-and-kogito] Building Drools...`);
+execSync(
+  `mvn deploy -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -DaltDeploymentRepository=snapshot-repo::default::file:${DIST_REPO}`,
+  {
+    ...execOpts,
+    cwd: "./dist-tmp/drools",
+  }
+);
+
+console.log(`[drools-and-kogito] Building OptaPlanner...`);
+execSync(
+  `mvn deploy -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -Dmaven.repo.local.tail=${path.resolve("./dist/1st-party-m2/repository")} -DaltDeploymentRepository=snapshot-repo::default::file:${DIST_REPO}`,
+  {
+    ...execOpts,
+    cwd: "./dist-tmp/optaplanner",
+  }
+);
+
+console.log(`[drools-and-kogito] Building Kogito Runtimes...`);
+execSync(
+  `mvn deploy -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -Dmaven.repo.local.tail=${path.resolve("./dist/1st-party-m2/repository")} -DaltDeploymentRepository=snapshot-repo::default::file:${DIST_REPO}`,

Review Comment:
   ## Shell command built from environment values
   
   This shell command depends on an uncontrolled [absolute path](1).
   This shell command depends on an uncontrolled [absolute path](2).
   
   [Show more details](https://github.com/apache/incubator-kie-tools/security/code-scanning/1024)



##########
packages/drools-and-kogito/build.js:
##########
@@ -0,0 +1,214 @@
+#!/bin/bash -el \n node
+
+const execSync = require("child_process").execSync;
+const fs = require("fs");
+const path = require("path");
+const execOpts = { stdio: "inherit" };
+const { env } = require("./env");
+const buildEnv = env;
+
+///
+
+const DIST_REPO = path.resolve("./dist/1st-party-m2/repository");
+
+if (buildEnv.droolsAndKogito.skip) {
+  console.log(`[drools-and-kogito] Skip is on. Exiting.`);
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+}
+
+if (!buildEnv.versions.kogito.endsWith("-local") && !buildEnv.droolsAndKogito.forceBuild) {
+  console.log(`[drools-and-kogito] Detected a non-local version for Drools and Kogito.`);
+  console.log(
+    `[drools-and-kogito] Building will not occur, as this version is expected to be either present on the local Maven repository (E.g., ~/.m2), or published in some publicly available Maven repository so that it can be downloaded.`
+  );
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+}
+
+const buildInfo = getBuildInfo();
+
+console.log();
+
+const buildInfoMatches =
+  buildInfo?.kogitoVersion === buildEnv.versions.kogito &&
+  buildInfo?.droolsRepoGitRef === buildEnv.droolsAndKogito.repos.drools.gitRef &&
+  buildInfo?.optaplannerRepoGitRef === buildEnv.droolsAndKogito.repos.optaplanner.gitRef &&
+  buildInfo?.kogitoRuntimesRepoGitRef === buildEnv.droolsAndKogito.repos.kogitoRuntimes.gitRef &&
+  buildInfo?.kogitoAppsRepoGitRef === buildEnv.droolsAndKogito.repos.kogitoApps.gitRef;
+
+const localM2DirExists = fs.existsSync("./dist/1st-party-m2/repository");
+const forceBuild = buildEnv.droolsAndKogito.forceBuild;
+
+console.log(`[drools-and-kogito] Local m2 exists: ${localM2DirExists}`);
+console.log(`[drools-and-kogito] Build info matches: ${buildInfoMatches}`);
+console.log(`[drools-and-kogito] Force build: ${forceBuild}`);
+
+if (localM2DirExists && buildInfoMatches && !forceBuild) {
+  console.log(`[drools-and-kogito] Nothing to do. Exiting.`);
+  process.exit(0);
+} else {
+  console.log(`[drools-and-kogito] Cleaning up 'dist' and 'dist-tmp' directories...`);
+  fs.rmSync("./dist", { recursive: true });
+}
+
+fs.mkdirSync("./dist", { recursive: true });
+
+if (fs.existsSync("./dist-tmp")) {
+  fs.rmSync("./dist-tmp", { recursive: true });
+}
+fs.mkdirSync("./dist-tmp", { recursive: true });
+
+// cloning
+
+console.log(`[drools-and-kogito] Cloning Drools...`);
+execSync(
+  `git clone $(build-env droolsAndKogito.repos.drools.url) --branch $(build-env root.streamName) --depth 50 ./dist-tmp/drools`,
+  execOpts
+);
+execSync(`git checkout $(build-env droolsAndKogito.repos.drools.gitRef)`, {
+  ...execOpts,
+  cwd: "./dist-tmp/drools",
+});
+
+console.log(`[drools-and-kogito] Cloning OptaPlanner...`);
+execSync(
+  `git clone $(build-env droolsAndKogito.repos.optaplanner.url) --branch $(build-env root.streamName) --depth 50 ./dist-tmp/optaplanner`,
+  execOpts
+);
+execSync(`git checkout $(build-env droolsAndKogito.repos.optaplanner.gitRef)`, {
+  ...execOpts,
+  cwd: "./dist-tmp/optaplanner",
+});
+
+console.log(`[drools-and-kogito] Cloning Kogito Runtimes...`);
+execSync(
+  `git clone $(build-env droolsAndKogito.repos.kogitoRuntimes.url) --branch $(build-env root.streamName) --depth 50 ./dist-tmp/kogito-runtimes`,
+  execOpts
+);
+execSync(`git checkout $(build-env droolsAndKogito.repos.kogitoRuntimes.gitRef)`, {
+  ...execOpts,
+  cwd: "./dist-tmp/kogito-runtimes",
+});
+
+console.log(`[drools-and-kogito] Cloning Kogito Apps...`);
+execSync(
+  `git clone $(build-env droolsAndKogito.repos.kogitoApps.url) --branch $(build-env root.streamName) --depth 50 ./dist-tmp/kogito-apps`,
+  execOpts
+);
+execSync(`git checkout $(build-env droolsAndKogito.repos.kogitoApps.gitRef)`, {
+  ...execOpts,
+  cwd: "./dist-tmp/kogito-apps",
+});
+
+// update versions
+const streamsMavenVersion =
+  buildEnv.root.streamName === "main"
+    ? `999-SNAPSHOT` //
+    : buildEnv.root.streamName.replace(".x", ".999-SNAPSHOT"); // 10.1.x becomes 10.1.999-SNAPSHOT
+
+console.log(`[drools-and-kogito] Updating versions to ${streamsMavenVersion}...`);
+execSync(
+  `find . -name "pom.xml" -exec sed -i.bak 's/${streamsMavenVersion}/${buildEnv.versions.kogito}/g' {} \\; -exec rm {}.bak \\;`,
+  {
+    ...execOpts,
+    cwd: "./dist-tmp",
+  }
+);
+
+// patching
+console.log(`[drools-and-kogito] Patching pom.xml files to remove Tests and Integration Tests modules...`);
+removeMavenModule(`drools\\-test\\-coverage`);
+removeMavenModule(`.*\\-integration\\-tests`);
+removeMavenModule(`integration\\-tests`);
+removeMavenModule(`.*\\-integration\\-test`);
+removeMavenModule(`.*\\-integration\\-test\\-.*`);
+removeMavenModule(`.*\\-integrationtests`);
+removeMavenModule(`.*integration\\-tests\\-.*`);
+removeMavenModule(`.*\\-integrationtest`);
+removeMavenModule(`.*\\-it`);
+removeMavenModule(`kie\\-archetypes`);
+removeMavenModule(`apps\\-integration\\-tests`);
+
+// building
+
+console.log(`[drools-and-kogito] Building Drools...`);
+execSync(
+  `mvn deploy -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -DaltDeploymentRepository=snapshot-repo::default::file:${DIST_REPO}`,
+  {
+    ...execOpts,
+    cwd: "./dist-tmp/drools",
+  }
+);
+
+console.log(`[drools-and-kogito] Building OptaPlanner...`);
+execSync(
+  `mvn deploy -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -Dmaven.repo.local.tail=${path.resolve("./dist/1st-party-m2/repository")} -DaltDeploymentRepository=snapshot-repo::default::file:${DIST_REPO}`,
+  {
+    ...execOpts,
+    cwd: "./dist-tmp/optaplanner",
+  }
+);
+
+console.log(`[drools-and-kogito] Building Kogito Runtimes...`);
+execSync(
+  `mvn deploy -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -Dmaven.repo.local.tail=${path.resolve("./dist/1st-party-m2/repository")} -DaltDeploymentRepository=snapshot-repo::default::file:${DIST_REPO}`,
+  {
+    ...execOpts,
+    cwd: "./dist-tmp/kogito-runtimes",
+  }
+);
+
+console.log(`[drools-and-kogito] Building Kogito Apps...`);
+execSync(
+  `mvn deploy -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -Dmaven.repo.local.tail=${path.resolve("./dist/1st-party-m2/repository")} -DaltDeploymentRepository=snapshot-repo::default::file:${DIST_REPO} -Dquarkus.container-image.build=false`,

Review Comment:
   ## Shell command built from environment values
   
   This shell command depends on an uncontrolled [absolute path](1).
   This shell command depends on an uncontrolled [absolute path](2).
   
   [Show more details](https://github.com/apache/incubator-kie-tools/security/code-scanning/1025)



##########
packages/drools-and-kogito/build.js:
##########
@@ -0,0 +1,214 @@
+#!/bin/bash -el \n node
+
+const execSync = require("child_process").execSync;
+const fs = require("fs");
+const path = require("path");
+const execOpts = { stdio: "inherit" };
+const { env } = require("./env");
+const buildEnv = env;
+
+///
+
+const DIST_REPO = path.resolve("./dist/1st-party-m2/repository");
+
+if (buildEnv.droolsAndKogito.skip) {
+  console.log(`[drools-and-kogito] Skip is on. Exiting.`);
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+}
+
+if (!buildEnv.versions.kogito.endsWith("-local") && !buildEnv.droolsAndKogito.forceBuild) {
+  console.log(`[drools-and-kogito] Detected a non-local version for Drools and Kogito.`);
+  console.log(
+    `[drools-and-kogito] Building will not occur, as this version is expected to be either present on the local Maven repository (E.g., ~/.m2), or published in some publicly available Maven repository so that it can be downloaded.`
+  );
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+}
+
+const buildInfo = getBuildInfo();
+
+console.log();
+
+const buildInfoMatches =
+  buildInfo?.kogitoVersion === buildEnv.versions.kogito &&
+  buildInfo?.droolsRepoGitRef === buildEnv.droolsAndKogito.repos.drools.gitRef &&
+  buildInfo?.optaplannerRepoGitRef === buildEnv.droolsAndKogito.repos.optaplanner.gitRef &&
+  buildInfo?.kogitoRuntimesRepoGitRef === buildEnv.droolsAndKogito.repos.kogitoRuntimes.gitRef &&
+  buildInfo?.kogitoAppsRepoGitRef === buildEnv.droolsAndKogito.repos.kogitoApps.gitRef;
+
+const localM2DirExists = fs.existsSync("./dist/1st-party-m2/repository");
+const forceBuild = buildEnv.droolsAndKogito.forceBuild;
+
+console.log(`[drools-and-kogito] Local m2 exists: ${localM2DirExists}`);
+console.log(`[drools-and-kogito] Build info matches: ${buildInfoMatches}`);
+console.log(`[drools-and-kogito] Force build: ${forceBuild}`);
+
+if (localM2DirExists && buildInfoMatches && !forceBuild) {
+  console.log(`[drools-and-kogito] Nothing to do. Exiting.`);
+  process.exit(0);
+} else {
+  console.log(`[drools-and-kogito] Cleaning up 'dist' and 'dist-tmp' directories...`);
+  fs.rmSync("./dist", { recursive: true });
+}
+
+fs.mkdirSync("./dist", { recursive: true });
+
+if (fs.existsSync("./dist-tmp")) {
+  fs.rmSync("./dist-tmp", { recursive: true });
+}
+fs.mkdirSync("./dist-tmp", { recursive: true });
+
+// cloning
+
+console.log(`[drools-and-kogito] Cloning Drools...`);
+execSync(
+  `git clone $(build-env droolsAndKogito.repos.drools.url) --branch $(build-env root.streamName) --depth 50 ./dist-tmp/drools`,
+  execOpts
+);
+execSync(`git checkout $(build-env droolsAndKogito.repos.drools.gitRef)`, {
+  ...execOpts,
+  cwd: "./dist-tmp/drools",
+});
+
+console.log(`[drools-and-kogito] Cloning OptaPlanner...`);
+execSync(
+  `git clone $(build-env droolsAndKogito.repos.optaplanner.url) --branch $(build-env root.streamName) --depth 50 ./dist-tmp/optaplanner`,
+  execOpts
+);
+execSync(`git checkout $(build-env droolsAndKogito.repos.optaplanner.gitRef)`, {
+  ...execOpts,
+  cwd: "./dist-tmp/optaplanner",
+});
+
+console.log(`[drools-and-kogito] Cloning Kogito Runtimes...`);
+execSync(
+  `git clone $(build-env droolsAndKogito.repos.kogitoRuntimes.url) --branch $(build-env root.streamName) --depth 50 ./dist-tmp/kogito-runtimes`,
+  execOpts
+);
+execSync(`git checkout $(build-env droolsAndKogito.repos.kogitoRuntimes.gitRef)`, {
+  ...execOpts,
+  cwd: "./dist-tmp/kogito-runtimes",
+});
+
+console.log(`[drools-and-kogito] Cloning Kogito Apps...`);
+execSync(
+  `git clone $(build-env droolsAndKogito.repos.kogitoApps.url) --branch $(build-env root.streamName) --depth 50 ./dist-tmp/kogito-apps`,
+  execOpts
+);
+execSync(`git checkout $(build-env droolsAndKogito.repos.kogitoApps.gitRef)`, {
+  ...execOpts,
+  cwd: "./dist-tmp/kogito-apps",
+});
+
+// update versions
+const streamsMavenVersion =
+  buildEnv.root.streamName === "main"
+    ? `999-SNAPSHOT` //
+    : buildEnv.root.streamName.replace(".x", ".999-SNAPSHOT"); // 10.1.x becomes 10.1.999-SNAPSHOT
+
+console.log(`[drools-and-kogito] Updating versions to ${streamsMavenVersion}...`);
+execSync(
+  `find . -name "pom.xml" -exec sed -i.bak 's/${streamsMavenVersion}/${buildEnv.versions.kogito}/g' {} \\; -exec rm {}.bak \\;`,
+  {
+    ...execOpts,
+    cwd: "./dist-tmp",
+  }
+);
+
+// patching
+console.log(`[drools-and-kogito] Patching pom.xml files to remove Tests and Integration Tests modules...`);
+removeMavenModule(`drools\\-test\\-coverage`);
+removeMavenModule(`.*\\-integration\\-tests`);
+removeMavenModule(`integration\\-tests`);
+removeMavenModule(`.*\\-integration\\-test`);
+removeMavenModule(`.*\\-integration\\-test\\-.*`);
+removeMavenModule(`.*\\-integrationtests`);
+removeMavenModule(`.*integration\\-tests\\-.*`);
+removeMavenModule(`.*\\-integrationtest`);
+removeMavenModule(`.*\\-it`);
+removeMavenModule(`kie\\-archetypes`);
+removeMavenModule(`apps\\-integration\\-tests`);
+
+// building
+
+console.log(`[drools-and-kogito] Building Drools...`);
+execSync(
+  `mvn deploy -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -DaltDeploymentRepository=snapshot-repo::default::file:${DIST_REPO}`,
+  {
+    ...execOpts,
+    cwd: "./dist-tmp/drools",
+  }
+);
+
+console.log(`[drools-and-kogito] Building OptaPlanner...`);
+execSync(
+  `mvn deploy -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -Dmaven.repo.local.tail=${path.resolve("./dist/1st-party-m2/repository")} -DaltDeploymentRepository=snapshot-repo::default::file:${DIST_REPO}`,

Review Comment:
   ## Shell command built from environment values
   
   This shell command depends on an uncontrolled [absolute path](1).
   This shell command depends on an uncontrolled [absolute path](2).
   
   [Show more details](https://github.com/apache/incubator-kie-tools/security/code-scanning/1023)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DO NOT MERGE] NO-ISSUE: Stop depending on timestamped SNAPSHOTs [incubator-kie-tools]

Posted by "github-advanced-security[bot] (via GitHub)" <gi...@apache.org>.
github-advanced-security[bot] commented on code in PR #3170:
URL: https://github.com/apache/incubator-kie-tools/pull/3170#discussion_r2122595553


##########
packages/drools-and-kogito/install.js:
##########
@@ -0,0 +1,228 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+const execSync = require("child_process").execSync;
+const fs = require("fs");
+const path = require("path");
+const execOpts = { stdio: "inherit" };
+const { env } = require("./env");
+const buildEnv = env;
+
+///
+
+const DIST_REPO = path.resolve("./dist/1st-party-m2/repository");
+
+if (buildEnv.droolsAndKogito.skip) {
+  console.log(`[drools-and-kogito] Skip is on. Exiting.`);
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+}
+
+if (!buildEnv.versions.kogito.endsWith("-local") && !buildEnv.droolsAndKogito.forceBuild) {
+  console.log(`[drools-and-kogito] Detected a non-local version for Drools and Kogito.`);
+  console.log(
+    `[drools-and-kogito] Building will not occur, as this version is expected to be either present on the local Maven repository (E.g., ~/.m2), or published in some publicly available Maven repository so that it can be downloaded.`
+  );
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+}
+
+const buildInfo = getBuildInfo();
+
+console.log();
+
+const buildInfoMatches =
+  buildInfo?.kogitoVersion === buildEnv.versions.kogito &&
+  buildInfo?.droolsRepoGitRef === buildEnv.droolsAndKogito.repos.drools.gitRef &&
+  buildInfo?.optaplannerRepoGitRef === buildEnv.droolsAndKogito.repos.optaplanner.gitRef &&
+  buildInfo?.kogitoRuntimesRepoGitRef === buildEnv.droolsAndKogito.repos.kogitoRuntimes.gitRef &&
+  buildInfo?.kogitoAppsRepoGitRef === buildEnv.droolsAndKogito.repos.kogitoApps.gitRef;
+
+const localM2DirExists = fs.existsSync("./dist/1st-party-m2/repository");
+const forceBuild = buildEnv.droolsAndKogito.forceBuild;
+
+console.log(`[drools-and-kogito] Local m2 exists: ${localM2DirExists}`);
+console.log(`[drools-and-kogito] Build info matches: ${buildInfoMatches}`);
+console.log(`[drools-and-kogito] Force build: ${forceBuild}`);
+
+if (localM2DirExists && buildInfoMatches && !forceBuild) {
+  console.log(`[drools-and-kogito] Nothing to do. Exiting.`);
+  process.exit(0);
+} else if (localM2DirExists) {
+  console.log(`[drools-and-kogito] Cleaning up 'dist' and 'dist-tmp' directories...`);
+  fs.rmSync("./dist", { recursive: true });
+}
+
+fs.mkdirSync("./dist", { recursive: true });
+
+if (fs.existsSync("./dist-tmp")) {
+  fs.rmSync("./dist-tmp", { recursive: true });
+}
+fs.mkdirSync("./dist-tmp", { recursive: true });
+
+// cloning
+
+console.log(`[drools-and-kogito] Cloning Drools...`);
+execSync(
+  `git clone $(build-env droolsAndKogito.repos.drools.url) --branch $(build-env root.streamName) --depth 50 ./dist-tmp/drools`,
+  execOpts
+);
+execSync(`git checkout $(build-env droolsAndKogito.repos.drools.gitRef)`, {
+  ...execOpts,
+  cwd: "./dist-tmp/drools",
+});
+
+console.log(`[drools-and-kogito] Cloning OptaPlanner...`);
+execSync(
+  `git clone $(build-env droolsAndKogito.repos.optaplanner.url) --branch $(build-env root.streamName) --depth 50 ./dist-tmp/optaplanner`,
+  execOpts
+);
+execSync(`git checkout $(build-env droolsAndKogito.repos.optaplanner.gitRef)`, {
+  ...execOpts,
+  cwd: "./dist-tmp/optaplanner",
+});
+
+console.log(`[drools-and-kogito] Cloning Kogito Runtimes...`);
+execSync(
+  `git clone $(build-env droolsAndKogito.repos.kogitoRuntimes.url) --branch $(build-env root.streamName) --depth 50 ./dist-tmp/kogito-runtimes`,
+  execOpts
+);
+execSync(`git checkout $(build-env droolsAndKogito.repos.kogitoRuntimes.gitRef)`, {
+  ...execOpts,
+  cwd: "./dist-tmp/kogito-runtimes",
+});
+
+console.log(`[drools-and-kogito] Cloning Kogito Apps...`);
+execSync(
+  `git clone $(build-env droolsAndKogito.repos.kogitoApps.url) --branch $(build-env root.streamName) --depth 50 ./dist-tmp/kogito-apps`,
+  execOpts
+);
+execSync(`git checkout $(build-env droolsAndKogito.repos.kogitoApps.gitRef)`, {
+  ...execOpts,
+  cwd: "./dist-tmp/kogito-apps",
+});
+
+// update versions
+const streamsMavenVersion =
+  buildEnv.root.streamName === "main"
+    ? `999-SNAPSHOT` //
+    : buildEnv.root.streamName.replace(".x", ".999-SNAPSHOT"); // 10.1.x becomes 10.1.999-SNAPSHOT
+
+console.log(`[drools-and-kogito] Updating versions to ${streamsMavenVersion}...`);
+execSync(
+  `find . -name "pom.xml" -exec sed -i.bak 's/${streamsMavenVersion}/${buildEnv.versions.kogito}/g' {} \\; -exec rm {}.bak \\;`,
+  {
+    ...execOpts,
+    cwd: "./dist-tmp",
+  }
+);
+
+// patching
+console.log(`[drools-and-kogito] Patching pom.xml files to remove Tests and Integration Tests modules...`);
+removeMavenModule(`drools\\-test\\-coverage`);
+removeMavenModule(`.*\\-integration\\-tests`);
+removeMavenModule(`integration\\-tests`);
+removeMavenModule(`.*\\-integration\\-test`);
+removeMavenModule(`.*\\-integration\\-test\\-.*`);
+removeMavenModule(`.*\\-integrationtests`);
+removeMavenModule(`.*integration\\-tests\\-.*`);
+removeMavenModule(`.*\\-integrationtest`);
+removeMavenModule(`.*\\-it`);
+removeMavenModule(`kie\\-archetypes`);
+removeMavenModule(`apps\\-integration\\-tests`);
+
+// building
+
+console.log(`[drools-and-kogito] Building Drools...`);
+execSync(
+  `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -DaltDeploymentRepository=drools-and-kogito--dist-1st-party-m2::default::file:${DIST_REPO}`,
+  {
+    ...execOpts,
+    cwd: "./dist-tmp/drools",
+  }
+);
+
+console.log(`[drools-and-kogito] Building OptaPlanner...`);
+execSync(
+  `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -Dmaven.repo.local.tail=${path.resolve("./dist/1st-party-m2/repository")} -DaltDeploymentRepository=drools-and-kogito--dist-1st-party-m2::default::file:${DIST_REPO}`,

Review Comment:
   ## Shell command built from environment values
   
   This shell command depends on an uncontrolled [absolute path](1).
   This shell command depends on an uncontrolled [absolute path](2).
   
   [Show more details](https://github.com/apache/incubator-kie-tools/security/code-scanning/1027)



##########
packages/drools-and-kogito/install.js:
##########
@@ -0,0 +1,228 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+const execSync = require("child_process").execSync;
+const fs = require("fs");
+const path = require("path");
+const execOpts = { stdio: "inherit" };
+const { env } = require("./env");
+const buildEnv = env;
+
+///
+
+const DIST_REPO = path.resolve("./dist/1st-party-m2/repository");
+
+if (buildEnv.droolsAndKogito.skip) {
+  console.log(`[drools-and-kogito] Skip is on. Exiting.`);
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+}
+
+if (!buildEnv.versions.kogito.endsWith("-local") && !buildEnv.droolsAndKogito.forceBuild) {
+  console.log(`[drools-and-kogito] Detected a non-local version for Drools and Kogito.`);
+  console.log(
+    `[drools-and-kogito] Building will not occur, as this version is expected to be either present on the local Maven repository (E.g., ~/.m2), or published in some publicly available Maven repository so that it can be downloaded.`
+  );
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+}
+
+const buildInfo = getBuildInfo();
+
+console.log();
+
+const buildInfoMatches =
+  buildInfo?.kogitoVersion === buildEnv.versions.kogito &&
+  buildInfo?.droolsRepoGitRef === buildEnv.droolsAndKogito.repos.drools.gitRef &&
+  buildInfo?.optaplannerRepoGitRef === buildEnv.droolsAndKogito.repos.optaplanner.gitRef &&
+  buildInfo?.kogitoRuntimesRepoGitRef === buildEnv.droolsAndKogito.repos.kogitoRuntimes.gitRef &&
+  buildInfo?.kogitoAppsRepoGitRef === buildEnv.droolsAndKogito.repos.kogitoApps.gitRef;
+
+const localM2DirExists = fs.existsSync("./dist/1st-party-m2/repository");
+const forceBuild = buildEnv.droolsAndKogito.forceBuild;
+
+console.log(`[drools-and-kogito] Local m2 exists: ${localM2DirExists}`);
+console.log(`[drools-and-kogito] Build info matches: ${buildInfoMatches}`);
+console.log(`[drools-and-kogito] Force build: ${forceBuild}`);
+
+if (localM2DirExists && buildInfoMatches && !forceBuild) {
+  console.log(`[drools-and-kogito] Nothing to do. Exiting.`);
+  process.exit(0);
+} else if (localM2DirExists) {
+  console.log(`[drools-and-kogito] Cleaning up 'dist' and 'dist-tmp' directories...`);
+  fs.rmSync("./dist", { recursive: true });
+}
+
+fs.mkdirSync("./dist", { recursive: true });
+
+if (fs.existsSync("./dist-tmp")) {
+  fs.rmSync("./dist-tmp", { recursive: true });
+}
+fs.mkdirSync("./dist-tmp", { recursive: true });
+
+// cloning
+
+console.log(`[drools-and-kogito] Cloning Drools...`);
+execSync(
+  `git clone $(build-env droolsAndKogito.repos.drools.url) --branch $(build-env root.streamName) --depth 50 ./dist-tmp/drools`,
+  execOpts
+);
+execSync(`git checkout $(build-env droolsAndKogito.repos.drools.gitRef)`, {
+  ...execOpts,
+  cwd: "./dist-tmp/drools",
+});
+
+console.log(`[drools-and-kogito] Cloning OptaPlanner...`);
+execSync(
+  `git clone $(build-env droolsAndKogito.repos.optaplanner.url) --branch $(build-env root.streamName) --depth 50 ./dist-tmp/optaplanner`,
+  execOpts
+);
+execSync(`git checkout $(build-env droolsAndKogito.repos.optaplanner.gitRef)`, {
+  ...execOpts,
+  cwd: "./dist-tmp/optaplanner",
+});
+
+console.log(`[drools-and-kogito] Cloning Kogito Runtimes...`);
+execSync(
+  `git clone $(build-env droolsAndKogito.repos.kogitoRuntimes.url) --branch $(build-env root.streamName) --depth 50 ./dist-tmp/kogito-runtimes`,
+  execOpts
+);
+execSync(`git checkout $(build-env droolsAndKogito.repos.kogitoRuntimes.gitRef)`, {
+  ...execOpts,
+  cwd: "./dist-tmp/kogito-runtimes",
+});
+
+console.log(`[drools-and-kogito] Cloning Kogito Apps...`);
+execSync(
+  `git clone $(build-env droolsAndKogito.repos.kogitoApps.url) --branch $(build-env root.streamName) --depth 50 ./dist-tmp/kogito-apps`,
+  execOpts
+);
+execSync(`git checkout $(build-env droolsAndKogito.repos.kogitoApps.gitRef)`, {
+  ...execOpts,
+  cwd: "./dist-tmp/kogito-apps",
+});
+
+// update versions
+const streamsMavenVersion =
+  buildEnv.root.streamName === "main"
+    ? `999-SNAPSHOT` //
+    : buildEnv.root.streamName.replace(".x", ".999-SNAPSHOT"); // 10.1.x becomes 10.1.999-SNAPSHOT
+
+console.log(`[drools-and-kogito] Updating versions to ${streamsMavenVersion}...`);
+execSync(
+  `find . -name "pom.xml" -exec sed -i.bak 's/${streamsMavenVersion}/${buildEnv.versions.kogito}/g' {} \\; -exec rm {}.bak \\;`,
+  {
+    ...execOpts,
+    cwd: "./dist-tmp",
+  }
+);
+
+// patching
+console.log(`[drools-and-kogito] Patching pom.xml files to remove Tests and Integration Tests modules...`);
+removeMavenModule(`drools\\-test\\-coverage`);
+removeMavenModule(`.*\\-integration\\-tests`);
+removeMavenModule(`integration\\-tests`);
+removeMavenModule(`.*\\-integration\\-test`);
+removeMavenModule(`.*\\-integration\\-test\\-.*`);
+removeMavenModule(`.*\\-integrationtests`);
+removeMavenModule(`.*integration\\-tests\\-.*`);
+removeMavenModule(`.*\\-integrationtest`);
+removeMavenModule(`.*\\-it`);
+removeMavenModule(`kie\\-archetypes`);
+removeMavenModule(`apps\\-integration\\-tests`);
+
+// building
+
+console.log(`[drools-and-kogito] Building Drools...`);
+execSync(
+  `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -DaltDeploymentRepository=drools-and-kogito--dist-1st-party-m2::default::file:${DIST_REPO}`,

Review Comment:
   ## Shell command built from environment values
   
   This shell command depends on an uncontrolled [absolute path](1).
   
   [Show more details](https://github.com/apache/incubator-kie-tools/security/code-scanning/1026)



##########
packages/drools-and-kogito/install.js:
##########
@@ -0,0 +1,228 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+const execSync = require("child_process").execSync;
+const fs = require("fs");
+const path = require("path");
+const execOpts = { stdio: "inherit" };
+const { env } = require("./env");
+const buildEnv = env;
+
+///
+
+const DIST_REPO = path.resolve("./dist/1st-party-m2/repository");
+
+if (buildEnv.droolsAndKogito.skip) {
+  console.log(`[drools-and-kogito] Skip is on. Exiting.`);
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+}
+
+if (!buildEnv.versions.kogito.endsWith("-local") && !buildEnv.droolsAndKogito.forceBuild) {
+  console.log(`[drools-and-kogito] Detected a non-local version for Drools and Kogito.`);
+  console.log(
+    `[drools-and-kogito] Building will not occur, as this version is expected to be either present on the local Maven repository (E.g., ~/.m2), or published in some publicly available Maven repository so that it can be downloaded.`
+  );
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+}
+
+const buildInfo = getBuildInfo();
+
+console.log();
+
+const buildInfoMatches =
+  buildInfo?.kogitoVersion === buildEnv.versions.kogito &&
+  buildInfo?.droolsRepoGitRef === buildEnv.droolsAndKogito.repos.drools.gitRef &&
+  buildInfo?.optaplannerRepoGitRef === buildEnv.droolsAndKogito.repos.optaplanner.gitRef &&
+  buildInfo?.kogitoRuntimesRepoGitRef === buildEnv.droolsAndKogito.repos.kogitoRuntimes.gitRef &&
+  buildInfo?.kogitoAppsRepoGitRef === buildEnv.droolsAndKogito.repos.kogitoApps.gitRef;
+
+const localM2DirExists = fs.existsSync("./dist/1st-party-m2/repository");
+const forceBuild = buildEnv.droolsAndKogito.forceBuild;
+
+console.log(`[drools-and-kogito] Local m2 exists: ${localM2DirExists}`);
+console.log(`[drools-and-kogito] Build info matches: ${buildInfoMatches}`);
+console.log(`[drools-and-kogito] Force build: ${forceBuild}`);
+
+if (localM2DirExists && buildInfoMatches && !forceBuild) {
+  console.log(`[drools-and-kogito] Nothing to do. Exiting.`);
+  process.exit(0);
+} else if (localM2DirExists) {
+  console.log(`[drools-and-kogito] Cleaning up 'dist' and 'dist-tmp' directories...`);
+  fs.rmSync("./dist", { recursive: true });
+}
+
+fs.mkdirSync("./dist", { recursive: true });
+
+if (fs.existsSync("./dist-tmp")) {
+  fs.rmSync("./dist-tmp", { recursive: true });
+}
+fs.mkdirSync("./dist-tmp", { recursive: true });
+
+// cloning
+
+console.log(`[drools-and-kogito] Cloning Drools...`);
+execSync(
+  `git clone $(build-env droolsAndKogito.repos.drools.url) --branch $(build-env root.streamName) --depth 50 ./dist-tmp/drools`,
+  execOpts
+);
+execSync(`git checkout $(build-env droolsAndKogito.repos.drools.gitRef)`, {
+  ...execOpts,
+  cwd: "./dist-tmp/drools",
+});
+
+console.log(`[drools-and-kogito] Cloning OptaPlanner...`);
+execSync(
+  `git clone $(build-env droolsAndKogito.repos.optaplanner.url) --branch $(build-env root.streamName) --depth 50 ./dist-tmp/optaplanner`,
+  execOpts
+);
+execSync(`git checkout $(build-env droolsAndKogito.repos.optaplanner.gitRef)`, {
+  ...execOpts,
+  cwd: "./dist-tmp/optaplanner",
+});
+
+console.log(`[drools-and-kogito] Cloning Kogito Runtimes...`);
+execSync(
+  `git clone $(build-env droolsAndKogito.repos.kogitoRuntimes.url) --branch $(build-env root.streamName) --depth 50 ./dist-tmp/kogito-runtimes`,
+  execOpts
+);
+execSync(`git checkout $(build-env droolsAndKogito.repos.kogitoRuntimes.gitRef)`, {
+  ...execOpts,
+  cwd: "./dist-tmp/kogito-runtimes",
+});
+
+console.log(`[drools-and-kogito] Cloning Kogito Apps...`);
+execSync(
+  `git clone $(build-env droolsAndKogito.repos.kogitoApps.url) --branch $(build-env root.streamName) --depth 50 ./dist-tmp/kogito-apps`,
+  execOpts
+);
+execSync(`git checkout $(build-env droolsAndKogito.repos.kogitoApps.gitRef)`, {
+  ...execOpts,
+  cwd: "./dist-tmp/kogito-apps",
+});
+
+// update versions
+const streamsMavenVersion =
+  buildEnv.root.streamName === "main"
+    ? `999-SNAPSHOT` //
+    : buildEnv.root.streamName.replace(".x", ".999-SNAPSHOT"); // 10.1.x becomes 10.1.999-SNAPSHOT
+
+console.log(`[drools-and-kogito] Updating versions to ${streamsMavenVersion}...`);
+execSync(
+  `find . -name "pom.xml" -exec sed -i.bak 's/${streamsMavenVersion}/${buildEnv.versions.kogito}/g' {} \\; -exec rm {}.bak \\;`,
+  {
+    ...execOpts,
+    cwd: "./dist-tmp",
+  }
+);
+
+// patching
+console.log(`[drools-and-kogito] Patching pom.xml files to remove Tests and Integration Tests modules...`);
+removeMavenModule(`drools\\-test\\-coverage`);
+removeMavenModule(`.*\\-integration\\-tests`);
+removeMavenModule(`integration\\-tests`);
+removeMavenModule(`.*\\-integration\\-test`);
+removeMavenModule(`.*\\-integration\\-test\\-.*`);
+removeMavenModule(`.*\\-integrationtests`);
+removeMavenModule(`.*integration\\-tests\\-.*`);
+removeMavenModule(`.*\\-integrationtest`);
+removeMavenModule(`.*\\-it`);
+removeMavenModule(`kie\\-archetypes`);
+removeMavenModule(`apps\\-integration\\-tests`);
+
+// building
+
+console.log(`[drools-and-kogito] Building Drools...`);
+execSync(
+  `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -DaltDeploymentRepository=drools-and-kogito--dist-1st-party-m2::default::file:${DIST_REPO}`,
+  {
+    ...execOpts,
+    cwd: "./dist-tmp/drools",
+  }
+);
+
+console.log(`[drools-and-kogito] Building OptaPlanner...`);
+execSync(
+  `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -Dmaven.repo.local.tail=${path.resolve("./dist/1st-party-m2/repository")} -DaltDeploymentRepository=drools-and-kogito--dist-1st-party-m2::default::file:${DIST_REPO}`,
+  {
+    ...execOpts,
+    cwd: "./dist-tmp/optaplanner",
+  }
+);
+
+console.log(`[drools-and-kogito] Building Kogito Runtimes...`);
+execSync(
+  `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -Dmaven.repo.local.tail=${path.resolve("./dist/1st-party-m2/repository")} -DaltDeploymentRepository=drools-and-kogito--dist-1st-party-m2::default::file:${DIST_REPO}`,
+  {
+    ...execOpts,
+    cwd: "./dist-tmp/kogito-runtimes",
+  }
+);
+
+console.log(`[drools-and-kogito] Building Kogito Apps...`);
+execSync(
+  `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -Dmaven.repo.local.tail=${path.resolve("./dist/1st-party-m2/repository")} -DaltDeploymentRepository=snapshot-repo::default::file:${DIST_REPO} -Dquarkus.container-image.build=false`,

Review Comment:
   ## Shell command built from environment values
   
   This shell command depends on an uncontrolled [absolute path](1).
   This shell command depends on an uncontrolled [absolute path](2).
   
   [Show more details](https://github.com/apache/incubator-kie-tools/security/code-scanning/1029)



##########
packages/drools-and-kogito/install.js:
##########
@@ -0,0 +1,228 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+const execSync = require("child_process").execSync;
+const fs = require("fs");
+const path = require("path");
+const execOpts = { stdio: "inherit" };
+const { env } = require("./env");
+const buildEnv = env;
+
+///
+
+const DIST_REPO = path.resolve("./dist/1st-party-m2/repository");
+
+if (buildEnv.droolsAndKogito.skip) {
+  console.log(`[drools-and-kogito] Skip is on. Exiting.`);
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+}
+
+if (!buildEnv.versions.kogito.endsWith("-local") && !buildEnv.droolsAndKogito.forceBuild) {
+  console.log(`[drools-and-kogito] Detected a non-local version for Drools and Kogito.`);
+  console.log(
+    `[drools-and-kogito] Building will not occur, as this version is expected to be either present on the local Maven repository (E.g., ~/.m2), or published in some publicly available Maven repository so that it can be downloaded.`
+  );
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+}
+
+const buildInfo = getBuildInfo();
+
+console.log();
+
+const buildInfoMatches =
+  buildInfo?.kogitoVersion === buildEnv.versions.kogito &&
+  buildInfo?.droolsRepoGitRef === buildEnv.droolsAndKogito.repos.drools.gitRef &&
+  buildInfo?.optaplannerRepoGitRef === buildEnv.droolsAndKogito.repos.optaplanner.gitRef &&
+  buildInfo?.kogitoRuntimesRepoGitRef === buildEnv.droolsAndKogito.repos.kogitoRuntimes.gitRef &&
+  buildInfo?.kogitoAppsRepoGitRef === buildEnv.droolsAndKogito.repos.kogitoApps.gitRef;
+
+const localM2DirExists = fs.existsSync("./dist/1st-party-m2/repository");
+const forceBuild = buildEnv.droolsAndKogito.forceBuild;
+
+console.log(`[drools-and-kogito] Local m2 exists: ${localM2DirExists}`);
+console.log(`[drools-and-kogito] Build info matches: ${buildInfoMatches}`);
+console.log(`[drools-and-kogito] Force build: ${forceBuild}`);
+
+if (localM2DirExists && buildInfoMatches && !forceBuild) {
+  console.log(`[drools-and-kogito] Nothing to do. Exiting.`);
+  process.exit(0);
+} else if (localM2DirExists) {
+  console.log(`[drools-and-kogito] Cleaning up 'dist' and 'dist-tmp' directories...`);
+  fs.rmSync("./dist", { recursive: true });
+}
+
+fs.mkdirSync("./dist", { recursive: true });
+
+if (fs.existsSync("./dist-tmp")) {
+  fs.rmSync("./dist-tmp", { recursive: true });
+}
+fs.mkdirSync("./dist-tmp", { recursive: true });
+
+// cloning
+
+console.log(`[drools-and-kogito] Cloning Drools...`);
+execSync(
+  `git clone $(build-env droolsAndKogito.repos.drools.url) --branch $(build-env root.streamName) --depth 50 ./dist-tmp/drools`,
+  execOpts
+);
+execSync(`git checkout $(build-env droolsAndKogito.repos.drools.gitRef)`, {
+  ...execOpts,
+  cwd: "./dist-tmp/drools",
+});
+
+console.log(`[drools-and-kogito] Cloning OptaPlanner...`);
+execSync(
+  `git clone $(build-env droolsAndKogito.repos.optaplanner.url) --branch $(build-env root.streamName) --depth 50 ./dist-tmp/optaplanner`,
+  execOpts
+);
+execSync(`git checkout $(build-env droolsAndKogito.repos.optaplanner.gitRef)`, {
+  ...execOpts,
+  cwd: "./dist-tmp/optaplanner",
+});
+
+console.log(`[drools-and-kogito] Cloning Kogito Runtimes...`);
+execSync(
+  `git clone $(build-env droolsAndKogito.repos.kogitoRuntimes.url) --branch $(build-env root.streamName) --depth 50 ./dist-tmp/kogito-runtimes`,
+  execOpts
+);
+execSync(`git checkout $(build-env droolsAndKogito.repos.kogitoRuntimes.gitRef)`, {
+  ...execOpts,
+  cwd: "./dist-tmp/kogito-runtimes",
+});
+
+console.log(`[drools-and-kogito] Cloning Kogito Apps...`);
+execSync(
+  `git clone $(build-env droolsAndKogito.repos.kogitoApps.url) --branch $(build-env root.streamName) --depth 50 ./dist-tmp/kogito-apps`,
+  execOpts
+);
+execSync(`git checkout $(build-env droolsAndKogito.repos.kogitoApps.gitRef)`, {
+  ...execOpts,
+  cwd: "./dist-tmp/kogito-apps",
+});
+
+// update versions
+const streamsMavenVersion =
+  buildEnv.root.streamName === "main"
+    ? `999-SNAPSHOT` //
+    : buildEnv.root.streamName.replace(".x", ".999-SNAPSHOT"); // 10.1.x becomes 10.1.999-SNAPSHOT
+
+console.log(`[drools-and-kogito] Updating versions to ${streamsMavenVersion}...`);
+execSync(
+  `find . -name "pom.xml" -exec sed -i.bak 's/${streamsMavenVersion}/${buildEnv.versions.kogito}/g' {} \\; -exec rm {}.bak \\;`,
+  {
+    ...execOpts,
+    cwd: "./dist-tmp",
+  }
+);
+
+// patching
+console.log(`[drools-and-kogito] Patching pom.xml files to remove Tests and Integration Tests modules...`);
+removeMavenModule(`drools\\-test\\-coverage`);
+removeMavenModule(`.*\\-integration\\-tests`);
+removeMavenModule(`integration\\-tests`);
+removeMavenModule(`.*\\-integration\\-test`);
+removeMavenModule(`.*\\-integration\\-test\\-.*`);
+removeMavenModule(`.*\\-integrationtests`);
+removeMavenModule(`.*integration\\-tests\\-.*`);
+removeMavenModule(`.*\\-integrationtest`);
+removeMavenModule(`.*\\-it`);
+removeMavenModule(`kie\\-archetypes`);
+removeMavenModule(`apps\\-integration\\-tests`);
+
+// building
+
+console.log(`[drools-and-kogito] Building Drools...`);
+execSync(
+  `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -DaltDeploymentRepository=drools-and-kogito--dist-1st-party-m2::default::file:${DIST_REPO}`,
+  {
+    ...execOpts,
+    cwd: "./dist-tmp/drools",
+  }
+);
+
+console.log(`[drools-and-kogito] Building OptaPlanner...`);
+execSync(
+  `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -Dmaven.repo.local.tail=${path.resolve("./dist/1st-party-m2/repository")} -DaltDeploymentRepository=drools-and-kogito--dist-1st-party-m2::default::file:${DIST_REPO}`,
+  {
+    ...execOpts,
+    cwd: "./dist-tmp/optaplanner",
+  }
+);
+
+console.log(`[drools-and-kogito] Building Kogito Runtimes...`);
+execSync(
+  `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -Dmaven.repo.local.tail=${path.resolve("./dist/1st-party-m2/repository")} -DaltDeploymentRepository=drools-and-kogito--dist-1st-party-m2::default::file:${DIST_REPO}`,

Review Comment:
   ## Shell command built from environment values
   
   This shell command depends on an uncontrolled [absolute path](1).
   This shell command depends on an uncontrolled [absolute path](2).
   
   [Show more details](https://github.com/apache/incubator-kie-tools/security/code-scanning/1028)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] NO-ISSUE: Stop depending on timestamped SNAPSHOTs [incubator-kie-tools]

Posted by "thiagoelg (via GitHub)" <gi...@apache.org>.
thiagoelg commented on PR #3170:
URL: https://github.com/apache/incubator-kie-tools/pull/3170#issuecomment-2950891125

   Thanks @handreyrc !
   When we were having issues with the tests, I retriggered the run a couple of times, and the error persisted (but I have seen it succeed before).
   
   The errors right now are related to the `omg.org/specs` outage :disappointed: (https://github.com/apache/incubator-kie-drools/pull/6311#issuecomment-2949793298). Once this is solved, we can try again.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DO NOT MERGE] NO-ISSUE: Stop depending on timestamped SNAPSHOTs [incubator-kie-tools]

Posted by "github-advanced-security[bot] (via GitHub)" <gi...@apache.org>.
github-advanced-security[bot] commented on code in PR #3170:
URL: https://github.com/apache/incubator-kie-tools/pull/3170#discussion_r2125651558


##########
packages/drools-and-kogito/install.js:
##########
@@ -0,0 +1,253 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+const execSync = require("child_process").execSync;
+const fs = require("fs");
+const path = require("path");
+const { env } = require("./env");
+const buildEnv = env;
+const execOpts = { stdio: "inherit" };
+
+///
+
+const DIST_REPO = path.resolve("./dist/1st-party-m2/repository");
+
+if (buildEnv.droolsAndKogito.skip) {
+  console.log(`[drools-and-kogito] Skip is on. Exiting.`);
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+}
+
+if (!buildEnv.versions.kogito.endsWith("-local") && !buildEnv.droolsAndKogito.forceBuild) {
+  console.log(`[drools-and-kogito] Detected a non-local version for Drools and Kogito.`);
+  console.log(
+    `[drools-and-kogito] Building will not occur, as this version is expected to be either present on the local Maven repository (E.g., ~/.m2), or published in some publicly available Maven repository so that it can be downloaded.`
+  );
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+}
+
+const buildInfo = getBuildInfo();
+
+console.log(`[drools-and-kogito] Build info:`);
+console.log(JSON.stringify(buildInfo, null, 2));
+
+const buildInfoMatches =
+  buildInfo?.kogitoVersion === buildEnv.versions.kogito &&
+  buildInfo?.droolsRepoGitRef === buildEnv.droolsAndKogito.repos.drools.gitRef &&
+  buildInfo?.optaplannerRepoGitRef === buildEnv.droolsAndKogito.repos.optaplanner.gitRef &&
+  buildInfo?.kogitoRuntimesRepoGitRef === buildEnv.droolsAndKogito.repos.kogitoRuntimes.gitRef &&
+  buildInfo?.kogitoAppsRepoGitRef === buildEnv.droolsAndKogito.repos.kogitoApps.gitRef;
+
+const localM2DirExists = fs.existsSync("./dist/1st-party-m2/repository");
+const forceBuild = buildEnv.droolsAndKogito.forceBuild;
+
+console.log(`[drools-and-kogito] Local m2 exists: ${localM2DirExists}`);
+console.log(`[drools-and-kogito] Build info matches: ${buildInfoMatches}`);
+console.log(`[drools-and-kogito] Force build: ${forceBuild}`);
+
+if (localM2DirExists && buildInfoMatches && !forceBuild) {
+  console.log(`[drools-and-kogito] Nothing to do.`);
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+} else if (localM2DirExists) {
+  console.log(`[drools-and-kogito] Cleaning up 'dist' directory...`);
+  fs.rmSync("./dist", { recursive: true });
+}
+fs.mkdirSync("./dist", { recursive: true });
+
+// TODO: cache restoration
+
+console.log(`[drools-and-kogito] Cleaning up 'dist' directory...`);
+if (fs.existsSync("./dist-tmp")) {
+  fs.rmSync("./dist-tmp", { recursive: true });
+}
+fs.mkdirSync("./dist-tmp", { recursive: true });
+
+// cloning
+
+const droolsRepoDir = path.join("dist-tmp", "drools");
+const optaplannerRepoDir = path.join("dist-tmp", "optaplanner");
+const kogitoRuntimesRepoDir = path.join("dist-tmp", "kogito-runtimes");
+const kogitoAppsRepoDir = path.join("dist-tmp", "kogito-apps");
+
+console.log(`[drools-and-kogito] Cloning Drools...`);
+
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.drools.url} "${droolsRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.drools.gitRef}`, {
+  ...execOpts,
+  cwd: droolsRepoDir,
+});
+
+console.log(`[drools-and-kogito] Cloning OptaPlanner...`);
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.optaplanner.url} "${optaplannerRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.optaplanner.gitRef}`, {
+  ...execOpts,
+  cwd: optaplannerRepoDir,
+});
+
+console.log(`[drools-and-kogito] Cloning Kogito Runtimes...`);
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.kogitoRuntimes.url} "${kogitoRuntimesRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.kogitoRuntimes.gitRef}`, {
+  ...execOpts,
+  cwd: kogitoRuntimesRepoDir,
+});
+
+console.log(`[drools-and-kogito] Cloning Kogito Apps...`);
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.kogitoApps.url} "${kogitoAppsRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.kogitoApps.gitRef}`, {
+  ...execOpts,
+  cwd: kogitoAppsRepoDir,
+});
+
+// update versions
+const streamsMavenVersion =
+  buildEnv.root.streamName === "main"
+    ? `999-SNAPSHOT` //
+    : buildEnv.root.streamName.replace(".x", ".999-SNAPSHOT"); // 10.1.x becomes 10.1.999-SNAPSHOT
+
+console.log(`[drools-and-kogito] Updating versions to ${streamsMavenVersion}...`);
+execSync(`find . -name "pom.xml" -exec sed -i.bak "s/${streamsMavenVersion}/${buildEnv.versions.kogito}/g" {} ";"`, {
+  ...execOpts,
+  cwd: "./dist-tmp",
+});
+execSync(`find . -name "pom.xml.bak" -exec rm {} ";"`, {
+  ...execOpts,
+  cwd: "./dist-tmp",
+});
+
+// patching
+console.log(`[drools-and-kogito] Patching pom.xml files to remove Tests and Integration Tests modules...`);
+removeMavenModule(`drools\\-test\\-coverage`);
+removeMavenModule(`.*\\-integration\\-tests`);
+removeMavenModule(`integration\\-tests`);
+removeMavenModule(`.*\\-integration\\-test`);
+removeMavenModule(`.*\\-integration\\-test\\-.*`);
+removeMavenModule(`.*\\-integrationtests`);
+removeMavenModule(`.*integration\\-tests\\-.*`);
+removeMavenModule(`.*\\-integrationtest`);
+removeMavenModule(`.*\\-it`);
+removeMavenModule(`.*\\-live\\-reload\\-test`);
+removeMavenModule(`kie\\-archetypes`);
+removeMavenModule(`apps\\-integration\\-tests`);
+
+// building
+
+console.log(`[drools-and-kogito] Building Drools...`);
+try {
+  execSync(
+    `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -DaltDeploymentRepository=drools-and-kogito--dist-1st-party-m2::default::file:${DIST_REPO}`,
+    {
+      ...execOpts,
+      cwd: droolsRepoDir,
+    }
+  );
+} catch (e) {
+  // Try it again!
+  execSync(
+    `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -DaltDeploymentRepository=drools-and-kogito--dist-1st-party-m2::default::file:${DIST_REPO}`,
+    {
+      ...execOpts,
+      cwd: droolsRepoDir,
+    }
+  );
+}
+
+console.log(`[drools-and-kogito] Building OptaPlanner...`);
+execSync(
+  `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -Dmaven.repo.local.tail=${DIST_REPO} -DaltDeploymentRepository=drools-and-kogito--dist-1st-party-m2::default::file:${DIST_REPO}`,

Review Comment:
   ## Shell command built from environment values
   
   This shell command depends on an uncontrolled [absolute path](1).
   
   [Show more details](https://github.com/apache/incubator-kie-tools/security/code-scanning/1034)



##########
packages/drools-and-kogito/install.js:
##########
@@ -0,0 +1,253 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+const execSync = require("child_process").execSync;
+const fs = require("fs");
+const path = require("path");
+const { env } = require("./env");
+const buildEnv = env;
+const execOpts = { stdio: "inherit" };
+
+///
+
+const DIST_REPO = path.resolve("./dist/1st-party-m2/repository");
+
+if (buildEnv.droolsAndKogito.skip) {
+  console.log(`[drools-and-kogito] Skip is on. Exiting.`);
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+}
+
+if (!buildEnv.versions.kogito.endsWith("-local") && !buildEnv.droolsAndKogito.forceBuild) {
+  console.log(`[drools-and-kogito] Detected a non-local version for Drools and Kogito.`);
+  console.log(
+    `[drools-and-kogito] Building will not occur, as this version is expected to be either present on the local Maven repository (E.g., ~/.m2), or published in some publicly available Maven repository so that it can be downloaded.`
+  );
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+}
+
+const buildInfo = getBuildInfo();
+
+console.log(`[drools-and-kogito] Build info:`);
+console.log(JSON.stringify(buildInfo, null, 2));
+
+const buildInfoMatches =
+  buildInfo?.kogitoVersion === buildEnv.versions.kogito &&
+  buildInfo?.droolsRepoGitRef === buildEnv.droolsAndKogito.repos.drools.gitRef &&
+  buildInfo?.optaplannerRepoGitRef === buildEnv.droolsAndKogito.repos.optaplanner.gitRef &&
+  buildInfo?.kogitoRuntimesRepoGitRef === buildEnv.droolsAndKogito.repos.kogitoRuntimes.gitRef &&
+  buildInfo?.kogitoAppsRepoGitRef === buildEnv.droolsAndKogito.repos.kogitoApps.gitRef;
+
+const localM2DirExists = fs.existsSync("./dist/1st-party-m2/repository");
+const forceBuild = buildEnv.droolsAndKogito.forceBuild;
+
+console.log(`[drools-and-kogito] Local m2 exists: ${localM2DirExists}`);
+console.log(`[drools-and-kogito] Build info matches: ${buildInfoMatches}`);
+console.log(`[drools-and-kogito] Force build: ${forceBuild}`);
+
+if (localM2DirExists && buildInfoMatches && !forceBuild) {
+  console.log(`[drools-and-kogito] Nothing to do.`);
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+} else if (localM2DirExists) {
+  console.log(`[drools-and-kogito] Cleaning up 'dist' directory...`);
+  fs.rmSync("./dist", { recursive: true });
+}
+fs.mkdirSync("./dist", { recursive: true });
+
+// TODO: cache restoration
+
+console.log(`[drools-and-kogito] Cleaning up 'dist' directory...`);
+if (fs.existsSync("./dist-tmp")) {
+  fs.rmSync("./dist-tmp", { recursive: true });
+}
+fs.mkdirSync("./dist-tmp", { recursive: true });
+
+// cloning
+
+const droolsRepoDir = path.join("dist-tmp", "drools");
+const optaplannerRepoDir = path.join("dist-tmp", "optaplanner");
+const kogitoRuntimesRepoDir = path.join("dist-tmp", "kogito-runtimes");
+const kogitoAppsRepoDir = path.join("dist-tmp", "kogito-apps");
+
+console.log(`[drools-and-kogito] Cloning Drools...`);
+
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.drools.url} "${droolsRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.drools.gitRef}`, {
+  ...execOpts,
+  cwd: droolsRepoDir,
+});
+
+console.log(`[drools-and-kogito] Cloning OptaPlanner...`);
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.optaplanner.url} "${optaplannerRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.optaplanner.gitRef}`, {
+  ...execOpts,
+  cwd: optaplannerRepoDir,
+});
+
+console.log(`[drools-and-kogito] Cloning Kogito Runtimes...`);
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.kogitoRuntimes.url} "${kogitoRuntimesRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.kogitoRuntimes.gitRef}`, {
+  ...execOpts,
+  cwd: kogitoRuntimesRepoDir,
+});
+
+console.log(`[drools-and-kogito] Cloning Kogito Apps...`);
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.kogitoApps.url} "${kogitoAppsRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.kogitoApps.gitRef}`, {
+  ...execOpts,
+  cwd: kogitoAppsRepoDir,
+});
+
+// update versions
+const streamsMavenVersion =
+  buildEnv.root.streamName === "main"
+    ? `999-SNAPSHOT` //
+    : buildEnv.root.streamName.replace(".x", ".999-SNAPSHOT"); // 10.1.x becomes 10.1.999-SNAPSHOT
+
+console.log(`[drools-and-kogito] Updating versions to ${streamsMavenVersion}...`);
+execSync(`find . -name "pom.xml" -exec sed -i.bak "s/${streamsMavenVersion}/${buildEnv.versions.kogito}/g" {} ";"`, {
+  ...execOpts,
+  cwd: "./dist-tmp",
+});
+execSync(`find . -name "pom.xml.bak" -exec rm {} ";"`, {
+  ...execOpts,
+  cwd: "./dist-tmp",
+});
+
+// patching
+console.log(`[drools-and-kogito] Patching pom.xml files to remove Tests and Integration Tests modules...`);
+removeMavenModule(`drools\\-test\\-coverage`);
+removeMavenModule(`.*\\-integration\\-tests`);
+removeMavenModule(`integration\\-tests`);
+removeMavenModule(`.*\\-integration\\-test`);
+removeMavenModule(`.*\\-integration\\-test\\-.*`);
+removeMavenModule(`.*\\-integrationtests`);
+removeMavenModule(`.*integration\\-tests\\-.*`);
+removeMavenModule(`.*\\-integrationtest`);
+removeMavenModule(`.*\\-it`);
+removeMavenModule(`.*\\-live\\-reload\\-test`);
+removeMavenModule(`kie\\-archetypes`);
+removeMavenModule(`apps\\-integration\\-tests`);
+
+// building
+
+console.log(`[drools-and-kogito] Building Drools...`);
+try {
+  execSync(
+    `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -DaltDeploymentRepository=drools-and-kogito--dist-1st-party-m2::default::file:${DIST_REPO}`,
+    {
+      ...execOpts,
+      cwd: droolsRepoDir,
+    }
+  );
+} catch (e) {
+  // Try it again!
+  execSync(
+    `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -DaltDeploymentRepository=drools-and-kogito--dist-1st-party-m2::default::file:${DIST_REPO}`,
+    {
+      ...execOpts,
+      cwd: droolsRepoDir,
+    }
+  );
+}
+
+console.log(`[drools-and-kogito] Building OptaPlanner...`);
+execSync(
+  `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -Dmaven.repo.local.tail=${DIST_REPO} -DaltDeploymentRepository=drools-and-kogito--dist-1st-party-m2::default::file:${DIST_REPO}`,
+  {
+    ...execOpts,
+    cwd: optaplannerRepoDir,
+  }
+);
+
+console.log(`[drools-and-kogito] Building Kogito Runtimes...`);
+execSync(
+  `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -Dmaven.repo.local.tail=${DIST_REPO} -DaltDeploymentRepository=drools-and-kogito--dist-1st-party-m2::default::file:${DIST_REPO}`,

Review Comment:
   ## Shell command built from environment values
   
   This shell command depends on an uncontrolled [absolute path](1).
   
   [Show more details](https://github.com/apache/incubator-kie-tools/security/code-scanning/1035)



##########
packages/drools-and-kogito/install.js:
##########
@@ -0,0 +1,253 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+const execSync = require("child_process").execSync;
+const fs = require("fs");
+const path = require("path");
+const { env } = require("./env");
+const buildEnv = env;
+const execOpts = { stdio: "inherit" };
+
+///
+
+const DIST_REPO = path.resolve("./dist/1st-party-m2/repository");
+
+if (buildEnv.droolsAndKogito.skip) {
+  console.log(`[drools-and-kogito] Skip is on. Exiting.`);
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+}
+
+if (!buildEnv.versions.kogito.endsWith("-local") && !buildEnv.droolsAndKogito.forceBuild) {
+  console.log(`[drools-and-kogito] Detected a non-local version for Drools and Kogito.`);
+  console.log(
+    `[drools-and-kogito] Building will not occur, as this version is expected to be either present on the local Maven repository (E.g., ~/.m2), or published in some publicly available Maven repository so that it can be downloaded.`
+  );
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+}
+
+const buildInfo = getBuildInfo();
+
+console.log(`[drools-and-kogito] Build info:`);
+console.log(JSON.stringify(buildInfo, null, 2));
+
+const buildInfoMatches =
+  buildInfo?.kogitoVersion === buildEnv.versions.kogito &&
+  buildInfo?.droolsRepoGitRef === buildEnv.droolsAndKogito.repos.drools.gitRef &&
+  buildInfo?.optaplannerRepoGitRef === buildEnv.droolsAndKogito.repos.optaplanner.gitRef &&
+  buildInfo?.kogitoRuntimesRepoGitRef === buildEnv.droolsAndKogito.repos.kogitoRuntimes.gitRef &&
+  buildInfo?.kogitoAppsRepoGitRef === buildEnv.droolsAndKogito.repos.kogitoApps.gitRef;
+
+const localM2DirExists = fs.existsSync("./dist/1st-party-m2/repository");
+const forceBuild = buildEnv.droolsAndKogito.forceBuild;
+
+console.log(`[drools-and-kogito] Local m2 exists: ${localM2DirExists}`);
+console.log(`[drools-and-kogito] Build info matches: ${buildInfoMatches}`);
+console.log(`[drools-and-kogito] Force build: ${forceBuild}`);
+
+if (localM2DirExists && buildInfoMatches && !forceBuild) {
+  console.log(`[drools-and-kogito] Nothing to do.`);
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+} else if (localM2DirExists) {
+  console.log(`[drools-and-kogito] Cleaning up 'dist' directory...`);
+  fs.rmSync("./dist", { recursive: true });
+}
+fs.mkdirSync("./dist", { recursive: true });
+
+// TODO: cache restoration
+
+console.log(`[drools-and-kogito] Cleaning up 'dist' directory...`);
+if (fs.existsSync("./dist-tmp")) {
+  fs.rmSync("./dist-tmp", { recursive: true });
+}
+fs.mkdirSync("./dist-tmp", { recursive: true });
+
+// cloning
+
+const droolsRepoDir = path.join("dist-tmp", "drools");
+const optaplannerRepoDir = path.join("dist-tmp", "optaplanner");
+const kogitoRuntimesRepoDir = path.join("dist-tmp", "kogito-runtimes");
+const kogitoAppsRepoDir = path.join("dist-tmp", "kogito-apps");
+
+console.log(`[drools-and-kogito] Cloning Drools...`);
+
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.drools.url} "${droolsRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.drools.gitRef}`, {
+  ...execOpts,
+  cwd: droolsRepoDir,
+});
+
+console.log(`[drools-and-kogito] Cloning OptaPlanner...`);
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.optaplanner.url} "${optaplannerRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.optaplanner.gitRef}`, {
+  ...execOpts,
+  cwd: optaplannerRepoDir,
+});
+
+console.log(`[drools-and-kogito] Cloning Kogito Runtimes...`);
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.kogitoRuntimes.url} "${kogitoRuntimesRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.kogitoRuntimes.gitRef}`, {
+  ...execOpts,
+  cwd: kogitoRuntimesRepoDir,
+});
+
+console.log(`[drools-and-kogito] Cloning Kogito Apps...`);
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.kogitoApps.url} "${kogitoAppsRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.kogitoApps.gitRef}`, {
+  ...execOpts,
+  cwd: kogitoAppsRepoDir,
+});
+
+// update versions
+const streamsMavenVersion =
+  buildEnv.root.streamName === "main"
+    ? `999-SNAPSHOT` //
+    : buildEnv.root.streamName.replace(".x", ".999-SNAPSHOT"); // 10.1.x becomes 10.1.999-SNAPSHOT
+
+console.log(`[drools-and-kogito] Updating versions to ${streamsMavenVersion}...`);
+execSync(`find . -name "pom.xml" -exec sed -i.bak "s/${streamsMavenVersion}/${buildEnv.versions.kogito}/g" {} ";"`, {
+  ...execOpts,
+  cwd: "./dist-tmp",
+});
+execSync(`find . -name "pom.xml.bak" -exec rm {} ";"`, {
+  ...execOpts,
+  cwd: "./dist-tmp",
+});
+
+// patching
+console.log(`[drools-and-kogito] Patching pom.xml files to remove Tests and Integration Tests modules...`);
+removeMavenModule(`drools\\-test\\-coverage`);
+removeMavenModule(`.*\\-integration\\-tests`);
+removeMavenModule(`integration\\-tests`);
+removeMavenModule(`.*\\-integration\\-test`);
+removeMavenModule(`.*\\-integration\\-test\\-.*`);
+removeMavenModule(`.*\\-integrationtests`);
+removeMavenModule(`.*integration\\-tests\\-.*`);
+removeMavenModule(`.*\\-integrationtest`);
+removeMavenModule(`.*\\-it`);
+removeMavenModule(`.*\\-live\\-reload\\-test`);
+removeMavenModule(`kie\\-archetypes`);
+removeMavenModule(`apps\\-integration\\-tests`);
+
+// building
+
+console.log(`[drools-and-kogito] Building Drools...`);
+try {
+  execSync(
+    `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -DaltDeploymentRepository=drools-and-kogito--dist-1st-party-m2::default::file:${DIST_REPO}`,
+    {
+      ...execOpts,
+      cwd: droolsRepoDir,
+    }
+  );
+} catch (e) {
+  // Try it again!
+  execSync(
+    `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -DaltDeploymentRepository=drools-and-kogito--dist-1st-party-m2::default::file:${DIST_REPO}`,
+    {
+      ...execOpts,
+      cwd: droolsRepoDir,
+    }
+  );
+}
+
+console.log(`[drools-and-kogito] Building OptaPlanner...`);
+execSync(
+  `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -Dmaven.repo.local.tail=${DIST_REPO} -DaltDeploymentRepository=drools-and-kogito--dist-1st-party-m2::default::file:${DIST_REPO}`,
+  {
+    ...execOpts,
+    cwd: optaplannerRepoDir,
+  }
+);
+
+console.log(`[drools-and-kogito] Building Kogito Runtimes...`);
+execSync(
+  `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -Dmaven.repo.local.tail=${DIST_REPO} -DaltDeploymentRepository=drools-and-kogito--dist-1st-party-m2::default::file:${DIST_REPO}`,
+  {
+    ...execOpts,
+    cwd: kogitoRuntimesRepoDir,
+  }
+);
+
+console.log(`[drools-and-kogito] Building Kogito Apps...`);
+execSync(
+  `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -Dmaven.repo.local.tail=${DIST_REPO} -DaltDeploymentRepository=snapshot-repo::default::file:${DIST_REPO} -Dquarkus.container-image.build=false`,

Review Comment:
   ## Shell command built from environment values
   
   This shell command depends on an uncontrolled [absolute path](1).
   
   [Show more details](https://github.com/apache/incubator-kie-tools/security/code-scanning/1036)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] NO-ISSUE: Stop depending on timestamped SNAPSHOTs [incubator-kie-tools]

Posted by "porcelli (via GitHub)" <gi...@apache.org>.
porcelli commented on code in PR #3170:
URL: https://github.com/apache/incubator-kie-tools/pull/3170#discussion_r2127075291


##########
packages/drools-and-kogito/install.js:
##########
@@ -0,0 +1,253 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+const execSync = require("child_process").execSync;
+const fs = require("fs");
+const path = require("path");
+const { env } = require("./env");
+const buildEnv = env;
+const execOpts = { stdio: "inherit" };
+
+///
+
+const DIST_REPO = path.resolve("./dist/1st-party-m2/repository");
+
+if (buildEnv.droolsAndKogito.skip) {
+  console.log(`[drools-and-kogito] Skip is on. Exiting.`);
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+}
+
+if (!buildEnv.versions.kogito.endsWith("-local") && !buildEnv.droolsAndKogito.forceBuild) {
+  console.log(`[drools-and-kogito] Detected a non-local version for Drools and Kogito.`);
+  console.log(
+    `[drools-and-kogito] Building will not occur, as this version is expected to be either present on the local Maven repository (E.g., ~/.m2), or published in some publicly available Maven repository so that it can be downloaded.`
+  );
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+}
+
+const buildInfo = getBuildInfo();
+
+console.log(`[drools-and-kogito] Build info:`);
+console.log(JSON.stringify(buildInfo, null, 2));
+
+const buildInfoMatches =
+  buildInfo?.kogitoVersion === buildEnv.versions.kogito &&
+  buildInfo?.droolsRepoGitRef === buildEnv.droolsAndKogito.repos.drools.gitRef &&
+  buildInfo?.optaplannerRepoGitRef === buildEnv.droolsAndKogito.repos.optaplanner.gitRef &&
+  buildInfo?.kogitoRuntimesRepoGitRef === buildEnv.droolsAndKogito.repos.kogitoRuntimes.gitRef &&
+  buildInfo?.kogitoAppsRepoGitRef === buildEnv.droolsAndKogito.repos.kogitoApps.gitRef;
+
+const localM2DirExists = fs.existsSync("./dist/1st-party-m2/repository");
+const forceBuild = buildEnv.droolsAndKogito.forceBuild;
+
+console.log(`[drools-and-kogito] Local m2 exists: ${localM2DirExists}`);
+console.log(`[drools-and-kogito] Build info matches: ${buildInfoMatches}`);
+console.log(`[drools-and-kogito] Force build: ${forceBuild}`);
+
+if (localM2DirExists && buildInfoMatches && !forceBuild) {
+  console.log(`[drools-and-kogito] Nothing to do.`);
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+} else if (localM2DirExists) {
+  console.log(`[drools-and-kogito] Cleaning up 'dist' directory...`);
+  fs.rmSync("./dist", { recursive: true });
+}
+fs.mkdirSync("./dist", { recursive: true });
+
+// TODO: cache restoration
+
+console.log(`[drools-and-kogito] Cleaning up 'dist' directory...`);
+if (fs.existsSync("./dist-tmp")) {
+  fs.rmSync("./dist-tmp", { recursive: true });
+}
+fs.mkdirSync("./dist-tmp", { recursive: true });
+
+// cloning
+
+const droolsRepoDir = path.join("dist-tmp", "drools");
+const optaplannerRepoDir = path.join("dist-tmp", "optaplanner");
+const kogitoRuntimesRepoDir = path.join("dist-tmp", "kogito-runtimes");
+const kogitoAppsRepoDir = path.join("dist-tmp", "kogito-apps");
+
+console.log(`[drools-and-kogito] Cloning Drools...`);
+
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.drools.url} "${droolsRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.drools.gitRef}`, {
+  ...execOpts,
+  cwd: droolsRepoDir,
+});
+
+console.log(`[drools-and-kogito] Cloning OptaPlanner...`);
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.optaplanner.url} "${optaplannerRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.optaplanner.gitRef}`, {
+  ...execOpts,
+  cwd: optaplannerRepoDir,
+});
+
+console.log(`[drools-and-kogito] Cloning Kogito Runtimes...`);
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.kogitoRuntimes.url} "${kogitoRuntimesRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.kogitoRuntimes.gitRef}`, {
+  ...execOpts,
+  cwd: kogitoRuntimesRepoDir,
+});
+
+console.log(`[drools-and-kogito] Cloning Kogito Apps...`);
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.kogitoApps.url} "${kogitoAppsRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.kogitoApps.gitRef}`, {
+  ...execOpts,
+  cwd: kogitoAppsRepoDir,
+});
+
+// update versions
+const streamsMavenVersion =
+  buildEnv.root.streamName === "main"
+    ? `999-SNAPSHOT` //
+    : buildEnv.root.streamName.replace(".x", ".999-SNAPSHOT"); // 10.1.x becomes 10.1.999-SNAPSHOT
+
+console.log(`[drools-and-kogito] Updating versions to ${streamsMavenVersion}...`);
+execSync(`find . -name "pom.xml" -exec sed -i.bak "s/${streamsMavenVersion}/${buildEnv.versions.kogito}/g" {} ";"`, {

Review Comment:
   This is scary... 
   
   @baldimir @elguardian @eduardocerqueira isn't there a standard maven command that could do this cleaner?



##########
packages/drools-and-kogito/install.js:
##########
@@ -0,0 +1,253 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+const execSync = require("child_process").execSync;
+const fs = require("fs");
+const path = require("path");
+const { env } = require("./env");
+const buildEnv = env;
+const execOpts = { stdio: "inherit" };
+
+///
+
+const DIST_REPO = path.resolve("./dist/1st-party-m2/repository");
+
+if (buildEnv.droolsAndKogito.skip) {
+  console.log(`[drools-and-kogito] Skip is on. Exiting.`);
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+}
+
+if (!buildEnv.versions.kogito.endsWith("-local") && !buildEnv.droolsAndKogito.forceBuild) {
+  console.log(`[drools-and-kogito] Detected a non-local version for Drools and Kogito.`);
+  console.log(
+    `[drools-and-kogito] Building will not occur, as this version is expected to be either present on the local Maven repository (E.g., ~/.m2), or published in some publicly available Maven repository so that it can be downloaded.`
+  );
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+}
+
+const buildInfo = getBuildInfo();
+
+console.log(`[drools-and-kogito] Build info:`);
+console.log(JSON.stringify(buildInfo, null, 2));
+
+const buildInfoMatches =
+  buildInfo?.kogitoVersion === buildEnv.versions.kogito &&
+  buildInfo?.droolsRepoGitRef === buildEnv.droolsAndKogito.repos.drools.gitRef &&
+  buildInfo?.optaplannerRepoGitRef === buildEnv.droolsAndKogito.repos.optaplanner.gitRef &&
+  buildInfo?.kogitoRuntimesRepoGitRef === buildEnv.droolsAndKogito.repos.kogitoRuntimes.gitRef &&
+  buildInfo?.kogitoAppsRepoGitRef === buildEnv.droolsAndKogito.repos.kogitoApps.gitRef;
+
+const localM2DirExists = fs.existsSync("./dist/1st-party-m2/repository");
+const forceBuild = buildEnv.droolsAndKogito.forceBuild;
+
+console.log(`[drools-and-kogito] Local m2 exists: ${localM2DirExists}`);
+console.log(`[drools-and-kogito] Build info matches: ${buildInfoMatches}`);
+console.log(`[drools-and-kogito] Force build: ${forceBuild}`);
+
+if (localM2DirExists && buildInfoMatches && !forceBuild) {
+  console.log(`[drools-and-kogito] Nothing to do.`);
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+} else if (localM2DirExists) {
+  console.log(`[drools-and-kogito] Cleaning up 'dist' directory...`);
+  fs.rmSync("./dist", { recursive: true });
+}
+fs.mkdirSync("./dist", { recursive: true });
+
+// TODO: cache restoration
+
+console.log(`[drools-and-kogito] Cleaning up 'dist' directory...`);
+if (fs.existsSync("./dist-tmp")) {
+  fs.rmSync("./dist-tmp", { recursive: true });
+}
+fs.mkdirSync("./dist-tmp", { recursive: true });
+
+// cloning
+
+const droolsRepoDir = path.join("dist-tmp", "drools");
+const optaplannerRepoDir = path.join("dist-tmp", "optaplanner");
+const kogitoRuntimesRepoDir = path.join("dist-tmp", "kogito-runtimes");
+const kogitoAppsRepoDir = path.join("dist-tmp", "kogito-apps");
+
+console.log(`[drools-and-kogito] Cloning Drools...`);
+
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.drools.url} "${droolsRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.drools.gitRef}`, {
+  ...execOpts,
+  cwd: droolsRepoDir,
+});
+
+console.log(`[drools-and-kogito] Cloning OptaPlanner...`);
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.optaplanner.url} "${optaplannerRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.optaplanner.gitRef}`, {
+  ...execOpts,
+  cwd: optaplannerRepoDir,
+});
+
+console.log(`[drools-and-kogito] Cloning Kogito Runtimes...`);
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.kogitoRuntimes.url} "${kogitoRuntimesRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.kogitoRuntimes.gitRef}`, {
+  ...execOpts,
+  cwd: kogitoRuntimesRepoDir,
+});
+
+console.log(`[drools-and-kogito] Cloning Kogito Apps...`);
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.kogitoApps.url} "${kogitoAppsRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.kogitoApps.gitRef}`, {
+  ...execOpts,
+  cwd: kogitoAppsRepoDir,
+});
+
+// update versions
+const streamsMavenVersion =
+  buildEnv.root.streamName === "main"
+    ? `999-SNAPSHOT` //
+    : buildEnv.root.streamName.replace(".x", ".999-SNAPSHOT"); // 10.1.x becomes 10.1.999-SNAPSHOT
+
+console.log(`[drools-and-kogito] Updating versions to ${streamsMavenVersion}...`);
+execSync(`find . -name "pom.xml" -exec sed -i.bak "s/${streamsMavenVersion}/${buildEnv.versions.kogito}/g" {} ";"`, {
+  ...execOpts,
+  cwd: "./dist-tmp",
+});
+execSync(`find . -name "pom.xml.bak" -exec rm {} ";"`, {
+  ...execOpts,
+  cwd: "./dist-tmp",
+});
+
+// patching
+console.log(`[drools-and-kogito] Patching pom.xml files to remove Tests and Integration Tests modules...`);
+removeMavenModule(`drools\\-test\\-coverage`);
+removeMavenModule(`.*\\-integration\\-tests`);
+removeMavenModule(`integration\\-tests`);
+removeMavenModule(`.*\\-integration\\-test`);
+removeMavenModule(`.*\\-integration\\-test\\-.*`);
+removeMavenModule(`.*\\-integrationtests`);
+removeMavenModule(`.*integration\\-tests\\-.*`);
+removeMavenModule(`.*\\-integrationtest`);
+removeMavenModule(`.*\\-it`);
+removeMavenModule(`.*\\-live\\-reload\\-test`);
+removeMavenModule(`kie\\-archetypes`);
+removeMavenModule(`apps\\-integration\\-tests`);
+
+// building
+
+console.log(`[drools-and-kogito] Building Drools...`);
+try {
+  execSync(
+    `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -DaltDeploymentRepository=drools-and-kogito--dist-1st-party-m2::default::file:${DIST_REPO}`,
+    {
+      ...execOpts,
+      cwd: droolsRepoDir,
+    }
+  );
+} catch (e) {
+  // Try it again!
+  execSync(
+    `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -DaltDeploymentRepository=drools-and-kogito--dist-1st-party-m2::default::file:${DIST_REPO}`,
+    {
+      ...execOpts,
+      cwd: droolsRepoDir,
+    }
+  );
+}
+
+console.log(`[drools-and-kogito] Building OptaPlanner...`);
+execSync(
+  `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -Dmaven.repo.local.tail=${DIST_REPO} -DaltDeploymentRepository=drools-and-kogito--dist-1st-party-m2::default::file:${DIST_REPO}`,
+  {
+    ...execOpts,
+    cwd: optaplannerRepoDir,
+  }
+);
+
+console.log(`[drools-and-kogito] Building Kogito Runtimes...`);
+execSync(
+  `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -Dmaven.repo.local.tail=${DIST_REPO} -DaltDeploymentRepository=drools-and-kogito--dist-1st-party-m2::default::file:${DIST_REPO}`,
+  {
+    ...execOpts,
+    cwd: kogitoRuntimesRepoDir,
+  }
+);
+
+console.log(`[drools-and-kogito] Building Kogito Apps...`);
+execSync(
+  `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -Dmaven.repo.local.tail=${DIST_REPO} -DaltDeploymentRepository=snapshot-repo::default::file:${DIST_REPO} -Dquarkus.container-image.build=false`,
+  {
+    ...execOpts,
+    cwd: kogitoAppsRepoDir,
+  }
+);
+
+console.log("[drools-and-kogito] Removing source code directory to free up disk space... ");
+fs.rmSync("./dist-tmp", { recursive: true });
+
+console.log(`[drools-and-kogito] Finished building. Final artifacts are in '${DIST_REPO}'`);
+
+console.log("[drools-and-kogito] Writing build info to ./dist/buildInfo.json");
+fs.writeFileSync(
+  "./dist/buildInfo.json",
+  JSON.stringify({
+    kogitoVersion: buildEnv.versions.kogito,
+    droolsRepoGitRef: buildEnv.droolsAndKogito.repos.drools.gitRef,
+    optaplannerRepoGitRef: buildEnv.droolsAndKogito.repos.optaplanner.gitRef,
+    kogitoRuntimesRepoGitRef: buildEnv.droolsAndKogito.repos.kogitoRuntimes.gitRef,
+    kogitoAppsRepoGitRef: buildEnv.droolsAndKogito.repos.kogitoApps.gitRef,
+  }),
+  "utf-8"
+);
+
+console.log(`[drools-and-kogito] Done.`);
+
+//
+// utilities
+
+function removeMavenModule(moduleName) {
+  process.stdout.write(`[drools-and-kogito] Excluding Maven module pattern ${moduleName} from the build...`);
+  execSync(`find . -name "pom.xml" -exec sed -i.bak "s#<module>${moduleName}</module>##g" {} ";"`, {

Review Comment:
   another scary 
   
   @baldimir @elguardian @eduardocerqueira isn't there a standard maven command that could do this cleaner?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] NO-ISSUE: Stop depending on timestamped SNAPSHOTs [incubator-kie-tools]

Posted by "thiagoelg (via GitHub)" <gi...@apache.org>.
thiagoelg commented on PR #3170:
URL: https://github.com/apache/incubator-kie-tools/pull/3170#issuecomment-2956130789

   @handreyrc The tests are failing again, this time more consistently. Maybe something changed upstream and building the whole stack in this PR might be breaking the VSCode extension? Idk...
   
   These are the screenshots of the failed tests:
   
   ### Serverless workflow editor - events tests Checks events are loaded from asyncapi files into JSON serverless workflow file (failed)
   ![Serverless workflow editor - events tests Checks events are loaded from asyncapi files into JSON serverless workflow file (failed)](https://github.com/user-attachments/assets/eb618957-4cfe-43e2-b1af-43ed5a34a91a)
   
   ### Serverless workflow editor - functions tests Checks functions are loaded from specs and routes directories into JSON serverless workflow file (failed)
   ![Serverless workflow editor - functions tests Checks functions are loaded from specs and routes directories into JSON serverless workflow file (failed)](https://github.com/user-attachments/assets/e0ad6700-5895-4dde-a83b-1d290ba1e380)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] NO-ISSUE: Stop depending on timestamped SNAPSHOTs [incubator-kie-tools]

Posted by "handreyrc (via GitHub)" <gi...@apache.org>.
handreyrc commented on PR #3170:
URL: https://github.com/apache/incubator-kie-tools/pull/3170#issuecomment-2963847204

   @thiagoelg, 
   Actually I tried both ways, with and without "...".  I realized that what was causing the issue with the "..." was the env variable KIE_TOOLS_BUILD__runEndToEndTests=true. I set it to false and the bootstrap worked. It seems it triggers tests on the dependencies and the bootstrap fails.
   Not sure it's a big deal. 
   
   Thanks for the update.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] NO-ISSUE: Stop depending on timestamped SNAPSHOTs [incubator-kie-tools]

Posted by "tiagobento (via GitHub)" <gi...@apache.org>.
tiagobento merged PR #3170:
URL: https://github.com/apache/incubator-kie-tools/pull/3170


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] NO-ISSUE: Stop depending on timestamped SNAPSHOTs [incubator-kie-tools]

Posted by "handreyrc (via GitHub)" <gi...@apache.org>.
handreyrc commented on PR #3170:
URL: https://github.com/apache/incubator-kie-tools/pull/3170#issuecomment-2960724882

   @thiagoelg,
   Are there extra steps introduced in this PR to build individual packages?
   if I run "pnpm bootstrap -F swf-vscode-extension" "pnpm -F swf-vscode-extension... build:prod" in the "main" it works, hoewever, if I do the same in "[stop-depending-on-timestamped-snapshots](https://github.com/tiagobento/incubator-kie-tools/tree/stop-depending-on-timestamped-snapshots)" it breaks.
   
   Could you take a look please?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DO NOT MERGE] NO-ISSUE: Stop depending on timestamped SNAPSHOTs [incubator-kie-tools]

Posted by "github-advanced-security[bot] (via GitHub)" <gi...@apache.org>.
github-advanced-security[bot] commented on code in PR #3170:
URL: https://github.com/apache/incubator-kie-tools/pull/3170#discussion_r2125616545


##########
packages/drools-and-kogito/install.js:
##########
@@ -0,0 +1,254 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+const execSync = require("child_process").execSync;
+const fs = require("fs");
+const path = require("path");
+const { env } = require("./env");
+const buildEnv = env;
+const execOpts = { stdio: "inherit" };
+
+///
+
+const DIST_REPO = path.resolve("./dist/1st-party-m2/repository");
+
+if (buildEnv.droolsAndKogito.skip) {
+  console.log(`[drools-and-kogito] Skip is on. Exiting.`);
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+}
+
+if (!buildEnv.versions.kogito.endsWith("-local") && !buildEnv.droolsAndKogito.forceBuild) {
+  console.log(`[drools-and-kogito] Detected a non-local version for Drools and Kogito.`);
+  console.log(
+    `[drools-and-kogito] Building will not occur, as this version is expected to be either present on the local Maven repository (E.g., ~/.m2), or published in some publicly available Maven repository so that it can be downloaded.`
+  );
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+}
+
+const buildInfo = getBuildInfo();
+
+console.log(`[drools-and-kogito] Build info:`);
+console.log(JSON.stringify(buildInfo, null, 2));
+
+const buildInfoMatches =
+  buildInfo?.kogitoVersion === buildEnv.versions.kogito &&
+  buildInfo?.droolsRepoGitRef === buildEnv.droolsAndKogito.repos.drools.gitRef &&
+  buildInfo?.optaplannerRepoGitRef === buildEnv.droolsAndKogito.repos.optaplanner.gitRef &&
+  buildInfo?.kogitoRuntimesRepoGitRef === buildEnv.droolsAndKogito.repos.kogitoRuntimes.gitRef &&
+  buildInfo?.kogitoAppsRepoGitRef === buildEnv.droolsAndKogito.repos.kogitoApps.gitRef;
+
+const localM2DirExists = fs.existsSync("./dist/1st-party-m2/repository");
+const forceBuild = buildEnv.droolsAndKogito.forceBuild;
+
+console.log(`[drools-and-kogito] Local m2 exists: ${localM2DirExists}`);
+console.log(`[drools-and-kogito] Build info matches: ${buildInfoMatches}`);
+console.log(`[drools-and-kogito] Force build: ${forceBuild}`);
+
+if (localM2DirExists && buildInfoMatches && !forceBuild) {
+  console.log(`[drools-and-kogito] Nothing to do.`);
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+} else if (localM2DirExists) {
+  console.log(`[drools-and-kogito] Cleaning up 'dist' directory...`);
+  fs.rmSync("./dist", { recursive: true });
+}
+fs.mkdirSync("./dist", { recursive: true });
+
+// TODO: cache restoration
+
+console.log(`[drools-and-kogito] Cleaning up 'dist' directory...`);
+if (fs.existsSync("./dist-tmp")) {
+  fs.rmSync("./dist-tmp", { recursive: true });
+}
+fs.mkdirSync("./dist-tmp", { recursive: true });
+
+// cloning
+
+const droolsRepoDir = path.join("dist-tmp", "drools");
+const optaplannerRepoDir = path.join("dist-tmp", "optaplanner");
+const kogitoRuntimesRepoDir = path.join("dist-tmp", "kogito-runtimes");
+const kogitoAppsRepoDir = path.join("dist-tmp", "kogito-apps");
+
+console.log(`[drools-and-kogito] Cloning Drools...`);
+
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.drools.url} "${droolsRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.drools.gitRef}`, {
+  ...execOpts,
+  cwd: droolsRepoDir,
+});
+
+console.log(`[drools-and-kogito] Cloning OptaPlanner...`);
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.optaplanner.url} "${optaplannerRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.optaplanner.gitRef}`, {
+  ...execOpts,
+  cwd: optaplannerRepoDir,
+});
+
+console.log(`[drools-and-kogito] Cloning Kogito Runtimes...`);
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.kogitoRuntimes.url} "${kogitoRuntimesRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.kogitoRuntimes.gitRef}`, {
+  ...execOpts,
+  cwd: kogitoRuntimesRepoDir,
+});
+
+console.log(`[drools-and-kogito] Cloning Kogito Apps...`);
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.kogitoApps.url} "${kogitoAppsRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.kogitoApps.gitRef}`, {
+  ...execOpts,
+  cwd: kogitoAppsRepoDir,
+});
+
+// update versions
+const streamsMavenVersion =
+  buildEnv.root.streamName === "main"
+    ? `999-SNAPSHOT` //
+    : buildEnv.root.streamName.replace(".x", ".999-SNAPSHOT"); // 10.1.x becomes 10.1.999-SNAPSHOT
+
+console.log(`[drools-and-kogito] Updating versions to ${streamsMavenVersion}...`);
+execSync(`find . -name "pom.xml" -exec sed -i.bak "s/${streamsMavenVersion}/${buildEnv.versions.kogito}/g" {} ";"`, {
+  ...execOpts,
+  cwd: "./dist-tmp",
+});
+execSync(`find . -name "pom.xml.bak" -exec rm {} ";"`, {
+  ...execOpts,
+  cwd: "./dist-tmp",
+});
+
+// patching
+console.log(`[drools-and-kogito] Patching pom.xml files to remove Tests and Integration Tests modules...`);
+removeMavenModule(`drools\\-test\\-coverage`);
+removeMavenModule(`.*\\-integration\\-tests`);
+removeMavenModule(`integration\\-tests`);
+removeMavenModule(`.*\\-integration\\-test`);
+removeMavenModule(`.*\\-integration\\-test\\-.*`);
+removeMavenModule(`.*\\-integrationtests`);
+removeMavenModule(`.*integration\\-tests\\-.*`);
+removeMavenModule(`.*\\-integrationtest`);
+removeMavenModule(`.*\\-it`);
+removeMavenModule(`kie\\-archetypes`);
+removeMavenModule(`apps\\-integration\\-tests`);
+
+// building
+
+console.log(`[drools-and-kogito] Building Drools...`);
+try {
+  execSync(
+    `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -DaltDeploymentRepository=drools-and-kogito--dist-1st-party-m2::default::file:${DIST_REPO}`,

Review Comment:
   ## Shell command built from environment values
   
   This shell command depends on an uncontrolled [absolute path](1).
   
   [Show more details](https://github.com/apache/incubator-kie-tools/security/code-scanning/1030)



##########
packages/drools-and-kogito/install.js:
##########
@@ -0,0 +1,254 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+const execSync = require("child_process").execSync;
+const fs = require("fs");
+const path = require("path");
+const { env } = require("./env");
+const buildEnv = env;
+const execOpts = { stdio: "inherit" };
+
+///
+
+const DIST_REPO = path.resolve("./dist/1st-party-m2/repository");
+
+if (buildEnv.droolsAndKogito.skip) {
+  console.log(`[drools-and-kogito] Skip is on. Exiting.`);
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+}
+
+if (!buildEnv.versions.kogito.endsWith("-local") && !buildEnv.droolsAndKogito.forceBuild) {
+  console.log(`[drools-and-kogito] Detected a non-local version for Drools and Kogito.`);
+  console.log(
+    `[drools-and-kogito] Building will not occur, as this version is expected to be either present on the local Maven repository (E.g., ~/.m2), or published in some publicly available Maven repository so that it can be downloaded.`
+  );
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+}
+
+const buildInfo = getBuildInfo();
+
+console.log(`[drools-and-kogito] Build info:`);
+console.log(JSON.stringify(buildInfo, null, 2));
+
+const buildInfoMatches =
+  buildInfo?.kogitoVersion === buildEnv.versions.kogito &&
+  buildInfo?.droolsRepoGitRef === buildEnv.droolsAndKogito.repos.drools.gitRef &&
+  buildInfo?.optaplannerRepoGitRef === buildEnv.droolsAndKogito.repos.optaplanner.gitRef &&
+  buildInfo?.kogitoRuntimesRepoGitRef === buildEnv.droolsAndKogito.repos.kogitoRuntimes.gitRef &&
+  buildInfo?.kogitoAppsRepoGitRef === buildEnv.droolsAndKogito.repos.kogitoApps.gitRef;
+
+const localM2DirExists = fs.existsSync("./dist/1st-party-m2/repository");
+const forceBuild = buildEnv.droolsAndKogito.forceBuild;
+
+console.log(`[drools-and-kogito] Local m2 exists: ${localM2DirExists}`);
+console.log(`[drools-and-kogito] Build info matches: ${buildInfoMatches}`);
+console.log(`[drools-and-kogito] Force build: ${forceBuild}`);
+
+if (localM2DirExists && buildInfoMatches && !forceBuild) {
+  console.log(`[drools-and-kogito] Nothing to do.`);
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+} else if (localM2DirExists) {
+  console.log(`[drools-and-kogito] Cleaning up 'dist' directory...`);
+  fs.rmSync("./dist", { recursive: true });
+}
+fs.mkdirSync("./dist", { recursive: true });
+
+// TODO: cache restoration
+
+console.log(`[drools-and-kogito] Cleaning up 'dist' directory...`);
+if (fs.existsSync("./dist-tmp")) {
+  fs.rmSync("./dist-tmp", { recursive: true });
+}
+fs.mkdirSync("./dist-tmp", { recursive: true });
+
+// cloning
+
+const droolsRepoDir = path.join("dist-tmp", "drools");
+const optaplannerRepoDir = path.join("dist-tmp", "optaplanner");
+const kogitoRuntimesRepoDir = path.join("dist-tmp", "kogito-runtimes");
+const kogitoAppsRepoDir = path.join("dist-tmp", "kogito-apps");
+
+console.log(`[drools-and-kogito] Cloning Drools...`);
+
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.drools.url} "${droolsRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.drools.gitRef}`, {
+  ...execOpts,
+  cwd: droolsRepoDir,
+});
+
+console.log(`[drools-and-kogito] Cloning OptaPlanner...`);
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.optaplanner.url} "${optaplannerRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.optaplanner.gitRef}`, {
+  ...execOpts,
+  cwd: optaplannerRepoDir,
+});
+
+console.log(`[drools-and-kogito] Cloning Kogito Runtimes...`);
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.kogitoRuntimes.url} "${kogitoRuntimesRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.kogitoRuntimes.gitRef}`, {
+  ...execOpts,
+  cwd: kogitoRuntimesRepoDir,
+});
+
+console.log(`[drools-and-kogito] Cloning Kogito Apps...`);
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.kogitoApps.url} "${kogitoAppsRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.kogitoApps.gitRef}`, {
+  ...execOpts,
+  cwd: kogitoAppsRepoDir,
+});
+
+// update versions
+const streamsMavenVersion =
+  buildEnv.root.streamName === "main"
+    ? `999-SNAPSHOT` //
+    : buildEnv.root.streamName.replace(".x", ".999-SNAPSHOT"); // 10.1.x becomes 10.1.999-SNAPSHOT
+
+console.log(`[drools-and-kogito] Updating versions to ${streamsMavenVersion}...`);
+execSync(`find . -name "pom.xml" -exec sed -i.bak "s/${streamsMavenVersion}/${buildEnv.versions.kogito}/g" {} ";"`, {
+  ...execOpts,
+  cwd: "./dist-tmp",
+});
+execSync(`find . -name "pom.xml.bak" -exec rm {} ";"`, {
+  ...execOpts,
+  cwd: "./dist-tmp",
+});
+
+// patching
+console.log(`[drools-and-kogito] Patching pom.xml files to remove Tests and Integration Tests modules...`);
+removeMavenModule(`drools\\-test\\-coverage`);
+removeMavenModule(`.*\\-integration\\-tests`);
+removeMavenModule(`integration\\-tests`);
+removeMavenModule(`.*\\-integration\\-test`);
+removeMavenModule(`.*\\-integration\\-test\\-.*`);
+removeMavenModule(`.*\\-integrationtests`);
+removeMavenModule(`.*integration\\-tests\\-.*`);
+removeMavenModule(`.*\\-integrationtest`);
+removeMavenModule(`.*\\-it`);
+removeMavenModule(`kie\\-archetypes`);
+removeMavenModule(`apps\\-integration\\-tests`);
+
+// building
+
+console.log(`[drools-and-kogito] Building Drools...`);
+try {
+  execSync(
+    `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -DaltDeploymentRepository=drools-and-kogito--dist-1st-party-m2::default::file:${DIST_REPO}`,
+    {
+      ...execOpts,
+      cwd: droolsRepoDir,
+    }
+  );
+} catch (e) {
+  // Try it again!
+  execSync(
+    `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -DaltDeploymentRepository=drools-and-kogito--dist-1st-party-m2::default::file:${DIST_REPO}`,

Review Comment:
   ## Shell command built from environment values
   
   This shell command depends on an uncontrolled [absolute path](1).
   
   [Show more details](https://github.com/apache/incubator-kie-tools/security/code-scanning/1031)



##########
packages/drools-and-kogito/install.js:
##########
@@ -0,0 +1,254 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+const execSync = require("child_process").execSync;
+const fs = require("fs");
+const path = require("path");
+const { env } = require("./env");
+const buildEnv = env;
+const execOpts = { stdio: "inherit" };
+
+///
+
+const DIST_REPO = path.resolve("./dist/1st-party-m2/repository");
+
+if (buildEnv.droolsAndKogito.skip) {
+  console.log(`[drools-and-kogito] Skip is on. Exiting.`);
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+}
+
+if (!buildEnv.versions.kogito.endsWith("-local") && !buildEnv.droolsAndKogito.forceBuild) {
+  console.log(`[drools-and-kogito] Detected a non-local version for Drools and Kogito.`);
+  console.log(
+    `[drools-and-kogito] Building will not occur, as this version is expected to be either present on the local Maven repository (E.g., ~/.m2), or published in some publicly available Maven repository so that it can be downloaded.`
+  );
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+}
+
+const buildInfo = getBuildInfo();
+
+console.log(`[drools-and-kogito] Build info:`);
+console.log(JSON.stringify(buildInfo, null, 2));
+
+const buildInfoMatches =
+  buildInfo?.kogitoVersion === buildEnv.versions.kogito &&
+  buildInfo?.droolsRepoGitRef === buildEnv.droolsAndKogito.repos.drools.gitRef &&
+  buildInfo?.optaplannerRepoGitRef === buildEnv.droolsAndKogito.repos.optaplanner.gitRef &&
+  buildInfo?.kogitoRuntimesRepoGitRef === buildEnv.droolsAndKogito.repos.kogitoRuntimes.gitRef &&
+  buildInfo?.kogitoAppsRepoGitRef === buildEnv.droolsAndKogito.repos.kogitoApps.gitRef;
+
+const localM2DirExists = fs.existsSync("./dist/1st-party-m2/repository");
+const forceBuild = buildEnv.droolsAndKogito.forceBuild;
+
+console.log(`[drools-and-kogito] Local m2 exists: ${localM2DirExists}`);
+console.log(`[drools-and-kogito] Build info matches: ${buildInfoMatches}`);
+console.log(`[drools-and-kogito] Force build: ${forceBuild}`);
+
+if (localM2DirExists && buildInfoMatches && !forceBuild) {
+  console.log(`[drools-and-kogito] Nothing to do.`);
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+} else if (localM2DirExists) {
+  console.log(`[drools-and-kogito] Cleaning up 'dist' directory...`);
+  fs.rmSync("./dist", { recursive: true });
+}
+fs.mkdirSync("./dist", { recursive: true });
+
+// TODO: cache restoration
+
+console.log(`[drools-and-kogito] Cleaning up 'dist' directory...`);
+if (fs.existsSync("./dist-tmp")) {
+  fs.rmSync("./dist-tmp", { recursive: true });
+}
+fs.mkdirSync("./dist-tmp", { recursive: true });
+
+// cloning
+
+const droolsRepoDir = path.join("dist-tmp", "drools");
+const optaplannerRepoDir = path.join("dist-tmp", "optaplanner");
+const kogitoRuntimesRepoDir = path.join("dist-tmp", "kogito-runtimes");
+const kogitoAppsRepoDir = path.join("dist-tmp", "kogito-apps");
+
+console.log(`[drools-and-kogito] Cloning Drools...`);
+
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.drools.url} "${droolsRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.drools.gitRef}`, {
+  ...execOpts,
+  cwd: droolsRepoDir,
+});
+
+console.log(`[drools-and-kogito] Cloning OptaPlanner...`);
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.optaplanner.url} "${optaplannerRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.optaplanner.gitRef}`, {
+  ...execOpts,
+  cwd: optaplannerRepoDir,
+});
+
+console.log(`[drools-and-kogito] Cloning Kogito Runtimes...`);
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.kogitoRuntimes.url} "${kogitoRuntimesRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.kogitoRuntimes.gitRef}`, {
+  ...execOpts,
+  cwd: kogitoRuntimesRepoDir,
+});
+
+console.log(`[drools-and-kogito] Cloning Kogito Apps...`);
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.kogitoApps.url} "${kogitoAppsRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.kogitoApps.gitRef}`, {
+  ...execOpts,
+  cwd: kogitoAppsRepoDir,
+});
+
+// update versions
+const streamsMavenVersion =
+  buildEnv.root.streamName === "main"
+    ? `999-SNAPSHOT` //
+    : buildEnv.root.streamName.replace(".x", ".999-SNAPSHOT"); // 10.1.x becomes 10.1.999-SNAPSHOT
+
+console.log(`[drools-and-kogito] Updating versions to ${streamsMavenVersion}...`);
+execSync(`find . -name "pom.xml" -exec sed -i.bak "s/${streamsMavenVersion}/${buildEnv.versions.kogito}/g" {} ";"`, {
+  ...execOpts,
+  cwd: "./dist-tmp",
+});
+execSync(`find . -name "pom.xml.bak" -exec rm {} ";"`, {
+  ...execOpts,
+  cwd: "./dist-tmp",
+});
+
+// patching
+console.log(`[drools-and-kogito] Patching pom.xml files to remove Tests and Integration Tests modules...`);
+removeMavenModule(`drools\\-test\\-coverage`);
+removeMavenModule(`.*\\-integration\\-tests`);
+removeMavenModule(`integration\\-tests`);
+removeMavenModule(`.*\\-integration\\-test`);
+removeMavenModule(`.*\\-integration\\-test\\-.*`);
+removeMavenModule(`.*\\-integrationtests`);
+removeMavenModule(`.*integration\\-tests\\-.*`);
+removeMavenModule(`.*\\-integrationtest`);
+removeMavenModule(`.*\\-it`);
+removeMavenModule(`kie\\-archetypes`);
+removeMavenModule(`apps\\-integration\\-tests`);
+
+// building
+
+console.log(`[drools-and-kogito] Building Drools...`);
+try {
+  execSync(
+    `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -DaltDeploymentRepository=drools-and-kogito--dist-1st-party-m2::default::file:${DIST_REPO}`,
+    {
+      ...execOpts,
+      cwd: droolsRepoDir,
+    }
+  );
+} catch (e) {
+  // Try it again!
+  execSync(
+    `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -DaltDeploymentRepository=drools-and-kogito--dist-1st-party-m2::default::file:${DIST_REPO}`,
+    {
+      ...execOpts,
+      cwd: droolsRepoDir,
+    }
+  );
+}
+
+console.log(`[drools-and-kogito] Building OptaPlanner...`);
+execSync(
+  `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -Dmaven.repo.local.tail=${path.resolve("./dist/1st-party-m2/repository")} -DaltDeploymentRepository=drools-and-kogito--dist-1st-party-m2::default::file:${DIST_REPO}`,
+  {
+    ...execOpts,
+    cwd: optaplannerRepoDir,
+  }
+);
+
+console.log(`[drools-and-kogito] Building Kogito Runtimes...`);
+execSync(
+  `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -Dmaven.repo.local.tail=${path.resolve("./dist/1st-party-m2/repository")} -DaltDeploymentRepository=drools-and-kogito--dist-1st-party-m2::default::file:${DIST_REPO}`,
+  {
+    ...execOpts,
+    cwd: kogitoRuntimesRepoDir,
+  }
+);
+
+console.log(`[drools-and-kogito] Building Kogito Apps...`);
+execSync(
+  `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -Dmaven.repo.local.tail=${path.resolve("./dist/1st-party-m2/repository")} -DaltDeploymentRepository=snapshot-repo::default::file:${DIST_REPO} -Dquarkus.container-image.build=false`,

Review Comment:
   ## Shell command built from environment values
   
   This shell command depends on an uncontrolled [absolute path](1).
   This shell command depends on an uncontrolled [absolute path](2).
   
   [Show more details](https://github.com/apache/incubator-kie-tools/security/code-scanning/1033)



##########
packages/drools-and-kogito/install.js:
##########
@@ -0,0 +1,254 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+const execSync = require("child_process").execSync;
+const fs = require("fs");
+const path = require("path");
+const { env } = require("./env");
+const buildEnv = env;
+const execOpts = { stdio: "inherit" };
+
+///
+
+const DIST_REPO = path.resolve("./dist/1st-party-m2/repository");
+
+if (buildEnv.droolsAndKogito.skip) {
+  console.log(`[drools-and-kogito] Skip is on. Exiting.`);
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+}
+
+if (!buildEnv.versions.kogito.endsWith("-local") && !buildEnv.droolsAndKogito.forceBuild) {
+  console.log(`[drools-and-kogito] Detected a non-local version for Drools and Kogito.`);
+  console.log(
+    `[drools-and-kogito] Building will not occur, as this version is expected to be either present on the local Maven repository (E.g., ~/.m2), or published in some publicly available Maven repository so that it can be downloaded.`
+  );
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+}
+
+const buildInfo = getBuildInfo();
+
+console.log(`[drools-and-kogito] Build info:`);
+console.log(JSON.stringify(buildInfo, null, 2));
+
+const buildInfoMatches =
+  buildInfo?.kogitoVersion === buildEnv.versions.kogito &&
+  buildInfo?.droolsRepoGitRef === buildEnv.droolsAndKogito.repos.drools.gitRef &&
+  buildInfo?.optaplannerRepoGitRef === buildEnv.droolsAndKogito.repos.optaplanner.gitRef &&
+  buildInfo?.kogitoRuntimesRepoGitRef === buildEnv.droolsAndKogito.repos.kogitoRuntimes.gitRef &&
+  buildInfo?.kogitoAppsRepoGitRef === buildEnv.droolsAndKogito.repos.kogitoApps.gitRef;
+
+const localM2DirExists = fs.existsSync("./dist/1st-party-m2/repository");
+const forceBuild = buildEnv.droolsAndKogito.forceBuild;
+
+console.log(`[drools-and-kogito] Local m2 exists: ${localM2DirExists}`);
+console.log(`[drools-and-kogito] Build info matches: ${buildInfoMatches}`);
+console.log(`[drools-and-kogito] Force build: ${forceBuild}`);
+
+if (localM2DirExists && buildInfoMatches && !forceBuild) {
+  console.log(`[drools-and-kogito] Nothing to do.`);
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+} else if (localM2DirExists) {
+  console.log(`[drools-and-kogito] Cleaning up 'dist' directory...`);
+  fs.rmSync("./dist", { recursive: true });
+}
+fs.mkdirSync("./dist", { recursive: true });
+
+// TODO: cache restoration
+
+console.log(`[drools-and-kogito] Cleaning up 'dist' directory...`);
+if (fs.existsSync("./dist-tmp")) {
+  fs.rmSync("./dist-tmp", { recursive: true });
+}
+fs.mkdirSync("./dist-tmp", { recursive: true });
+
+// cloning
+
+const droolsRepoDir = path.join("dist-tmp", "drools");
+const optaplannerRepoDir = path.join("dist-tmp", "optaplanner");
+const kogitoRuntimesRepoDir = path.join("dist-tmp", "kogito-runtimes");
+const kogitoAppsRepoDir = path.join("dist-tmp", "kogito-apps");
+
+console.log(`[drools-and-kogito] Cloning Drools...`);
+
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.drools.url} "${droolsRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.drools.gitRef}`, {
+  ...execOpts,
+  cwd: droolsRepoDir,
+});
+
+console.log(`[drools-and-kogito] Cloning OptaPlanner...`);
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.optaplanner.url} "${optaplannerRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.optaplanner.gitRef}`, {
+  ...execOpts,
+  cwd: optaplannerRepoDir,
+});
+
+console.log(`[drools-and-kogito] Cloning Kogito Runtimes...`);
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.kogitoRuntimes.url} "${kogitoRuntimesRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.kogitoRuntimes.gitRef}`, {
+  ...execOpts,
+  cwd: kogitoRuntimesRepoDir,
+});
+
+console.log(`[drools-and-kogito] Cloning Kogito Apps...`);
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.kogitoApps.url} "${kogitoAppsRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.kogitoApps.gitRef}`, {
+  ...execOpts,
+  cwd: kogitoAppsRepoDir,
+});
+
+// update versions
+const streamsMavenVersion =
+  buildEnv.root.streamName === "main"
+    ? `999-SNAPSHOT` //
+    : buildEnv.root.streamName.replace(".x", ".999-SNAPSHOT"); // 10.1.x becomes 10.1.999-SNAPSHOT
+
+console.log(`[drools-and-kogito] Updating versions to ${streamsMavenVersion}...`);
+execSync(`find . -name "pom.xml" -exec sed -i.bak "s/${streamsMavenVersion}/${buildEnv.versions.kogito}/g" {} ";"`, {
+  ...execOpts,
+  cwd: "./dist-tmp",
+});
+execSync(`find . -name "pom.xml.bak" -exec rm {} ";"`, {
+  ...execOpts,
+  cwd: "./dist-tmp",
+});
+
+// patching
+console.log(`[drools-and-kogito] Patching pom.xml files to remove Tests and Integration Tests modules...`);
+removeMavenModule(`drools\\-test\\-coverage`);
+removeMavenModule(`.*\\-integration\\-tests`);
+removeMavenModule(`integration\\-tests`);
+removeMavenModule(`.*\\-integration\\-test`);
+removeMavenModule(`.*\\-integration\\-test\\-.*`);
+removeMavenModule(`.*\\-integrationtests`);
+removeMavenModule(`.*integration\\-tests\\-.*`);
+removeMavenModule(`.*\\-integrationtest`);
+removeMavenModule(`.*\\-it`);
+removeMavenModule(`kie\\-archetypes`);
+removeMavenModule(`apps\\-integration\\-tests`);
+
+// building
+
+console.log(`[drools-and-kogito] Building Drools...`);
+try {
+  execSync(
+    `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -DaltDeploymentRepository=drools-and-kogito--dist-1st-party-m2::default::file:${DIST_REPO}`,
+    {
+      ...execOpts,
+      cwd: droolsRepoDir,
+    }
+  );
+} catch (e) {
+  // Try it again!
+  execSync(
+    `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -DaltDeploymentRepository=drools-and-kogito--dist-1st-party-m2::default::file:${DIST_REPO}`,
+    {
+      ...execOpts,
+      cwd: droolsRepoDir,
+    }
+  );
+}
+
+console.log(`[drools-and-kogito] Building OptaPlanner...`);
+execSync(
+  `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -Dmaven.repo.local.tail=${path.resolve("./dist/1st-party-m2/repository")} -DaltDeploymentRepository=drools-and-kogito--dist-1st-party-m2::default::file:${DIST_REPO}`,
+  {
+    ...execOpts,
+    cwd: optaplannerRepoDir,
+  }
+);
+
+console.log(`[drools-and-kogito] Building Kogito Runtimes...`);
+execSync(
+  `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -Dmaven.repo.local.tail=${path.resolve("./dist/1st-party-m2/repository")} -DaltDeploymentRepository=drools-and-kogito--dist-1st-party-m2::default::file:${DIST_REPO}`,

Review Comment:
   ## Shell command built from environment values
   
   This shell command depends on an uncontrolled [absolute path](1).
   This shell command depends on an uncontrolled [absolute path](2).
   
   [Show more details](https://github.com/apache/incubator-kie-tools/security/code-scanning/1032)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] NO-ISSUE: Stop depending on timestamped SNAPSHOTs [incubator-kie-tools]

Posted by "ricardozanini (via GitHub)" <gi...@apache.org>.
ricardozanini commented on PR #3170:
URL: https://github.com/apache/incubator-kie-tools/pull/3170#issuecomment-2945669342

   @thiagoelg no clue. @handreyrc mind taking a look, please?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] NO-ISSUE: Stop depending on timestamped SNAPSHOTs [incubator-kie-tools]

Posted by "tiagobento (via GitHub)" <gi...@apache.org>.
tiagobento commented on PR #3170:
URL: https://github.com/apache/incubator-kie-tools/pull/3170#issuecomment-2959842814

   @handreyrc Thanks! Can we skip this test for now to unblock this PR?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] NO-ISSUE: Stop depending on timestamped SNAPSHOTs [incubator-kie-tools]

Posted by "thiagoelg (via GitHub)" <gi...@apache.org>.
thiagoelg commented on PR #3170:
URL: https://github.com/apache/incubator-kie-tools/pull/3170#issuecomment-2963448835

   > @thiagoelg, Are there extra steps introduced in this PR to build individual packages? if I run "pnpm bootstrap -F swf-vscode-extension" "pnpm -F swf-vscode-extension... build:prod" in the "main" it works, hoewever, if I do the same in "[stop-depending-on-timestamped-snapshots](https://github.com/tiagobento/incubator-kie-tools/tree/stop-depending-on-timestamped-snapshots)" it breaks.
   > 
   > Could you take a look please?
   
   @handreyrc You have to bootstrap the `swf-vscode-extension` and **all** of its dependencies with `pnpm bootstrap -F swf-vscode-extension...` (notice the `...` at the end).
   
   Btw, I've pushed a new commit that fix the build if you are using Devbox.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] NO-ISSUE: Stop depending on timestamped SNAPSHOTs [incubator-kie-tools]

Posted by "tiagobento (via GitHub)" <gi...@apache.org>.
tiagobento commented on PR #3170:
URL: https://github.com/apache/incubator-kie-tools/pull/3170#issuecomment-2963826517

   `main` is failing with the same problem. See https://github.com/apache/incubator-kie-tools/actions/runs/15590294853/job/43907365445
   
   I'll send a separate PR skipping these tests on `main` to unblock PR checks for the whole repository. Please file a new issue to fix and unskip them @handreyrc. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] NO-ISSUE: Stop depending on timestamped SNAPSHOTs [incubator-kie-tools]

Posted by "tiagobento (via GitHub)" <gi...@apache.org>.
tiagobento commented on code in PR #3170:
URL: https://github.com/apache/incubator-kie-tools/pull/3170#discussion_r2127088884


##########
packages/drools-and-kogito/install.js:
##########
@@ -0,0 +1,253 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+const execSync = require("child_process").execSync;
+const fs = require("fs");
+const path = require("path");
+const { env } = require("./env");
+const buildEnv = env;
+const execOpts = { stdio: "inherit" };
+
+///
+
+const DIST_REPO = path.resolve("./dist/1st-party-m2/repository");
+
+if (buildEnv.droolsAndKogito.skip) {
+  console.log(`[drools-and-kogito] Skip is on. Exiting.`);
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+}
+
+if (!buildEnv.versions.kogito.endsWith("-local") && !buildEnv.droolsAndKogito.forceBuild) {
+  console.log(`[drools-and-kogito] Detected a non-local version for Drools and Kogito.`);
+  console.log(
+    `[drools-and-kogito] Building will not occur, as this version is expected to be either present on the local Maven repository (E.g., ~/.m2), or published in some publicly available Maven repository so that it can be downloaded.`
+  );
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+}
+
+const buildInfo = getBuildInfo();
+
+console.log(`[drools-and-kogito] Build info:`);
+console.log(JSON.stringify(buildInfo, null, 2));
+
+const buildInfoMatches =
+  buildInfo?.kogitoVersion === buildEnv.versions.kogito &&
+  buildInfo?.droolsRepoGitRef === buildEnv.droolsAndKogito.repos.drools.gitRef &&
+  buildInfo?.optaplannerRepoGitRef === buildEnv.droolsAndKogito.repos.optaplanner.gitRef &&
+  buildInfo?.kogitoRuntimesRepoGitRef === buildEnv.droolsAndKogito.repos.kogitoRuntimes.gitRef &&
+  buildInfo?.kogitoAppsRepoGitRef === buildEnv.droolsAndKogito.repos.kogitoApps.gitRef;
+
+const localM2DirExists = fs.existsSync("./dist/1st-party-m2/repository");
+const forceBuild = buildEnv.droolsAndKogito.forceBuild;
+
+console.log(`[drools-and-kogito] Local m2 exists: ${localM2DirExists}`);
+console.log(`[drools-and-kogito] Build info matches: ${buildInfoMatches}`);
+console.log(`[drools-and-kogito] Force build: ${forceBuild}`);
+
+if (localM2DirExists && buildInfoMatches && !forceBuild) {
+  console.log(`[drools-and-kogito] Nothing to do.`);
+  console.log(`[drools-and-kogito] Done.`);
+  process.exit(0);
+} else if (localM2DirExists) {
+  console.log(`[drools-and-kogito] Cleaning up 'dist' directory...`);
+  fs.rmSync("./dist", { recursive: true });
+}
+fs.mkdirSync("./dist", { recursive: true });
+
+// TODO: cache restoration
+
+console.log(`[drools-and-kogito] Cleaning up 'dist' directory...`);
+if (fs.existsSync("./dist-tmp")) {
+  fs.rmSync("./dist-tmp", { recursive: true });
+}
+fs.mkdirSync("./dist-tmp", { recursive: true });
+
+// cloning
+
+const droolsRepoDir = path.join("dist-tmp", "drools");
+const optaplannerRepoDir = path.join("dist-tmp", "optaplanner");
+const kogitoRuntimesRepoDir = path.join("dist-tmp", "kogito-runtimes");
+const kogitoAppsRepoDir = path.join("dist-tmp", "kogito-apps");
+
+console.log(`[drools-and-kogito] Cloning Drools...`);
+
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.drools.url} "${droolsRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.drools.gitRef}`, {
+  ...execOpts,
+  cwd: droolsRepoDir,
+});
+
+console.log(`[drools-and-kogito] Cloning OptaPlanner...`);
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.optaplanner.url} "${optaplannerRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.optaplanner.gitRef}`, {
+  ...execOpts,
+  cwd: optaplannerRepoDir,
+});
+
+console.log(`[drools-and-kogito] Cloning Kogito Runtimes...`);
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.kogitoRuntimes.url} "${kogitoRuntimesRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.kogitoRuntimes.gitRef}`, {
+  ...execOpts,
+  cwd: kogitoRuntimesRepoDir,
+});
+
+console.log(`[drools-and-kogito] Cloning Kogito Apps...`);
+execSync(
+  `git clone --branch ${buildEnv.root.streamName} --depth 50 ${buildEnv.droolsAndKogito.repos.kogitoApps.url} "${kogitoAppsRepoDir}"`,
+  execOpts
+);
+execSync(`git checkout ${buildEnv.droolsAndKogito.repos.kogitoApps.gitRef}`, {
+  ...execOpts,
+  cwd: kogitoAppsRepoDir,
+});
+
+// update versions
+const streamsMavenVersion =
+  buildEnv.root.streamName === "main"
+    ? `999-SNAPSHOT` //
+    : buildEnv.root.streamName.replace(".x", ".999-SNAPSHOT"); // 10.1.x becomes 10.1.999-SNAPSHOT
+
+console.log(`[drools-and-kogito] Updating versions to ${streamsMavenVersion}...`);
+execSync(`find . -name "pom.xml" -exec sed -i.bak "s/${streamsMavenVersion}/${buildEnv.versions.kogito}/g" {} ";"`, {
+  ...execOpts,
+  cwd: "./dist-tmp",
+});
+execSync(`find . -name "pom.xml.bak" -exec rm {} ";"`, {
+  ...execOpts,
+  cwd: "./dist-tmp",
+});
+
+// patching
+console.log(`[drools-and-kogito] Patching pom.xml files to remove Tests and Integration Tests modules...`);
+removeMavenModule(`drools\\-test\\-coverage`);
+removeMavenModule(`.*\\-integration\\-tests`);
+removeMavenModule(`integration\\-tests`);
+removeMavenModule(`.*\\-integration\\-test`);
+removeMavenModule(`.*\\-integration\\-test\\-.*`);
+removeMavenModule(`.*\\-integrationtests`);
+removeMavenModule(`.*integration\\-tests\\-.*`);
+removeMavenModule(`.*\\-integrationtest`);
+removeMavenModule(`.*\\-it`);
+removeMavenModule(`.*\\-live\\-reload\\-test`);
+removeMavenModule(`kie\\-archetypes`);
+removeMavenModule(`apps\\-integration\\-tests`);
+
+// building
+
+console.log(`[drools-and-kogito] Building Drools...`);
+try {
+  execSync(
+    `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -DaltDeploymentRepository=drools-and-kogito--dist-1st-party-m2::default::file:${DIST_REPO}`,
+    {
+      ...execOpts,
+      cwd: droolsRepoDir,
+    }
+  );
+} catch (e) {
+  // Try it again!
+  execSync(
+    `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -DaltDeploymentRepository=drools-and-kogito--dist-1st-party-m2::default::file:${DIST_REPO}`,
+    {
+      ...execOpts,
+      cwd: droolsRepoDir,
+    }
+  );
+}
+
+console.log(`[drools-and-kogito] Building OptaPlanner...`);
+execSync(
+  `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -Dmaven.repo.local.tail=${DIST_REPO} -DaltDeploymentRepository=drools-and-kogito--dist-1st-party-m2::default::file:${DIST_REPO}`,
+  {
+    ...execOpts,
+    cwd: optaplannerRepoDir,
+  }
+);
+
+console.log(`[drools-and-kogito] Building Kogito Runtimes...`);
+execSync(
+  `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -Dmaven.repo.local.tail=${DIST_REPO} -DaltDeploymentRepository=drools-and-kogito--dist-1st-party-m2::default::file:${DIST_REPO}`,
+  {
+    ...execOpts,
+    cwd: kogitoRuntimesRepoDir,
+  }
+);
+
+console.log(`[drools-and-kogito] Building Kogito Apps...`);
+execSync(
+  `mvn deploy -ntp -DskipTests -DskipITs -T 0.5C -Dformatter.skip -Denforcer.skip=true -Dcheckstyle.skip=true -Dmaven.install.skip=true -Dmaven.repo.local.tail=${DIST_REPO} -DaltDeploymentRepository=snapshot-repo::default::file:${DIST_REPO} -Dquarkus.container-image.build=false`,
+  {
+    ...execOpts,
+    cwd: kogitoAppsRepoDir,
+  }
+);
+
+console.log("[drools-and-kogito] Removing source code directory to free up disk space... ");
+fs.rmSync("./dist-tmp", { recursive: true });
+
+console.log(`[drools-and-kogito] Finished building. Final artifacts are in '${DIST_REPO}'`);
+
+console.log("[drools-and-kogito] Writing build info to ./dist/buildInfo.json");
+fs.writeFileSync(
+  "./dist/buildInfo.json",
+  JSON.stringify({
+    kogitoVersion: buildEnv.versions.kogito,
+    droolsRepoGitRef: buildEnv.droolsAndKogito.repos.drools.gitRef,
+    optaplannerRepoGitRef: buildEnv.droolsAndKogito.repos.optaplanner.gitRef,
+    kogitoRuntimesRepoGitRef: buildEnv.droolsAndKogito.repos.kogitoRuntimes.gitRef,
+    kogitoAppsRepoGitRef: buildEnv.droolsAndKogito.repos.kogitoApps.gitRef,
+  }),
+  "utf-8"
+);
+
+console.log(`[drools-and-kogito] Done.`);
+
+//
+// utilities
+
+function removeMavenModule(moduleName) {
+  process.stdout.write(`[drools-and-kogito] Excluding Maven module pattern ${moduleName} from the build...`);
+  execSync(`find . -name "pom.xml" -exec sed -i.bak "s#<module>${moduleName}</module>##g" {} ";"`, {

Review Comment:
   I guess we would expect `integration-tests` modules to be skipped from the build when -DskipTests or -DskipITs is on (depending on the nature of tests contained by those modules).
   
   I'm happy to revisit this once we find a "safe" way of doing this, but to be honest, I'm not that concerned and I think  unblocking this PR to stop depending on the (broken) timestamped SNAPSHOT automation would be more important. We can create a new issue and revisit those commands once we get proper input from people more knowledgeable about the subject if you're okay with it @porcelli.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] NO-ISSUE: Stop depending on timestamped SNAPSHOTs [incubator-kie-tools]

Posted by "porcelli (via GitHub)" <gi...@apache.org>.
porcelli commented on PR #3170:
URL: https://github.com/apache/incubator-kie-tools/pull/3170#issuecomment-2941096583

   https://github.com/apache/incubator-kie-issues/issues/1995


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] NO-ISSUE: Stop depending on timestamped SNAPSHOTs [incubator-kie-tools]

Posted by "tiagobento (via GitHub)" <gi...@apache.org>.
tiagobento commented on PR #3170:
URL: https://github.com/apache/incubator-kie-tools/pull/3170#issuecomment-2940769765

   Thank you @thiagoelg for the help with Windows!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] NO-ISSUE: Stop depending on timestamped SNAPSHOTs [incubator-kie-tools]

Posted by "tiagobento (via GitHub)" <gi...@apache.org>.
tiagobento commented on PR #3170:
URL: https://github.com/apache/incubator-kie-tools/pull/3170#issuecomment-2956533726

   @thiagoelg I used the same Git commit SHAs from the 999-20250511-SNAPSHOT tag 🤔, so changes on Drools and Kogito shouldn't be the issue here...


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org