diff --git a/.ci/jenkins/shared-scripts/buildUtils.groovy b/.ci/jenkins/shared-scripts/buildUtils.groovy index a10964f90f2..de24bb6fbb3 100644 --- a/.ci/jenkins/shared-scripts/buildUtils.groovy +++ b/.ci/jenkins/shared-scripts/buildUtils.groovy @@ -106,7 +106,7 @@ def pnpmUpdateProjectVersion(String projectVersion) { */ def pnpmUpdateKogitoVersion(String kogitoVersion, String imagesTag) { sh """#!/bin/bash -el - pnpm update-kogito-version-to --maven ${kogitoVersion} --images-tag ${imagesTag} + pnpm update-kogito-version-to --maven ${kogitoVersion} """.trim() } diff --git a/.github/actions/setup-env/action.yml b/.github/actions/setup-env/action.yml index 5aa4e6f2031..8650d034673 100644 --- a/.github/actions/setup-env/action.yml +++ b/.github/actions/setup-env/action.yml @@ -236,6 +236,25 @@ runs: gir1.2-appindicator3-0.1 fi + - name: "Setup xmllint (Ubuntu Only)" + shell: bash + run: | + echo "STEP: Setup xmllint library (Ubuntu Only)" + cd ${{ inputs.working_dir }} + if [ "${{ runner.os }}" == "Linux" ]; then + sudo apt-get install -y \ + libxml2-utils > /dev/null 2>&1 + fi + + - name: "Update bash for macOS (macOS Only)" + shell: bash + if: runner.os == 'macOS' + run: | + echo "STEP: Update bash for macOS (macOS Only)" + brew update + brew install bash + echo "/usr/local/bin" >> $GITHUB_PATH + - name: "Print storage usage (after setup)" shell: bash run: | diff --git a/.github/supporting-files/ci/partitions/partition1.txt b/.github/supporting-files/ci/partitions/partition1.txt index 1a2f8fcae14..fbbd1566205 100644 --- a/.github/supporting-files/ci/partitions/partition1.txt +++ b/.github/supporting-files/ci/partitions/partition1.txt @@ -9,4 +9,6 @@ chrome-extension-serverless-workflow-editor vscode-extension-dashbuilder-editor yard-vscode-extension swf-vscode-extension -@kie-tools/sonataflow-management-console-image \ No newline at end of file +@kie-tools/sonataflow-management-console-image +@kie/kogito-jit-runner-image +@kie/kogito-jobs-service-allinone-image \ No newline at end of file diff --git a/.gitignore b/.gitignore index c2d59f24779..f2f664b4bb2 100644 --- a/.gitignore +++ b/.gitignore @@ -323,6 +323,14 @@ packages/scesim-marshaller/**/ts-gen !packages/sonataflow-builder-image/test-resources/ !packages/sonataflow-devmode-image/test-resources/ +# kogito-images: excluding test-resources +!packages/kogito-data-index-ephemeral-image/test-resources/ +!packages/kogito-data-index-postgresql-image/test-resources/ +!packages/kogito-jobs-service-ephemeral-image/test-resources/ +!packages/kogito-jobs-service-postgresql-image/test-resources/ +!packages/kogito-jobs-service-allinone-image/test-resources/ +!packages/kogito-jit-runner-image/test-resources/ + __pycache__ packages/python-venv/venv diff --git a/KOGITO_UPGRADE_PROCESS.md b/KOGITO_UPGRADE_PROCESS.md index 4b74a31d4ef..2896b7f32b1 100644 --- a/KOGITO_UPGRADE_PROCESS.md +++ b/KOGITO_UPGRADE_PROCESS.md @@ -86,7 +86,7 @@ You can find an example of the Quarkus upgrade in [this PR](https://github.com/a # Upgrading Kogito -In the root directory, run `pnpm update-kogito-version-to --maven [version] --images-tag [tag]`. +In the root directory, run `pnpm update-kogito-version-to --maven [version]`. Of course, a new Kogito version may lead to incompatibilities in the code and with other dependencies. In such a case, an investigation and evetually a fix is required to complete the process. diff --git a/README.md b/README.md index e0ec6ec186d..052e4d56144 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,8 @@ To build and test all packages of the Apache KIE Tools project, you're going to - Python `3.12` _(To install, follow these instructions: https://www.python.org/downloads/)_ - Helm `3.13.3` _(To install, follow these instructions: https://helm.sh/docs/intro/install/)_ - Make +- xmllint _(To install, follow these instructions: https://www.baeldung.com/linux/xmllint)_ +- bash `5.x` _(On Linux or Nix you should be fine. On macOS, follow these instructions to use zsh: https://support.apple.com/102360)_ > **ℹ️ NOTE** > diff --git a/devbox.json b/devbox.json index bd6d1bf34f2..e76efd9adf3 100644 --- a/devbox.json +++ b/devbox.json @@ -7,7 +7,8 @@ "kubernetes-helm": "3.13.3", "gnumake": "4.4.1", "go": "1.21.9", - "python": "3.12.2" + "python": "3.12.2", + "libxml2": "2.13.3" }, "env": { "PLAYWRIGHT_BROWSERS_PATH": "0", diff --git a/devbox.lock b/devbox.lock index 810e96da462..d947b47e1cf 100644 --- a/devbox.lock +++ b/devbox.lock @@ -189,6 +189,110 @@ } } }, + "libxml2@2.13.3": { + "last_modified": "2024-09-12T11:58:09Z", + "resolved": "github:NixOS/nixpkgs/280db3decab4cbeb22a4599bd472229ab74d25e1#libxml2", + "source": "devbox-search", + "version": "2.13.3", + "systems": { + "aarch64-darwin": { + "outputs": [ + { + "name": "bin", + "path": "/nix/store/7gi1kd2mz9jc8ya4lkqhlv9vklc5qr2j-libxml2-2.13.3-bin", + "default": true + }, + { + "name": "dev", + "path": "/nix/store/mnij865rdzrrnxqmhj4s0abmd1xx771v-libxml2-2.13.3-dev" + }, + { + "name": "devdoc", + "path": "/nix/store/80bkizndgvrqiq42ig681irxswsf4kxv-libxml2-2.13.3-devdoc" + }, + { + "name": "out", + "path": "/nix/store/sr8lnkgivqcd06113nsk5p3jz2xcx7rp-libxml2-2.13.3" + } + ], + "store_path": "/nix/store/7gi1kd2mz9jc8ya4lkqhlv9vklc5qr2j-libxml2-2.13.3-bin" + }, + "aarch64-linux": { + "outputs": [ + { + "name": "bin", + "path": "/nix/store/gxpp5r2nbs3s0n5rw0jbnm1k5lhxrx13-libxml2-2.13.3-bin", + "default": true + }, + { + "name": "devdoc", + "path": "/nix/store/0qnymx6l3c7998yscwvr1q64iz447hfc-libxml2-2.13.3-devdoc" + }, + { + "name": "out", + "path": "/nix/store/da857dg9ip02lkci5nicgvkzf419jzc7-libxml2-2.13.3" + }, + { + "name": "py", + "path": "/nix/store/qfpnqradhvhicl1hm70w7891bk95lkad-libxml2-2.13.3-py" + }, + { + "name": "dev", + "path": "/nix/store/dph7mh2dhl8sl4i44wlgnmsrwdlcv0bc-libxml2-2.13.3-dev" + } + ], + "store_path": "/nix/store/gxpp5r2nbs3s0n5rw0jbnm1k5lhxrx13-libxml2-2.13.3-bin" + }, + "x86_64-darwin": { + "outputs": [ + { + "name": "bin", + "path": "/nix/store/gg4x2l8wy3lkd94bxpl0z7gnn9pa365i-libxml2-2.13.3-bin", + "default": true + }, + { + "name": "dev", + "path": "/nix/store/pzakdvnmm99gic3mqyg8375b08dvkqxm-libxml2-2.13.3-dev" + }, + { + "name": "devdoc", + "path": "/nix/store/xa27lhlrc2ya3i67g7nz53g64l3wqvjw-libxml2-2.13.3-devdoc" + }, + { + "name": "out", + "path": "/nix/store/ac73mddfvraxgvd816r9h57df35mm6gd-libxml2-2.13.3" + } + ], + "store_path": "/nix/store/gg4x2l8wy3lkd94bxpl0z7gnn9pa365i-libxml2-2.13.3-bin" + }, + "x86_64-linux": { + "outputs": [ + { + "name": "bin", + "path": "/nix/store/2y4a178s4w60v4m8749xhaawf8ga7cw5-libxml2-2.13.3-bin", + "default": true + }, + { + "name": "dev", + "path": "/nix/store/v40g7q9zix1ycpyara08brd50m00471n-libxml2-2.13.3-dev" + }, + { + "name": "devdoc", + "path": "/nix/store/cs49b70qkgygx0wxcl04dpy1d1g5vb91-libxml2-2.13.3-devdoc" + }, + { + "name": "out", + "path": "/nix/store/nr8mh99sfsb1gw1b1qmrwhzmxbhj84j7-libxml2-2.13.3" + }, + { + "name": "py", + "path": "/nix/store/p17nrcsmvb0q7b9g6347imljapbfcsb1-libxml2-2.13.3-py" + } + ], + "store_path": "/nix/store/2y4a178s4w60v4m8749xhaawf8ga7cw5-libxml2-2.13.3-bin" + } + } + }, "maven@3.9.6": { "last_modified": "2024-03-22T11:26:23Z", "resolved": "github:NixOS/nixpkgs/a3ed7406349a9335cb4c2a71369b697cecd9d351#maven", diff --git a/examples/base64png-editor-chrome-extension/webpack.config.js b/examples/base64png-editor-chrome-extension/webpack.config.js index fcf400e6526..03d867152e0 100644 --- a/examples/base64png-editor-chrome-extension/webpack.config.js +++ b/examples/base64png-editor-chrome-extension/webpack.config.js @@ -25,12 +25,11 @@ const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const { merge } = require("webpack-merge"); const { EnvironmentPlugin } = require("webpack"); const { env } = require("./env"); -const buildEnv = env; -module.exports = (env) => { - const router_targetOrigin = `https://localhost:${buildEnv.exampleChromeExtension.envelope.port}`; +module.exports = (webpackEnv) => { + const router_targetOrigin = `https://localhost:${env.exampleChromeExtension.envelope.port}`; - return merge(common(env), { + return merge(common(webpackEnv), { entry: { contentscript: "./src/contentscript.ts", "envelope/index": "./src/envelope/index.ts", @@ -38,7 +37,7 @@ module.exports = (env) => { devServer: { compress: true, https: true, - port: buildEnv.exampleChromeExtension.envelope.port, + port: env.exampleChromeExtension.envelope.port, }, plugins: [ new CopyPlugin({ diff --git a/examples/base64png-editor-vscode-extension/webpack.config.js b/examples/base64png-editor-vscode-extension/webpack.config.js index a894e79f3d1..40755ee3aaf 100644 --- a/examples/base64png-editor-vscode-extension/webpack.config.js +++ b/examples/base64png-editor-vscode-extension/webpack.config.js @@ -21,8 +21,8 @@ const patternflyBase = require("@kie-tools-core/patternfly-base"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const { merge } = require("webpack-merge"); -const commonConfig = (env) => - merge(common(env), { +const commonConfig = (webpackEnv) => + merge(common(webpackEnv), { output: { library: "VsCodePackSimpleReact", libraryTarget: "umd", @@ -33,15 +33,15 @@ const commonConfig = (env) => }, }); -module.exports = (env) => [ - merge(commonConfig(env), { +module.exports = (webpackEnv) => [ + merge(commonConfig(webpackEnv), { target: "node", entry: { extension: "./src/extension.ts", }, plugins: [], }), - merge(commonConfig(env), { + merge(commonConfig(webpackEnv), { target: "web", entry: { "envelope/index": "./src/envelope/index.ts", diff --git a/examples/dmn-editor-standalone-examples/webpack.config.js b/examples/dmn-editor-standalone-examples/webpack.config.js index f6dead2bfa1..88e671c525c 100644 --- a/examples/dmn-editor-standalone-examples/webpack.config.js +++ b/examples/dmn-editor-standalone-examples/webpack.config.js @@ -24,10 +24,9 @@ const path = require("path"); const HtmlWebpackPlugin = require("html-webpack-plugin"); const { ProvidePlugin } = require("webpack"); const { env } = require("./env"); -const buildEnv = env; -module.exports = (env) => - merge(common(env), { +module.exports = (webpackEnv) => + merge(common(webpackEnv), { output: { path: path.join(__dirname, "dist"), filename: "[name].js", @@ -68,7 +67,7 @@ module.exports = (env) => static: [{ directory: path.join(__dirname, "./dist") }], compress: true, https: false, - port: buildEnv.dmnEditorStandaloneExamples.port, + port: env.dmnEditorStandaloneExamples.port, client: { overlay: false, }, diff --git a/packages/stunner-editors/install.js b/examples/drools-process-usertasks-quarkus-example/mvn.bootstrap.js similarity index 73% rename from packages/stunner-editors/install.js rename to examples/drools-process-usertasks-quarkus-example/mvn.bootstrap.js index a9c7ff06ea9..9047ff62eb3 100644 --- a/packages/stunner-editors/install.js +++ b/examples/drools-process-usertasks-quarkus-example/mvn.bootstrap.js @@ -17,10 +17,10 @@ * under the License. */ -const buildEnv = require("./env"); -const { setup } = require("@kie-tools/maven-config-setup-helper"); +const { env } = require("./env"); +const { setupMavenConfigFile, buildTailFromPackageJsonDependencies } = require("@kie-tools/maven-base"); -setup(` - -Drevision=${buildEnv.env.stunnerEditors.version} - -Dversion.org.kie.kogito=${buildEnv.env.kogitoRuntime.version} +setupMavenConfigFile(` + -Drevision=${env.droolsProcessUsertasksQuarkusExample.version} + -Dmaven.repo.local.tail=${buildTailFromPackageJsonDependencies()} `); diff --git a/examples/drools-process-usertasks-quarkus-example/package.json b/examples/drools-process-usertasks-quarkus-example/package.json index 15f3d1c84c3..6eb37e5a2a9 100644 --- a/examples/drools-process-usertasks-quarkus-example/package.json +++ b/examples/drools-process-usertasks-quarkus-example/package.json @@ -19,7 +19,7 @@ "build:prod": "pnpm lint && run-script-if --bool \"$(build-env examples.build)\" --then run-script-os", "build:prod:darwin:linux": "mvn clean compile -DskipTests=$(build-env tests.run --not) -Dmaven.test.failure.ignore=$(build-env tests.ignoreFailures)", "build:prod:win32": "pnpm powershell \"mvn clean compile `-DskipTests `-Dmaven.test.failure.ignore=$(build-env tests.ignoreFailures)\"", - "install": "node install.js", + "install": "node mvn.bootstrap.js", "lint": "echo 'Linting'", "powershell": "@powershell -NoProfile -ExecutionPolicy Unrestricted -Command", "quarkus:dev": "run-script-os", @@ -32,7 +32,6 @@ "@kie-tools/maven-base": "workspace:*" }, "devDependencies": { - "@kie-tools/maven-config-setup-helper": "workspace:*", "@kie-tools/root-env": "workspace:*", "run-script-os": "^1.1.6" }, diff --git a/examples/drools-process-usertasks-quarkus-example/pom.xml b/examples/drools-process-usertasks-quarkus-example/pom.xml index 3ab00e2fc76..4b3b51c12f3 100644 --- a/examples/drools-process-usertasks-quarkus-example/pom.xml +++ b/examples/drools-process-usertasks-quarkus-example/pom.xml @@ -29,22 +29,13 @@ ${revision} ./node_modules/@kie-tools/maven-base/pom.xml + drools-process-usertasks-quarkus-example + ${revision} + Kie-Tools Example :: Process with Usertasks Quarkus Kogito user tasks orchestration - Quarkus - - - - org.jbpm - jbpm-quarkus-devui-bom - ${project.version} - pom - import - - - - io.quarkus @@ -58,10 +49,6 @@ org.jbpm jbpm-with-drools-quarkus - - org.jbpm - jbpm-quarkus-devui - io.quarkus quarkus-smallrye-openapi @@ -89,13 +76,43 @@ kie-addons-quarkus-process-svg + + + + include-1st-party-dependencies + + + kieTools.do-not-use-this-property.ignore1stPartyDependencies + !true + + + + + + org.jbpm + jbpm-quarkus-devui-bom + ${project.version} + pom + import + + + + + + org.jbpm + jbpm-quarkus-devui + + + + + ${project.artifactId} - ${quarkus.platform.group-id} + io.quarkus quarkus-maven-plugin - ${quarkus-plugin.version} + ${quarkus.platform.version} diff --git a/examples/jbpm-compact-architecture-example/install.js b/examples/jbpm-compact-architecture-example/mvn.bootstrap.js similarity index 67% rename from examples/jbpm-compact-architecture-example/install.js rename to examples/jbpm-compact-architecture-example/mvn.bootstrap.js index 47e591480b5..fea906ae027 100644 --- a/examples/jbpm-compact-architecture-example/install.js +++ b/examples/jbpm-compact-architecture-example/mvn.bootstrap.js @@ -17,19 +17,20 @@ * under the License. */ -const buildEnv = require("./env"); -const { setup, setPomProperty } = require("@kie-tools/maven-config-setup-helper"); +const { env } = require("./env"); +const { setupMavenConfigFile, setPomProperty, buildTailFromPackageJsonDependencies } = require("@kie-tools/maven-base"); -setup(` - -Drevision=${buildEnv.env.jbpmCompactArchitectureExample.version} +setupMavenConfigFile(` + -Drevision=${env.jbpmCompactArchitectureExample.version} + -Dmaven.repo.local.tail=${buildTailFromPackageJsonDependencies()} `); setPomProperty({ key: "kogito.management-console.image", - value: buildEnv.env.jbpmCompactArchitectureExample.kogitoManagementConsoleImage, + value: env.jbpmCompactArchitectureExample.kogitoManagementConsoleImage, }); setPomProperty({ key: "kogito.task-console.image", - value: buildEnv.env.jbpmCompactArchitectureExample.kogitoTaskConsoleImage, + value: env.jbpmCompactArchitectureExample.kogitoTaskConsoleImage, }); diff --git a/examples/jbpm-compact-architecture-example/package.json b/examples/jbpm-compact-architecture-example/package.json index c343328e50e..3a17df8a7d0 100644 --- a/examples/jbpm-compact-architecture-example/package.json +++ b/examples/jbpm-compact-architecture-example/package.json @@ -21,7 +21,7 @@ "build:prod": "pnpm lint && run-script-if --bool \"$(build-env examples.build)\" --then run-script-os", "build:prod:darwin:linux": "mvn clean compile -DskipTests=$(build-env tests.run --not) -Dmaven.test.failure.ignore=$(build-env tests.ignoreFailures) -Pcontainer", "build:prod:win32": "pnpm powershell \"mvn clean compile `-DskipTests `-Dmaven.test.failure.ignore=$(build-env tests.ignoreFailures) `-Pcontainer \"", - "install": "node install.js", + "install": "node mvn.bootstrap.js", "lint": "echo 'Linting'", "powershell": "@powershell -NoProfile -ExecutionPolicy Unrestricted -Command", "quarkus:dev": "run-script-os", @@ -42,7 +42,6 @@ "devDependencies": { "@kie-tools/kogito-management-console": "workspace:*", "@kie-tools/kogito-task-console": "workspace:*", - "@kie-tools/maven-config-setup-helper": "workspace:*", "@kie-tools/root-env": "workspace:*", "run-script-os": "^1.1.6" }, diff --git a/examples/jbpm-compact-architecture-example/pom.xml b/examples/jbpm-compact-architecture-example/pom.xml index 10fb11ac96b..5833408659e 100644 --- a/examples/jbpm-compact-architecture-example/pom.xml +++ b/examples/jbpm-compact-architecture-example/pom.xml @@ -31,6 +31,8 @@ jbpm-compact-architecture-quarkus-example + ${revision} + Kie-Tools Example :: jBPM Compact Architecture Quarkus Example @@ -162,9 +164,9 @@ ${project.artifactId} - ${quarkus.platform.group-id} + io.quarkus quarkus-maven-plugin - ${quarkus-plugin.version} + ${quarkus.platform.version} diff --git a/examples/sonataflow-greeting-quarkus-example/install.js b/examples/sonataflow-greeting-quarkus-example/mvn.bootstrap.js similarity index 73% rename from examples/sonataflow-greeting-quarkus-example/install.js rename to examples/sonataflow-greeting-quarkus-example/mvn.bootstrap.js index 7230ea08fa9..74492cbf7ec 100644 --- a/examples/sonataflow-greeting-quarkus-example/install.js +++ b/examples/sonataflow-greeting-quarkus-example/mvn.bootstrap.js @@ -17,9 +17,10 @@ * under the License. */ -const buildEnv = require("./env"); -const { setup } = require("@kie-tools/maven-config-setup-helper"); +const { env } = require("./env"); +const { setupMavenConfigFile, buildTailFromPackageJsonDependencies } = require("@kie-tools/maven-base"); -setup(` - -Drevision=${buildEnv.env.sonataflowGreetingQuarkus.version} +setupMavenConfigFile(` + -Drevision=${env.sonataflowGreetingQuarkus.version} + -Dmaven.repo.local.tail=${buildTailFromPackageJsonDependencies()} `); diff --git a/examples/sonataflow-greeting-quarkus-example/package.json b/examples/sonataflow-greeting-quarkus-example/package.json index 425d90edd4c..834b1f62a05 100644 --- a/examples/sonataflow-greeting-quarkus-example/package.json +++ b/examples/sonataflow-greeting-quarkus-example/package.json @@ -19,7 +19,7 @@ "build:prod": "pnpm lint && run-script-if --bool \"$(build-env examples.build)\" --then run-script-os", "build:prod:darwin:linux": "mvn clean package -DskipTests=$(build-env tests.run --not) -Dmaven.test.failure.ignore=$(build-env tests.ignoreFailures)", "build:prod:win32": "pnpm powershell \"mvn clean package `-DskipTests `-Dmaven.test.failure.ignore=$(build-env tests.ignoreFailures)\"", - "install": "node install.js", + "install": "node mvn.bootstrap.js", "lint": "echo 'Linting'", "powershell": "@powershell -NoProfile -ExecutionPolicy Unrestricted -Command", "quarkus:dev": "run-script-os", @@ -32,7 +32,6 @@ "@kie-tools/sonataflow-quarkus-devui": "workspace:*" }, "devDependencies": { - "@kie-tools/maven-config-setup-helper": "workspace:*", "@kie-tools/root-env": "workspace:*", "run-script-os": "^1.1.6" }, diff --git a/examples/sonataflow-greeting-quarkus-example/pom.xml b/examples/sonataflow-greeting-quarkus-example/pom.xml index 8b500cfc5a3..b6a7519cb30 100644 --- a/examples/sonataflow-greeting-quarkus-example/pom.xml +++ b/examples/sonataflow-greeting-quarkus-example/pom.xml @@ -38,18 +38,6 @@ KIE Tools Example :: SonataFlow Greeting :: Quarkus SonataFlow Example - Quarkus - - - - org.apache.kie.sonataflow - sonataflow-quarkus-devui-bom - ${project.version} - pom - import - - - - org.apache.kie.sonataflow @@ -67,10 +55,6 @@ io.quarkus quarkus-jsonp - - org.apache.kie.sonataflow - sonataflow-quarkus-devui - org.kie kie-addons-quarkus-source-files @@ -95,15 +79,14 @@ maven-compiler-plugin - ${compiler-plugin.version} ${maven.compiler.release} - ${quarkus.platform.group-id} + io.quarkus quarkus-maven-plugin - ${quarkus-plugin.version} + ${quarkus.platform.version} @@ -114,7 +97,6 @@ maven-failsafe-plugin - ${version.failsafe.plugin} org.jboss.logmanager.LogManager @@ -133,6 +115,32 @@ + + include-1st-party-dependencies + + + kieTools.do-not-use-this-property.ignore1stPartyDependencies + !true + + + + + + org.apache.kie.sonataflow + sonataflow-quarkus-devui-bom + ${project.version} + pom + import + + + + + + org.apache.kie.sonataflow + sonataflow-quarkus-devui + + + container diff --git a/examples/todo-list-view-vscode-extension/webpack.config.js b/examples/todo-list-view-vscode-extension/webpack.config.js index a894e79f3d1..40755ee3aaf 100644 --- a/examples/todo-list-view-vscode-extension/webpack.config.js +++ b/examples/todo-list-view-vscode-extension/webpack.config.js @@ -21,8 +21,8 @@ const patternflyBase = require("@kie-tools-core/patternfly-base"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const { merge } = require("webpack-merge"); -const commonConfig = (env) => - merge(common(env), { +const commonConfig = (webpackEnv) => + merge(common(webpackEnv), { output: { library: "VsCodePackSimpleReact", libraryTarget: "umd", @@ -33,15 +33,15 @@ const commonConfig = (env) => }, }); -module.exports = (env) => [ - merge(commonConfig(env), { +module.exports = (webpackEnv) => [ + merge(commonConfig(webpackEnv), { target: "node", entry: { extension: "./src/extension.ts", }, plugins: [], }), - merge(commonConfig(env), { + merge(commonConfig(webpackEnv), { target: "web", entry: { "envelope/index": "./src/envelope/index.ts", diff --git a/examples/uniforms-patternfly/webpack.config.js b/examples/uniforms-patternfly/webpack.config.js index 39c07801bb8..d9b22fcd1aa 100644 --- a/examples/uniforms-patternfly/webpack.config.js +++ b/examples/uniforms-patternfly/webpack.config.js @@ -23,10 +23,9 @@ const patternflyBase = require("@kie-tools-core/patternfly-base"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const { merge } = require("webpack-merge"); const { env } = require("./env"); -const buildEnv = env; -module.exports = (env) => [ - merge(common(env), { +module.exports = (webpackEnv) => [ + merge(common(webpackEnv), { entry: { index: "./src/index.tsx", }, @@ -45,7 +44,7 @@ module.exports = (env) => [ historyApiFallback: false, static: [{ directory: path.join(__dirname, "./dist") }, { directory: path.join(__dirname, "./static") }], compress: true, - port: buildEnv.exampleUniformsPatternflyPort.port, + port: env.exampleUniformsPatternflyPort.port, }, ignoreWarnings: [/Failed to parse source map/], }), diff --git a/examples/webapp/webpack.config.js b/examples/webapp/webpack.config.js index 0d146655c2b..0fbcd914a74 100644 --- a/examples/webapp/webpack.config.js +++ b/examples/webapp/webpack.config.js @@ -25,10 +25,9 @@ const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const { merge } = require("webpack-merge"); const stunnerEditors = require("@kie-tools/stunner-editors"); const { env } = require("./env"); -const buildEnv = env; -module.exports = (env) => [ - merge(common(env), { +module.exports = (webpackEnv) => [ + merge(common(webpackEnv), { entry: { index: "./src/index.tsx", "envelope/base64-editor": "./src/envelope/base64-editor.ts", @@ -72,7 +71,7 @@ module.exports = (env) => [ historyApiFallback: false, static: [{ directory: path.join(__dirname, "./dist") }, { directory: path.join(__dirname, "./static") }], compress: true, - port: buildEnv.exampleWebapp.port, + port: env.exampleWebapp.port, }, ignoreWarnings: [/Failed to parse source map/], }), diff --git a/packages/boxed-expression-component/playwright.config.ts b/packages/boxed-expression-component/playwright.config.ts index 5868527ee5c..ea356d7618d 100644 --- a/packages/boxed-expression-component/playwright.config.ts +++ b/packages/boxed-expression-component/playwright.config.ts @@ -20,9 +20,9 @@ import { defineConfig } from "@playwright/test"; import playwirghtBaseConfig from "@kie-tools/playwright-base/playwright.config"; import merge from "lodash/merge"; -import { env } from "./env"; -const buildEnv: any = env; +import { env } from "./env"; +const buildEnv: any = env; // build-env is not typed const customConfig = defineConfig({ use: { diff --git a/packages/bpmn-vscode-extension/webpack.config.js b/packages/bpmn-vscode-extension/webpack.config.js index cd4e0fc77bd..d9ca1930a78 100644 --- a/packages/bpmn-vscode-extension/webpack.config.js +++ b/packages/bpmn-vscode-extension/webpack.config.js @@ -25,8 +25,8 @@ const { merge } = require("webpack-merge"); const { ProvidePlugin } = require("webpack"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); -const commonConfig = (env) => - merge(common(env), { +const commonConfig = (webpackEnv) => + merge(common(webpackEnv), { output: { library: "BpmnEditor", libraryTarget: "umd", @@ -38,14 +38,14 @@ const commonConfig = (env) => }, }); -module.exports = async (env) => [ - merge(commonConfig(env), { +module.exports = async (webpackEnv) => [ + merge(commonConfig(webpackEnv), { target: "node", entry: { "extension/extension": "./src/extension/extension.ts", }, }), - merge(commonConfig(env), { + merge(commonConfig(webpackEnv), { target: "webworker", entry: { "extension/extensionWeb": "./src/extension/extension.ts", @@ -57,7 +57,7 @@ module.exports = async (env) => [ }), ], }), - merge(commonConfig(env), { + merge(commonConfig(webpackEnv), { target: "web", entry: { "webview/BpmnEditorEnvelopeApp": "./src/webview/BpmnEditorEnvelopeApp.ts", diff --git a/packages/chrome-extension-pack-kogito-kie-editors/install.js b/packages/chrome-extension-pack-kogito-kie-editors/install.js index 68e55a1da19..f835ce2a1bb 100644 --- a/packages/chrome-extension-pack-kogito-kie-editors/install.js +++ b/packages/chrome-extension-pack-kogito-kie-editors/install.js @@ -17,7 +17,7 @@ * under the License. */ -const buildEnv = require("./env"); +const { env } = require("./env"); const path = require("path"); const fs = require("fs"); const prettier = require("prettier"); @@ -32,7 +32,7 @@ async function updateChromeExtensionManifest(version, manifestFilePath) { async function main() { console.info("[chrome-extension-pack-kogito-kie-editors-install] Updating manifest files..."); - const version = buildEnv.env.chromeExtension.version; + const version = env.chromeExtension.version; await updateChromeExtensionManifest(version, path.resolve("manifest.dev.json")); await updateChromeExtensionManifest(version, path.resolve("manifest.prod.json")); console.info("[chrome-extension-pack-kogito-kie-editors-install] Done."); diff --git a/packages/chrome-extension-pack-kogito-kie-editors/webpack.config.js b/packages/chrome-extension-pack-kogito-kie-editors/webpack.config.js index 42551f3d7b1..2d1f6dc382e 100644 --- a/packages/chrome-extension-pack-kogito-kie-editors/webpack.config.js +++ b/packages/chrome-extension-pack-kogito-kie-editors/webpack.config.js @@ -27,11 +27,10 @@ const stunnerEditors = require("@kie-tools/stunner-editors"); const { EnvironmentPlugin, ProvidePlugin } = require("webpack"); const path = require("path"); const { env } = require("./env"); -const buildEnv = env; function getRouterArgs() { - const targetOrigin = buildEnv.chromeExtension.routerTargetOrigin; - const relativePath = buildEnv.chromeExtension.routerRelativePath; + const targetOrigin = env.chromeExtension.routerTargetOrigin; + const relativePath = env.chromeExtension.routerRelativePath; console.info(`Chrome Extension :: Router target origin: ${targetOrigin}`); console.info(`Chrome Extension :: Router relative path: ${relativePath}`); @@ -40,8 +39,8 @@ function getRouterArgs() { } function getOnlineEditorArgs() { - const onlineEditorUrl = buildEnv.chromeExtension.onlineEditorUrl; - const manifestFile = buildEnv.chromeExtension.manifestFile; + const onlineEditorUrl = env.chromeExtension.onlineEditorUrl; + const manifestFile = env.chromeExtension.manifestFile; console.info(`Chrome Extension :: Online Editor URL: ${onlineEditorUrl}`); console.info(`Chrome Extension :: Manifest file: ${manifestFile}`); @@ -49,11 +48,11 @@ function getOnlineEditorArgs() { return [onlineEditorUrl, manifestFile]; } -module.exports = async (env) => { - const [router_targetOrigin, router_relativePath] = getRouterArgs(env); - const [onlineEditor_url, manifestFile] = getOnlineEditorArgs(env); +module.exports = async (webpackEnv) => { + const [router_targetOrigin, router_relativePath] = getRouterArgs(webpackEnv); + const [onlineEditor_url, manifestFile] = getOnlineEditorArgs(webpackEnv); - return merge(common(env), { + return merge(common(webpackEnv), { entry: { "content_scripts/github": "./src/github-content-script.ts", background: "./src/background.ts", @@ -65,7 +64,7 @@ module.exports = async (env) => { static: [{ directory: path.join(__dirname, "./dist") }], compress: true, https: true, - port: buildEnv.chromeExtension.dev.port, + port: env.chromeExtension.dev.port, }, plugins: [ new ProvidePlugin({ diff --git a/packages/chrome-extension-serverless-workflow-editor/e2e-tests/tests/SwfFullScreenTest.ts b/packages/chrome-extension-serverless-workflow-editor/e2e-tests/tests/SwfFullScreenTest.ts index 5a2c5837864..00cc94e1cff 100644 --- a/packages/chrome-extension-serverless-workflow-editor/e2e-tests/tests/SwfFullScreenTest.ts +++ b/packages/chrome-extension-serverless-workflow-editor/e2e-tests/tests/SwfFullScreenTest.ts @@ -23,15 +23,15 @@ import GitHubEditorPage from "@kie-tools/chrome-extension-test-helper/dist/frame import GitHubRepoPage from "@kie-tools/chrome-extension-test-helper/dist/framework/github-repo/GitHubRepoPage"; import Tools from "@kie-tools/chrome-extension-test-helper/dist/utils/Tools"; +// eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore import { env } from "../../env"; +const buildEnv: any = env; // build-env is not typed const TEST_NAME = "SwfFullScreenTest"; let tools: Tools; -const buildEnv: any = env; - beforeEach(async () => { tools = await Tools.init(TEST_NAME); diff --git a/packages/chrome-extension-serverless-workflow-editor/e2e-tests/tests/SwfTest.ts b/packages/chrome-extension-serverless-workflow-editor/e2e-tests/tests/SwfTest.ts index 8ccb6e805fa..e7c63c37268 100644 --- a/packages/chrome-extension-serverless-workflow-editor/e2e-tests/tests/SwfTest.ts +++ b/packages/chrome-extension-serverless-workflow-editor/e2e-tests/tests/SwfTest.ts @@ -24,15 +24,15 @@ import GitHubEditorPage from "@kie-tools/chrome-extension-test-helper/dist/frame import GitHubRepoPage from "@kie-tools/chrome-extension-test-helper/dist/framework/github-repo/GitHubRepoPage"; import SwfEditor from "@kie-tools/chrome-extension-test-helper/dist/framework/editor/swf/SwfEditor"; +// eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore import { env } from "../../env"; +const buildEnv: any = env; // build-env is not typed const TEST_NAME = "SwfTest"; let tools: Tools; -const buildEnv: any = env; - beforeEach(async () => { tools = await Tools.init(TEST_NAME); diff --git a/packages/chrome-extension-serverless-workflow-editor/install.js b/packages/chrome-extension-serverless-workflow-editor/install.js index 5251ff2f1cc..a1e1b494c65 100644 --- a/packages/chrome-extension-serverless-workflow-editor/install.js +++ b/packages/chrome-extension-serverless-workflow-editor/install.js @@ -17,7 +17,7 @@ * under the License. */ -const buildEnv = require("./env"); +const { env } = require("./env"); const path = require("path"); const fs = require("fs"); const prettier = require("prettier"); @@ -32,7 +32,7 @@ async function updateChromeExtensionManifest(version, manifestFilePath) { async function main() { console.info("[chrome-extension-serverless-workflow-editor-install] Updating manifest files..."); - const version = buildEnv.env.swfChromeExtension.version; + const version = env.swfChromeExtension.version; await updateChromeExtensionManifest(version, path.resolve("manifest.dev.json")); await updateChromeExtensionManifest(version, path.resolve("manifest.prod.json")); console.info("[chrome-extension-serverless-workflow-editor-install] Done."); diff --git a/packages/chrome-extension-serverless-workflow-editor/webpack.config.js b/packages/chrome-extension-serverless-workflow-editor/webpack.config.js index 447dc1bbf27..f8588fdd691 100644 --- a/packages/chrome-extension-serverless-workflow-editor/webpack.config.js +++ b/packages/chrome-extension-serverless-workflow-editor/webpack.config.js @@ -28,11 +28,10 @@ const path = require("path"); const MonacoWebpackPlugin = require("monaco-editor-webpack-plugin"); const swEditorAssets = require("@kie-tools/serverless-workflow-diagram-editor-assets"); const { env } = require("./env"); -const buildEnv = env; function getRouterArgs() { - const targetOrigin = buildEnv.swfChromeExtension.routerTargetOrigin; - const relativePath = buildEnv.swfChromeExtension.routerRelativePath; + const targetOrigin = env.swfChromeExtension.routerTargetOrigin; + const relativePath = env.swfChromeExtension.routerRelativePath; console.info(`SWF Chrome Extension :: Router target origin: ${targetOrigin}`); console.info(`SWF Chrome Extension :: Router relative path: ${relativePath}`); @@ -41,18 +40,18 @@ function getRouterArgs() { } function getManifestFile() { - const manifestFile = buildEnv.swfChromeExtension.manifestFile; + const manifestFile = env.swfChromeExtension.manifestFile; console.info(`SWF Chrome Extension :: Manifest file: ${manifestFile}`); return manifestFile; } -module.exports = async (env) => { - const [router_targetOrigin, router_relativePath] = getRouterArgs(env); - const manifestFile = getManifestFile(env); +module.exports = async (webpackEnv) => { + const [router_targetOrigin, router_relativePath] = getRouterArgs(webpackEnv); + const manifestFile = getManifestFile(webpackEnv); - return merge(common(env), { + return merge(common(webpackEnv), { entry: { "content_scripts/github": "./src/github-content-script.ts", background: "./src/background.ts", @@ -64,7 +63,7 @@ module.exports = async (env) => { static: [{ directory: path.join(__dirname, "./dist") }], compress: true, https: true, - port: buildEnv.swfChromeExtension.dev.port, + port: env.swfChromeExtension.dev.port, client: { overlay: false, }, diff --git a/packages/cors-proxy/webpack.config.js b/packages/cors-proxy/webpack.config.js index 8b54b923d1a..50f4700501a 100644 --- a/packages/cors-proxy/webpack.config.js +++ b/packages/cors-proxy/webpack.config.js @@ -20,8 +20,8 @@ const { merge } = require("webpack-merge"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); -module.exports = (env, argv) => [ - merge(common(env, argv), { +module.exports = (webpackEnv, webpackArgv) => [ + merge(common(webpackEnv, webpackArgv), { entry: { index: "./src/index.ts", }, diff --git a/packages/dashbuilder-component-assembler/webpack.config.js b/packages/dashbuilder-component-assembler/webpack.config.js index dc1a5346a64..5d36c8a29cf 100644 --- a/packages/dashbuilder-component-assembler/webpack.config.js +++ b/packages/dashbuilder-component-assembler/webpack.config.js @@ -22,7 +22,7 @@ const patternflyBase = require("@kie-tools-core/patternfly-base"); const { merge } = require("webpack-merge"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); -module.exports = async (env) => { +module.exports = async (webpackEnv) => { const components = ["uniforms", "table", "echarts", "svg-heatmap", "timeseries", "victory-charts", "map"]; const copyResources = []; @@ -33,7 +33,7 @@ module.exports = async (env) => { }); }); - return merge(common(env), { + return merge(common(webpackEnv), { entry: {}, plugins: [ new CopyPlugin({ diff --git a/packages/dashbuilder-component-echarts/dev-webapp/webpack.config.js b/packages/dashbuilder-component-echarts/dev-webapp/webpack.config.js index c9eab447dac..439f4293c98 100644 --- a/packages/dashbuilder-component-echarts/dev-webapp/webpack.config.js +++ b/packages/dashbuilder-component-echarts/dev-webapp/webpack.config.js @@ -24,8 +24,8 @@ const CopyPlugin = require("copy-webpack-plugin"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const HtmlWebpackPlugin = require("html-webpack-plugin"); -module.exports = async (env) => { - return merge(common(env), { +module.exports = async (webpackEnv) => { + return merge(common(webpackEnv), { mode: "development", entry: { index: path.resolve(__dirname, "./index.tsx"), diff --git a/packages/dashbuilder-component-echarts/webpack.config.js b/packages/dashbuilder-component-echarts/webpack.config.js index 3b2b5444f30..4df292e506f 100644 --- a/packages/dashbuilder-component-echarts/webpack.config.js +++ b/packages/dashbuilder-component-echarts/webpack.config.js @@ -23,8 +23,8 @@ const { merge } = require("webpack-merge"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const HtmlWebpackPlugin = require("html-webpack-plugin"); -module.exports = async (env) => { - return merge(common(env), { +module.exports = async (webpackEnv) => { + return merge(common(webpackEnv), { entry: { index: "./src/index.tsx", }, diff --git a/packages/dashbuilder-component-map/dev-webapp/webpack.config.js b/packages/dashbuilder-component-map/dev-webapp/webpack.config.js index a594a80dd11..74ccf723185 100644 --- a/packages/dashbuilder-component-map/dev-webapp/webpack.config.js +++ b/packages/dashbuilder-component-map/dev-webapp/webpack.config.js @@ -24,8 +24,8 @@ const CopyPlugin = require("copy-webpack-plugin"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const HtmlWebpackPlugin = require("html-webpack-plugin"); -module.exports = async (env) => { - return merge(common(env), { +module.exports = async (webpackEnv) => { + return merge(common(webpackEnv), { mode: "development", entry: { index: path.resolve(__dirname, "./index.tsx"), diff --git a/packages/dashbuilder-component-map/webpack.config.js b/packages/dashbuilder-component-map/webpack.config.js index 8e8fda5c3ca..bca775f9807 100644 --- a/packages/dashbuilder-component-map/webpack.config.js +++ b/packages/dashbuilder-component-map/webpack.config.js @@ -24,8 +24,8 @@ const CopyPlugin = require("copy-webpack-plugin"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const HtmlWebpackPlugin = require("html-webpack-plugin"); -module.exports = async (env) => { - return merge(common(env), { +module.exports = async (webpackEnv) => { + return merge(common(webpackEnv), { entry: { index: "./src/index.tsx", }, diff --git a/packages/dashbuilder-component-svg-heatmap/dev-webapp/webpack.config.js b/packages/dashbuilder-component-svg-heatmap/dev-webapp/webpack.config.js index aab157735c8..e2fa732a92d 100644 --- a/packages/dashbuilder-component-svg-heatmap/dev-webapp/webpack.config.js +++ b/packages/dashbuilder-component-svg-heatmap/dev-webapp/webpack.config.js @@ -24,8 +24,8 @@ const CopyPlugin = require("copy-webpack-plugin"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const HtmlWebpackPlugin = require("html-webpack-plugin"); -module.exports = async (env) => { - return merge(common(env), { +module.exports = async (webpackEnv) => { + return merge(common(webpackEnv), { mode: "development", entry: { index: path.resolve(__dirname, "./index.tsx"), diff --git a/packages/dashbuilder-component-svg-heatmap/webpack.config.js b/packages/dashbuilder-component-svg-heatmap/webpack.config.js index 3b2b5444f30..4df292e506f 100644 --- a/packages/dashbuilder-component-svg-heatmap/webpack.config.js +++ b/packages/dashbuilder-component-svg-heatmap/webpack.config.js @@ -23,8 +23,8 @@ const { merge } = require("webpack-merge"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const HtmlWebpackPlugin = require("html-webpack-plugin"); -module.exports = async (env) => { - return merge(common(env), { +module.exports = async (webpackEnv) => { + return merge(common(webpackEnv), { entry: { index: "./src/index.tsx", }, diff --git a/packages/dashbuilder-component-table/dev-webapp/webpack.config.js b/packages/dashbuilder-component-table/dev-webapp/webpack.config.js index 6c327943344..5f19de17f8d 100644 --- a/packages/dashbuilder-component-table/dev-webapp/webpack.config.js +++ b/packages/dashbuilder-component-table/dev-webapp/webpack.config.js @@ -24,8 +24,8 @@ const CopyPlugin = require("copy-webpack-plugin"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const HtmlWebpackPlugin = require("html-webpack-plugin"); -module.exports = async (env) => { - return merge(common(env), { +module.exports = async (webpackEnv) => { + return merge(common(webpackEnv), { mode: "development", entry: { index: path.resolve(__dirname, "./index.tsx"), diff --git a/packages/dashbuilder-component-table/webpack.config.js b/packages/dashbuilder-component-table/webpack.config.js index 0da36ff1f6c..87a5c270f20 100644 --- a/packages/dashbuilder-component-table/webpack.config.js +++ b/packages/dashbuilder-component-table/webpack.config.js @@ -24,8 +24,8 @@ const CopyPlugin = require("copy-webpack-plugin"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const HtmlWebpackPlugin = require("html-webpack-plugin"); -module.exports = async (env) => { - return merge(common(env), { +module.exports = async (webpackEnv) => { + return merge(common(webpackEnv), { entry: { index: "./src/index.tsx", }, diff --git a/packages/dashbuilder-component-timeseries/dev-webapp/webpack.config.js b/packages/dashbuilder-component-timeseries/dev-webapp/webpack.config.js index ce9b52bdce8..48b9ea7dfac 100644 --- a/packages/dashbuilder-component-timeseries/dev-webapp/webpack.config.js +++ b/packages/dashbuilder-component-timeseries/dev-webapp/webpack.config.js @@ -24,8 +24,8 @@ const CopyPlugin = require("copy-webpack-plugin"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const HtmlWebpackPlugin = require("html-webpack-plugin"); -module.exports = async (env) => { - return merge(common(env), { +module.exports = async (webpackEnv) => { + return merge(common(webpackEnv), { mode: "development", entry: { index: path.resolve(__dirname, "./index.tsx"), diff --git a/packages/dashbuilder-component-timeseries/webpack.config.js b/packages/dashbuilder-component-timeseries/webpack.config.js index 3b2b5444f30..4df292e506f 100644 --- a/packages/dashbuilder-component-timeseries/webpack.config.js +++ b/packages/dashbuilder-component-timeseries/webpack.config.js @@ -23,8 +23,8 @@ const { merge } = require("webpack-merge"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const HtmlWebpackPlugin = require("html-webpack-plugin"); -module.exports = async (env) => { - return merge(common(env), { +module.exports = async (webpackEnv) => { + return merge(common(webpackEnv), { entry: { index: "./src/index.tsx", }, diff --git a/packages/dashbuilder-component-uniforms/dev-webapp/webpack.config.js b/packages/dashbuilder-component-uniforms/dev-webapp/webpack.config.js index 0ef2b80b5d1..1c75455b61c 100644 --- a/packages/dashbuilder-component-uniforms/dev-webapp/webpack.config.js +++ b/packages/dashbuilder-component-uniforms/dev-webapp/webpack.config.js @@ -24,8 +24,8 @@ const CopyPlugin = require("copy-webpack-plugin"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const HtmlWebpackPlugin = require("html-webpack-plugin"); -module.exports = async (env) => { - return merge(common(env), { +module.exports = async (webpackEnv) => { + return merge(common(webpackEnv), { mode: "development", entry: { index: path.resolve(__dirname, "./index.tsx"), diff --git a/packages/dashbuilder-component-uniforms/webpack.config.js b/packages/dashbuilder-component-uniforms/webpack.config.js index 3b2b5444f30..4df292e506f 100644 --- a/packages/dashbuilder-component-uniforms/webpack.config.js +++ b/packages/dashbuilder-component-uniforms/webpack.config.js @@ -23,8 +23,8 @@ const { merge } = require("webpack-merge"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const HtmlWebpackPlugin = require("html-webpack-plugin"); -module.exports = async (env) => { - return merge(common(env), { +module.exports = async (webpackEnv) => { + return merge(common(webpackEnv), { entry: { index: "./src/index.tsx", }, diff --git a/packages/dashbuilder-component-victory-charts/dev-webapp/webpack.config.js b/packages/dashbuilder-component-victory-charts/dev-webapp/webpack.config.js index c9eab447dac..439f4293c98 100644 --- a/packages/dashbuilder-component-victory-charts/dev-webapp/webpack.config.js +++ b/packages/dashbuilder-component-victory-charts/dev-webapp/webpack.config.js @@ -24,8 +24,8 @@ const CopyPlugin = require("copy-webpack-plugin"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const HtmlWebpackPlugin = require("html-webpack-plugin"); -module.exports = async (env) => { - return merge(common(env), { +module.exports = async (webpackEnv) => { + return merge(common(webpackEnv), { mode: "development", entry: { index: path.resolve(__dirname, "./index.tsx"), diff --git a/packages/dashbuilder-component-victory-charts/webpack.config.js b/packages/dashbuilder-component-victory-charts/webpack.config.js index f7e358134f0..b46313754e3 100644 --- a/packages/dashbuilder-component-victory-charts/webpack.config.js +++ b/packages/dashbuilder-component-victory-charts/webpack.config.js @@ -24,8 +24,8 @@ const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const HtmlWebpackPlugin = require("html-webpack-plugin"); const CopyPlugin = require("copy-webpack-plugin"); -module.exports = async (env) => { - return merge(common(env), { +module.exports = async (webpackEnv) => { + return merge(common(webpackEnv), { entry: { index: "./src/index.tsx", }, diff --git a/packages/dashbuilder-editor/dev-webapp/webpack.config.js b/packages/dashbuilder-editor/dev-webapp/webpack.config.js index ef4891c5900..33f51e3a20f 100644 --- a/packages/dashbuilder-editor/dev-webapp/webpack.config.js +++ b/packages/dashbuilder-editor/dev-webapp/webpack.config.js @@ -23,10 +23,9 @@ const { merge } = require("webpack-merge"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const patternflyBase = require("@kie-tools-core/patternfly-base"); const MonacoWebpackPlugin = require("monaco-editor-webpack-plugin"); -const webpack = require("webpack"); -module.exports = (env) => - merge(common(env), { +module.exports = (webpackEnv) => + merge(common(webpackEnv), { mode: "development", entry: { index: path.resolve(__dirname, "./index.tsx"), diff --git a/packages/dashbuilder-viewer-deployment-webapp/webpack.config.js b/packages/dashbuilder-viewer-deployment-webapp/webpack.config.js index 313f22b8418..603ae40a0e0 100644 --- a/packages/dashbuilder-viewer-deployment-webapp/webpack.config.js +++ b/packages/dashbuilder-viewer-deployment-webapp/webpack.config.js @@ -23,11 +23,10 @@ const patternflyBase = require("@kie-tools-core/patternfly-base"); const { merge } = require("webpack-merge"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const { env } = require("./env"); -const buildEnv = env; const dashbuilderClient = require("@kie-tools/dashbuilder-client"); -module.exports = async (env) => - merge(common(env), { +module.exports = async (webpackEnv) => + merge(common(webpackEnv), { entry: { index: "./src/index.tsx", "dashbuilder-viewer-envelope-app": "./src/envelope/DashbuilderViewerEnvelopeApp.ts", @@ -63,6 +62,6 @@ module.exports = async (env) => historyApiFallback: false, static: [{ directory: path.join(__dirname, "./dist") }, { directory: path.join(__dirname, "./static") }], compress: true, - port: buildEnv.dashbuilderViewerDeploymentWebApp.dev.port, + port: env.dashbuilderViewerDeploymentWebApp.dev.port, }, }); diff --git a/packages/dashbuilder-viewer/dev-webapp/webpack.config.js b/packages/dashbuilder-viewer/dev-webapp/webpack.config.js index c765d701907..54a13f6b236 100644 --- a/packages/dashbuilder-viewer/dev-webapp/webpack.config.js +++ b/packages/dashbuilder-viewer/dev-webapp/webpack.config.js @@ -23,8 +23,8 @@ const { merge } = require("webpack-merge"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const patternflyBase = require("@kie-tools-core/patternfly-base"); -module.exports = (env) => - merge(common(env), { +module.exports = (webpackEnv) => + merge(common(webpackEnv), { mode: "development", entry: { index: path.resolve(__dirname, "./index.tsx"), diff --git a/examples/drools-process-usertasks-quarkus-example/install.js b/packages/dashbuilder/mvn.bootstrap.js similarity index 74% rename from examples/drools-process-usertasks-quarkus-example/install.js rename to packages/dashbuilder/mvn.bootstrap.js index 9102bb3b499..52aa21aa461 100644 --- a/examples/drools-process-usertasks-quarkus-example/install.js +++ b/packages/dashbuilder/mvn.bootstrap.js @@ -17,9 +17,10 @@ * under the License. */ -const buildEnv = require("./env"); -const { setup } = require("@kie-tools/maven-config-setup-helper"); +const { env } = require("./env"); +const { setupMavenConfigFile, buildTailFromPackageJsonDependencies } = require("@kie-tools/maven-base"); -setup(` - -Drevision=${buildEnv.env.droolsProcessUsertasksQuarkusExample.version} +setupMavenConfigFile(` + -Drevision=${env.dashbuilder.version} + -Dmaven.repo.local.tail=${buildTailFromPackageJsonDependencies()} `); diff --git a/packages/dashbuilder/package.json b/packages/dashbuilder/package.json index cbae8ac612e..d7fb2611d4a 100644 --- a/packages/dashbuilder/package.json +++ b/packages/dashbuilder/package.json @@ -32,7 +32,7 @@ "build:prod:win32": "pnpm powershell \"mvn clean install `-Dgwt.compiler.skip=true `-DskipTests\"", "copy:components": "pnpm delete:components && copyfiles -u 3 \"../dashbuilder-component-assembler/dist/**/*\" ./dashbuilder-runtime-parent/dashbuilder-runtime-client/src/main/webapp/dashbuilder/component", "delete:components": "rimraf ./dashbuilder-runtime-parent/dashbuilder-runtime-client/src/main/webapp/dashbuilder/component", - "install": "node install.js", + "install": "node mvn.bootstrap.js", "lint": "echo 'Linting'", "powershell": "@powershell -NoProfile -ExecutionPolicy Unrestricted -Command" }, @@ -41,7 +41,6 @@ }, "devDependencies": { "@kie-tools/dashbuilder-component-assembler": "workspace:*", - "@kie-tools/maven-config-setup-helper": "workspace:*", "@kie-tools/root-env": "workspace:*", "copyfiles": "^2.4.1", "rimraf": "^3.0.2", diff --git a/packages/dashbuilder/pom.xml b/packages/dashbuilder/pom.xml index fa92a1e0b90..dd4079be1e4 100644 --- a/packages/dashbuilder/pom.xml +++ b/packages/dashbuilder/pom.xml @@ -111,7 +111,6 @@ 3.2.0 3.2.3 3.1.1 - 2.8.2 2.5.2 3.8.2 1.8 @@ -1136,11 +1135,6 @@ maven-checkstyle-plugin ${version.checkstyle.plugin} - - org.apache.maven.plugins - maven-deploy-plugin - ${version.deploy.plugin} - org.apache.maven.plugins maven-install-plugin @@ -1304,7 +1298,6 @@ org.codehaus.mojo flatten-maven-plugin - 1.6.0 true resolveCiFriendliesOnly diff --git a/packages/data-index-webapp/webpack.config.js b/packages/data-index-webapp/webpack.config.js index ef01f3ecc63..ede2d67e989 100644 --- a/packages/data-index-webapp/webpack.config.js +++ b/packages/data-index-webapp/webpack.config.js @@ -21,10 +21,9 @@ const CopyPlugin = require("copy-webpack-plugin"); const { merge } = require("webpack-merge"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const { env } = require("./env"); -const buildEnv = env; -module.exports = async (env) => - merge(common(env), { +module.exports = async (webpackEnv) => + merge(common(webpackEnv), { entry: {}, plugins: [ new CopyPlugin({ @@ -40,6 +39,6 @@ module.exports = async (env) => static: { directory: "./dist", }, - port: buildEnv.dataIndexWebapp.dev.port, + port: env.dataIndexWebapp.dev.port, }, }); diff --git a/packages/dev-deployment-base-image/mvn.bootstrap.js b/packages/dev-deployment-base-image/mvn.bootstrap.js new file mode 100644 index 00000000000..4300132e652 --- /dev/null +++ b/packages/dev-deployment-base-image/mvn.bootstrap.js @@ -0,0 +1,28 @@ +/* + * 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 { env } = require("./env"); +const { setupMavenConfigFile, installMvnw, buildTailFromPackageJsonDependencies } = require("@kie-tools/maven-base"); + +setupMavenConfigFile(` + -Drevision=${env.devDeploymentBaseImage.version} + -Dmaven.repo.local.tail=${buildTailFromPackageJsonDependencies()} +`); + +installMvnw(); diff --git a/packages/dev-deployment-base-image/package.json b/packages/dev-deployment-base-image/package.json index 56b915c3594..003ba07a13c 100644 --- a/packages/dev-deployment-base-image/package.json +++ b/packages/dev-deployment-base-image/package.json @@ -24,10 +24,7 @@ "create-test-image:minikube": "kie-tools--image-builder minikube -r \"$(build-env devDeploymentBaseImage.registry)\" -a \"$(build-env devDeploymentBaseImage.account)\" -n \"$(build-env devDeploymentBaseImage.name)\" -t \"$(build-env devDeploymentBaseImage.buildTag)\" --build-arg BUILDER_IMAGE_ARG=\"$(build-env devDeploymentBaseImage.builderImage)\"", "create-test-image:openshift": "kie-tools--image-builder openshift -r \"$(build-env devDeploymentBaseImage.registry)\" -a \"$(build-env devDeploymentBaseImage.account)\" -n \"$(build-env devDeploymentBaseImage.name)\" -t \"$(build-env devDeploymentBaseImage.buildTag)\" --build-arg BUILDER_IMAGE_ARG=\"$(build-env devDeploymentBaseImage.builderImage)\"", "image:docker:build": "kie-tools--image-builder build -r \"$(build-env devDeploymentBaseImage.registry)\" -a \"$(build-env devDeploymentBaseImage.account)\" -n \"$(build-env devDeploymentBaseImage.name)\" -t \"$(build-env devDeploymentBaseImage.buildTag)\" --build-arg BUILDER_IMAGE_ARG=\"$(build-env devDeploymentBaseImage.builderImage)\" --build-arg USER_ID_ARG=\"$(build-env devDeploymentBaseImage.userId)\" --build-arg HOME_PATH_ARG=\"$(build-env devDeploymentBaseImage.homePath)\"", - "install": "node install.js && pnpm install:mvnw", - "install:mvnw": "run-script-os", - "install:mvnw:darwin:linux": "mvn -e org.apache.maven.plugins:maven-wrapper-plugin:3.3.0:wrapper", - "install:mvnw:win32": "pnpm powershell \"mvn -e org.apache.maven.plugins:maven-wrapper-plugin:3.3.0:wrapper\"", + "install": "node mvn.bootstrap.js", "powershell": "@powershell -NoProfile -ExecutionPolicy Unrestricted -Command" }, "dependencies": { @@ -36,7 +33,6 @@ "devDependencies": { "@kie-tools/dev-deployment-upload-service": "workspace:*", "@kie-tools/image-builder": "workspace:*", - "@kie-tools/maven-config-setup-helper": "workspace:*", "@kie-tools/root-env": "workspace:*", "rimraf": "^3.0.2", "run-script-os": "^1.1.6" diff --git a/packages/dev-deployment-dmn-form-webapp/dev-webapp/quarkus-app/pom.xml b/packages/dev-deployment-dmn-form-webapp/dev-webapp/quarkus-app/pom.xml index a96b5f74450..65a4b73d19c 100644 --- a/packages/dev-deployment-dmn-form-webapp/dev-webapp/quarkus-app/pom.xml +++ b/packages/dev-deployment-dmn-form-webapp/dev-webapp/quarkus-app/pom.xml @@ -37,16 +37,29 @@ 0.0.0 - 3.13.0 - true 17 17 UTF-8 UTF-8 - 3.5.0 - 3.12.1 - 3.2.0 - 3.4.1 + + + 3.4.1 + 3.13.0 + 3.2.0 + 3.0.0-M7 + 3.5.0 + 3.1.2 + 3.12.1 + 3.6.1 + 3.4.1 + 3.2.0 + 3.4.0 + 1.6.0 + + + true + + 4.13.2 true 1.26.1 @@ -146,7 +159,7 @@ org.apache.maven.plugins maven-site-plugin - ${maven.site.plugin.version} + ${version.maven.site.plugin} org.apache.commons @@ -163,7 +176,7 @@ org.apache.maven.plugins maven-remote-resources-plugin - ${maven.remote.resources.plugin.version} + ${version.maven.remote.resources.plugin} org.apache.commons @@ -180,7 +193,7 @@ org.apache.maven.plugins maven-jar-plugin - ${maven.jar.plugin.version} + ${version.maven.jar.plugin} org.iq80.snappy @@ -192,7 +205,7 @@ org.apache.maven.plugins maven-surefire-plugin - ${surefire-plugin.version} + ${version.maven.surefire.plugin} org.iq80.snappy @@ -224,14 +237,14 @@ maven-compiler-plugin - ${compiler-plugin.version} + ${version.maven.compiler.plugin} ${maven.compiler.parameters} maven-surefire-plugin - ${surefire-plugin.version} + ${version.maven.surefire.plugin} org.jboss.logmanager.LogManager @@ -242,7 +255,7 @@ org.codehaus.mojo flatten-maven-plugin - 1.6.0 + ${version.codehaus.flatten.plugin} true resolveCiFriendliesOnly diff --git a/packages/dev-deployment-dmn-form-webapp/dev-webapp/start.js b/packages/dev-deployment-dmn-form-webapp/dev-webapp/start.js index ab44038f1fc..e80e0d02afa 100644 --- a/packages/dev-deployment-dmn-form-webapp/dev-webapp/start.js +++ b/packages/dev-deployment-dmn-form-webapp/dev-webapp/start.js @@ -21,8 +21,6 @@ const { spawn } = require("node:child_process"); const path = require("path"); const { env } = require("../env"); -const buildEnv = env; - const mvn = spawn( "mvn", [ @@ -31,10 +29,10 @@ const mvn = spawn( "clean", "quarkus:dev", "-Dmaven.test.skip", - `-Dquarkus.platform.version=${buildEnv.quarkusPlatform.version}`, - `-Dversion.org.kie.kogito=${buildEnv.kogitoRuntime.version}`, - `-Dquarkus.http.port=${buildEnv.devDeploymentDmnFormWebapp.dev.quarkusPort}`, - `-Dkogito.service.url=http://localhost:${buildEnv.devDeploymentDmnFormWebapp.dev.quarkusPort}`, + `-Dquarkus.platform.version=${env.quarkusPlatform.version}`, + `-Dversion.org.kie.kogito=${env.kogitoRuntime.version}`, + `-Dquarkus.http.port=${env.devDeploymentDmnFormWebapp.dev.quarkusPort}`, + `-Dkogito.service.url=http://localhost:${env.devDeploymentDmnFormWebapp.dev.quarkusPort}`, "-Dquarkus.http.root-path=/", ], { shell: true } @@ -74,13 +72,13 @@ const webpack = spawn( "--env", mode, "--port", - buildEnv.devDeploymentDmnFormWebapp.dev.webpackPort, + env.devDeploymentDmnFormWebapp.dev.webpackPort, ], { shell: true, env: { ...process.env, // contains PATH which is needed to find the commands - DEV_DEPLOYMENT_DMN_FORM_WEBAPP__quarkusAppOrigin: `http://localhost:${buildEnv.devDeploymentDmnFormWebapp.dev.quarkusPort}`, + DEV_DEPLOYMENT_DMN_FORM_WEBAPP__quarkusAppOrigin: `http://localhost:${env.devDeploymentDmnFormWebapp.dev.quarkusPort}`, DEV_DEPLOYMENT_DMN_FORM_WEBAPP__quarkusAppPath: "", }, } diff --git a/packages/dev-deployment-dmn-form-webapp/webpack.config.ts b/packages/dev-deployment-dmn-form-webapp/webpack.config.ts index 29ced85de8a..edbcd8d7e36 100644 --- a/packages/dev-deployment-dmn-form-webapp/webpack.config.ts +++ b/packages/dev-deployment-dmn-form-webapp/webpack.config.ts @@ -26,8 +26,8 @@ import { ProvidePlugin } from "webpack"; import NodePolyfillPlugin from "node-polyfill-webpack-plugin"; import { defaultEnvJson } from "./build/defaultEnvJson"; -export default async (env: any, argv: any) => { - return merge(common(env), { +export default async (webpackEnv: any, webpackArgv: any) => { + return merge(common(webpackEnv), { entry: { index: "./src/index.tsx", }, diff --git a/packages/dev-deployment-kogito-quarkus-blank-app-image/Containerfile b/packages/dev-deployment-kogito-quarkus-blank-app-image/Containerfile index 37cd0daa263..6eaa2e3e6f1 100644 --- a/packages/dev-deployment-kogito-quarkus-blank-app-image/Containerfile +++ b/packages/dev-deployment-kogito-quarkus-blank-app-image/Containerfile @@ -30,7 +30,7 @@ COPY --chown=$USER_ID:$USER_ID dist-dev/quarkus-app $HOME_PATH/app/ COPY --chown=$USER_ID:$USER_ID dist-dev/settings.xml /tmp/kogito/.m2/settings.xml # Pre-populate local Maven repository for faster startup -RUN ./mvnw clean package -B --settings /tmp/kogito/.m2/settings.xml -Dmaven.test.skip -Dmaven.repo.local=/tmp/kogito/.m2/repository -Dquarkus.http.non-application-root-path=${ROOT_PATH}/q -Dquarkus.http.root-path=${ROOT_PATH} \ +RUN ./mvnw clean package -B -nsu -ntp --settings /tmp/kogito/.m2/settings.xml -Dmaven.test.skip -Dmaven.repo.local=/tmp/kogito/.m2/repository -Dquarkus.http.non-application-root-path=${ROOT_PATH}/q -Dquarkus.http.root-path=${ROOT_PATH} \ && chgrp -R 0 $HOME_PATH/app && chmod -R g=u $HOME_PATH/app && chgrp -R 0 /tmp/kogito && chmod -R g=u /tmp/kogito && chgrp -R 0 /.m2 && chmod -R g=u /.m2 USER $USER_ID diff --git a/packages/dev-deployment-kogito-quarkus-blank-app-image/env/index.js b/packages/dev-deployment-kogito-quarkus-blank-app-image/env/index.js index db4e8b45097..62353539324 100644 --- a/packages/dev-deployment-kogito-quarkus-blank-app-image/env/index.js +++ b/packages/dev-deployment-kogito-quarkus-blank-app-image/env/index.js @@ -51,10 +51,6 @@ module.exports = composeEnv([rootEnv], { default: rootEnv.env.root.streamName, description: "Tag version of this image. E.g., `main` or `10.0.x` or `10.0.0", }, - DEV_DEPLOYMENT_KOGITO_QUARKUS_BLANK_APP_IMAGE__mavenM2RepoViaHttpImage: { - default: `${mavenM2RepoViaHttpImageEnv.registry}/${mavenM2RepoViaHttpImageEnv.account}/${mavenM2RepoViaHttpImageEnv.name}:${mavenM2RepoViaHttpImageEnv.tag}`, - description: "The image tag for the Maven M2 Repo via HTTP. Used during the build only.", - }, }), get env() { return { @@ -66,9 +62,7 @@ module.exports = composeEnv([rootEnv], { buildTag: getOrDefault(this.vars.DEV_DEPLOYMENT_KOGITO_QUARKUS_BLANK_APP_IMAGE__buildTag), version: require("../package.json").version, dev: { - mavenM2RepoViaHttpImage: getOrDefault( - this.vars.DEV_DEPLOYMENT_KOGITO_QUARKUS_BLANK_APP_IMAGE__mavenM2RepoViaHttpImage - ), + mavenM2RepoViaHttpImage: `${mavenM2RepoViaHttpImageEnv.registry}/${mavenM2RepoViaHttpImageEnv.account}/${mavenM2RepoViaHttpImageEnv.name}:${mavenM2RepoViaHttpImageEnv.buildTag}`, }, }, }; diff --git a/packages/dev-deployment-kogito-quarkus-blank-app-image/install.js b/packages/dev-deployment-kogito-quarkus-blank-app-image/install.js deleted file mode 100644 index ef3dc831446..00000000000 --- a/packages/dev-deployment-kogito-quarkus-blank-app-image/install.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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 buildEnv = require("./env"); -const { setup } = require("@kie-tools/maven-config-setup-helper"); - -setup(` - -Drevision=${buildEnv.env.devDeploymentKogitoQuarkusBlankAppImage.version} -`); diff --git a/packages/dev-deployment-kogito-quarkus-blank-app-image/package.json b/packages/dev-deployment-kogito-quarkus-blank-app-image/package.json index 9ef24001763..7ac8c1a05e2 100644 --- a/packages/dev-deployment-kogito-quarkus-blank-app-image/package.json +++ b/packages/dev-deployment-kogito-quarkus-blank-app-image/package.json @@ -13,7 +13,7 @@ "url": "https://github.com/apache/incubator-kie-tools/issues" }, "scripts": { - "build": "run-script-if --bool \"$(build-env containerImages.build)\" --then \"pnpm m2-repo-via-http:container:run\" \"pnpm copy:assets\" \"pnpm image:docker:build\" --finally \"pnpm m2-repo-via-http:container:kill\"", + "build": "run-script-if --bool \"$(build-env containerImages.build)\" --then \"pnpm m2-repo-via-http:container:run\" \"pnpm copy:assets\" \"pnpm image:docker:build\" --finally \"pnpm m2-repo-via-http:container:kill\" \"rimraf ./dist/tmp-m2\"", "build:dev": "pnpm build", "build:prod": "pnpm build", "copy:assets": "rimraf dist-dev && mkdir -p ./dist-dev && pnpm copy:quarkus-app && pnpm copy:maven-m2-repo-via-http-image--settings-xml", @@ -28,9 +28,9 @@ "create-test-image:minikube": "kie-tools--image-builder minikube -r \"$(build-env devDeploymentKogitoQuarkusBlankAppImage.registry)\" -a \"$(build-env devDeploymentKogitoQuarkusBlankAppImage.account)\" -n \"$(build-env devDeploymentKogitoQuarkusBlankAppImage.name)\" -t \"$(build-env devDeploymentKogitoQuarkusBlankAppImage.buildTag)\" --build-arg BUILDER_IMAGE_ARG=\"$(build-env devDeploymentKogitoQuarkusBlankAppImage.builderImage)\" --build-arg ROOT_PATH=/", "create-test-image:openshift": "kie-tools--image-builder openshift -r \"$(build-env devDeploymentKogitoQuarkusBlankAppImage.registry)\" -a \"$(build-env devDeploymentKogitoQuarkusBlankAppImage.account)\" -n \"$(build-env devDeploymentKogitoQuarkusBlankAppImage.name)\" -t \"$(build-env devDeploymentKogitoQuarkusBlankAppImage.buildTag)\" --build-arg BUILDER_IMAGE_ARG=\"$(build-env devDeploymentKogitoQuarkusBlankAppImage.builderImage)\" --build-arg ROOT_PATH=/", "image:docker:build": "kie-tools--image-builder build --allowHostNetworkAccess -r \"$(build-env devDeploymentKogitoQuarkusBlankAppImage.registry)\" -a \"$(build-env devDeploymentKogitoQuarkusBlankAppImage.account)\" -n \"$(build-env devDeploymentKogitoQuarkusBlankAppImage.name)\" -t \"$(build-env devDeploymentKogitoQuarkusBlankAppImage.buildTag)\" --build-arg BUILDER_IMAGE_ARG=\"$(build-env devDeploymentKogitoQuarkusBlankAppImage.builderImage)\" --build-arg ROOT_PATH=/", - "install": "node install.js", "m2-repo-via-http:container:kill": "(docker container kill m2-repo-via-http || true) && (docker container rm m2-repo-via-http || true)", - "m2-repo-via-http:container:run": "(pnpm m2-repo-via-http:container:kill || true) && docker run --name m2-repo-via-http -v \"$(mvn help:evaluate -Dexpression=settings.localRepository -q -DforceStdout):/var/www/html\" -dit $(build-env devDeploymentKogitoQuarkusBlankAppImage.dev.mavenM2RepoViaHttpImage)", + "m2-repo-via-http:container:prepare-m2-repo-volume": "node -e 'require(`@kie-tools/maven-base`).prepareHardLinkedM2ForPackage(`./dist/tmp-m2/repository`, `./node_modules/@kie-tools/dev-deployment-kogito-quarkus-blank-app`)'", + "m2-repo-via-http:container:run": "(pnpm m2-repo-via-http:container:kill || true) && pnpm m2-repo-via-http:container:prepare-m2-repo-volume && docker run -p 8888:80 --name m2-repo-via-http -v \"./dist/tmp-m2/repository:/var/www/html\" -dit $(build-env devDeploymentKogitoQuarkusBlankAppImage.dev.mavenM2RepoViaHttpImage)", "powershell": "@powershell -NoProfile -ExecutionPolicy Unrestricted -Command" }, "dependencies": { @@ -39,7 +39,7 @@ }, "devDependencies": { "@kie-tools/image-builder": "workspace:*", - "@kie-tools/maven-config-setup-helper": "workspace:*", + "@kie-tools/maven-base": "workspace:*", "@kie-tools/maven-m2-repo-via-http-image": "workspace:*", "@kie-tools/root-env": "workspace:*", "rimraf": "^3.0.2", diff --git a/packages/dev-deployment-kogito-quarkus-blank-app/install.js b/packages/dev-deployment-kogito-quarkus-blank-app/install.js deleted file mode 100644 index 8484cdd6bfa..00000000000 --- a/packages/dev-deployment-kogito-quarkus-blank-app/install.js +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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 buildEnv = require("./env"); -const { setup } = require("@kie-tools/maven-config-setup-helper"); - -setup(` - -Drevision=${buildEnv.env.devDeploymentQuarkusApp.version} - -Dquarkus.platform.version=${buildEnv.env.quarkusPlatform.version} - -Dversion.org.kie.kogito=${buildEnv.env.kogitoRuntime.version} -`); diff --git a/packages/dev-deployment-kogito-quarkus-blank-app/mvn.bootstrap.js b/packages/dev-deployment-kogito-quarkus-blank-app/mvn.bootstrap.js new file mode 100644 index 00000000000..aa5623bfe0e --- /dev/null +++ b/packages/dev-deployment-kogito-quarkus-blank-app/mvn.bootstrap.js @@ -0,0 +1,35 @@ +/* + * 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 { env } = require("./env"); +const { setupMavenConfigFile, installMvnw, buildTailFromPackageJsonDependencies } = require("@kie-tools/maven-base"); + +setupMavenConfigFile( + ` + --batch-mode + -Dstyle.color=always + -Drevision=${env.devDeploymentQuarkusApp.version} + -Dquarkus.platform.version=${env.quarkusPlatform.version} + -Dversion.org.kie.kogito=${env.kogitoRuntime.version} + -Dmaven.repo.local.tail=${buildTailFromPackageJsonDependencies()} +`, + { ignoreDefault: true } // Can't have special configuration that only works inside this repo. +); + +installMvnw(); diff --git a/packages/dev-deployment-kogito-quarkus-blank-app/package.json b/packages/dev-deployment-kogito-quarkus-blank-app/package.json index 358afb27bc7..0d0711f1540 100644 --- a/packages/dev-deployment-kogito-quarkus-blank-app/package.json +++ b/packages/dev-deployment-kogito-quarkus-blank-app/package.json @@ -19,19 +19,18 @@ "build:prod": "pnpm lint && run-script-os", "build:prod:darwin:linux": "mvn clean install -DskipTests=$(build-env tests.run --not) -Dmaven.test.failure.ignore=$(build-env tests.ignoreFailures)", "build:prod:win32": "pnpm powershell \"mvn clean install `-DskipTests=$(build-env tests.run --not) `-Dmaven.test.failure.ignore=$(build-env tests.ignoreFailures)\"", - "install": "node install.js && pnpm install:mvnw", - "install:mvnw": "run-script-os", - "install:mvnw:darwin:linux": "mvn -e org.apache.maven.plugins:maven-wrapper-plugin:3.3.0:wrapper", - "install:mvnw:win32": "pnpm powershell \"mvn -e org.apache.maven.plugins:maven-wrapper-plugin:3.3.0:wrapper\"", + "install": "node mvn.bootstrap.js", "lint": "echo 'Linting'", "powershell": "@powershell -NoProfile -ExecutionPolicy Unrestricted -Command", "quarkus:dev": "run-script-os", "quarkus:dev:darwin:linux": "mvn clean package quarkus:dev -DskipTests", "quarkus:dev:win32": "mvn clean package quarkus:dev `-DskipTests" }, - "dependencies": {}, + "dependencies": { + "@kie-tools/jbpm-quarkus-devui": "workspace:*", + "@kie-tools/maven-base": "workspace:*" + }, "devDependencies": { - "@kie-tools/maven-config-setup-helper": "workspace:*", "@kie-tools/root-env": "workspace:*", "run-script-os": "^1.1.6" }, diff --git a/packages/dev-deployment-kogito-quarkus-blank-app/pom.xml b/packages/dev-deployment-kogito-quarkus-blank-app/pom.xml index 259bc458762..19458d3a1e9 100644 --- a/packages/dev-deployment-kogito-quarkus-blank-app/pom.xml +++ b/packages/dev-deployment-kogito-quarkus-blank-app/pom.xml @@ -37,18 +37,32 @@ ${revision} - 3.13.0 - true 17 17 UTF-8 UTF-8 - 3.5.0 - 3.12.1 - 3.2.0 - 3.4.1 - 4.13.2 + + + 3.4.1 + 3.13.0 + 3.2.0 + 3.0.0-M7 + 3.5.0 + 3.1.3 + 3.1.2 + 3.12.1 + 3.6.1 + 3.4.1 + 3.2.0 + 3.4.0 + 1.6.0 + + + true true + + + 4.13.2 1.26.1 0.5 @@ -117,13 +131,6 @@ - - - io.quarkus quarkus-junit5 @@ -142,6 +149,60 @@ + + + include-1st-party-dependencies + + + kieTools.do-not-use-this-property.ignore1stPartyDependencies + !true + + + + + + org.jbpm + jbpm-quarkus-devui-bom + ${project.version} + pom + import + + + + + + org.jbpm + jbpm-quarkus-devui + + + + + + + + use-maven-repo-local-tail + + + kieTools.do-not-use-this-property.ignoreMavenRepoLocalTail + !true + + + + + + + org.apache.maven.plugins + maven-install-plugin + + true + + + + + + + + @@ -153,7 +214,7 @@ org.apache.maven.plugins maven-site-plugin - ${maven.site.plugin.version} + ${version.maven.site.plugin} org.apache.commons @@ -170,7 +231,7 @@ org.apache.maven.plugins maven-remote-resources-plugin - ${maven.remote.resources.plugin.version} + ${version.maven.remote.resources.plugin} org.apache.commons @@ -187,7 +248,7 @@ org.apache.maven.plugins maven-jar-plugin - ${maven.jar.plugin.version} + ${version.maven.jar.plugin} org.iq80.snappy @@ -199,7 +260,7 @@ org.apache.maven.plugins maven-surefire-plugin - ${surefire-plugin.version} + ${version.maven.surefire.plugin} org.iq80.snappy @@ -231,14 +292,14 @@ maven-compiler-plugin - ${compiler-plugin.version} + ${version.maven.compiler.plugin} ${maven.compiler.parameters} maven-surefire-plugin - ${surefire-plugin.version} + ${version.maven.surefire.plugin} org.jboss.logmanager.LogManager @@ -249,7 +310,7 @@ org.codehaus.mojo flatten-maven-plugin - 1.6.0 + ${version.codehaus.flatten.plugin} true resolveCiFriendliesOnly diff --git a/packages/dev-deployment-upload-service/scripts/runTestServers.js b/packages/dev-deployment-upload-service/scripts/runTestServers.js index 411e2bf0651..d789e879f4d 100644 --- a/packages/dev-deployment-upload-service/scripts/runTestServers.js +++ b/packages/dev-deployment-upload-service/scripts/runTestServers.js @@ -20,7 +20,7 @@ const { execSync } = require("child_process"); const { argv } = require("process"); const version = require("../package.json").version; -const buildEnv = require("../env"); +const { env } = require("../env"); const network = "ddus-network"; const builder = "ddus-builder"; @@ -38,9 +38,9 @@ const imagesNames = { }; const containersPorts = { - fileserver: buildEnv.env.devDeploymentUploadService.dev.fileServerPort, - buildtimeInstall: buildEnv.env.devDeploymentUploadService.dev.buildTimePort, - runTimeInstall: buildEnv.env.devDeploymentUploadService.dev.runtTimePort, + fileserver: env.devDeploymentUploadService.dev.fileServerPort, + buildtimeInstall: env.devDeploymentUploadService.dev.buildTimePort, + runTimeInstall: env.devDeploymentUploadService.dev.runtTimePort, }; function runCommand(command, returnResult = false) { diff --git a/packages/dev-deployment-upload-service/tests/integrationTest.test.js b/packages/dev-deployment-upload-service/tests/integrationTest.test.js index 8c1164b4b9a..cca909dbbdd 100644 --- a/packages/dev-deployment-upload-service/tests/integrationTest.test.js +++ b/packages/dev-deployment-upload-service/tests/integrationTest.test.js @@ -19,15 +19,15 @@ const { execSync, execFileSync } = require("child_process"); const path = require("path"); -const buildEnv = require("../env"); +const { env } = require("../env"); const version = require("../package.json").version; const filePath = path.join(process.cwd(), "tests/test.zip"); const containersPorts = { - fileserver: buildEnv.env.devDeploymentUploadService.dev.fileServerPort, - buildtimeInstall: buildEnv.env.devDeploymentUploadService.dev.buildTimePort, - runTimeInstall: buildEnv.env.devDeploymentUploadService.dev.runtTimePort, + fileserver: env.devDeploymentUploadService.dev.fileServerPort, + buildtimeInstall: env.devDeploymentUploadService.dev.buildTimePort, + runTimeInstall: env.devDeploymentUploadService.dev.runtTimePort, }; const dockerInfo = JSON.parse(execSync(`docker info --format '{{ json . }}'`).toString().trim()); diff --git a/packages/dmn-editor-standalone/webpack.config.js b/packages/dmn-editor-standalone/webpack.config.js index 43e2e93035f..fbe77d9ea13 100644 --- a/packages/dmn-editor-standalone/webpack.config.js +++ b/packages/dmn-editor-standalone/webpack.config.js @@ -23,10 +23,9 @@ const path = require("path"); const { env } = require("./env"); const HtmlWebpackPlugin = require("html-webpack-plugin"); const { ProvidePlugin } = require("webpack"); -const buildEnv = env; -module.exports = (env) => - merge(common(env), { +module.exports = (webpackEnv) => + merge(common(webpackEnv), { output: { path: path.join(__dirname, "dist"), filename: "[name].js", @@ -65,7 +64,7 @@ module.exports = (env) => historyApiFallback: false, static: [{ directory: path.join(__dirname, "./dist") }], compress: true, - port: buildEnv.dmnEditorStandalone.dev.port, + port: env.dmnEditorStandalone.dev.port, }, performance: { hints: false, diff --git a/packages/dmn-editor-standalone/webpack.envelope-config.js b/packages/dmn-editor-standalone/webpack.envelope-config.js index b74a1fcaff1..d41d8e00481 100644 --- a/packages/dmn-editor-standalone/webpack.envelope-config.js +++ b/packages/dmn-editor-standalone/webpack.envelope-config.js @@ -23,8 +23,8 @@ const path = require("path"); const patternflyBase = require("@kie-tools-core/patternfly-base"); const { ProvidePlugin } = require("webpack"); -module.exports = (env) => - merge(common(env), { +module.exports = (webpackEnv) => + merge(common(webpackEnv), { output: { path: path.join(__dirname, "dist"), filename: "[name].js", diff --git a/packages/dmn-editor/playwright.config.ts b/packages/dmn-editor/playwright.config.ts index b5d633ac630..f7b047a8455 100644 --- a/packages/dmn-editor/playwright.config.ts +++ b/packages/dmn-editor/playwright.config.ts @@ -20,9 +20,9 @@ import { defineConfig } from "@playwright/test"; import playwirghtBaseConfig from "@kie-tools/playwright-base/playwright.config"; import merge from "lodash/merge"; -import { env } from "./env"; -const buildEnv: any = env; +import { env } from "./env"; +const buildEnv: any = env; // build-env is not typed const customConfig = defineConfig({ use: { diff --git a/packages/dmn-marshaller-backend-compatibility-tester/src/index.ts b/packages/dmn-marshaller-backend-compatibility-tester/src/index.ts index bc3ccc2f505..49cf803a3c3 100644 --- a/packages/dmn-marshaller-backend-compatibility-tester/src/index.ts +++ b/packages/dmn-marshaller-backend-compatibility-tester/src/index.ts @@ -18,7 +18,7 @@ */ import * as path from "path"; -const buildEnv = require("../env"); +const { env } = require("../env"); const jbang = require("@jbangdev/jbang"); const parentScriptPath = path.join(__dirname, "..", "src", "DmnMarshallerBackendCompatibilityTesterScript.java"); @@ -81,7 +81,7 @@ function executeScript(scriptPath: string, args?: string[]) { const quoteChar = isWindowsPath ? '"' : "'"; const jbangArgs = [] as string[]; - jbangArgs.push("-Dkogito-runtime.version=" + buildEnv.env.kogitoRuntime.version); + jbangArgs.push("-Dkogito-runtime.version=" + env.kogitoRuntime.version); jbangArgs.push(scriptPath); args?.forEach((arg) => jbangArgs.push(quoteChar + arg + quoteChar)); diff --git a/packages/dmn-testing-models/index.js b/packages/dmn-testing-models/index.js deleted file mode 100644 index e3745dd42a2..00000000000 --- a/packages/dmn-testing-models/index.js +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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. - */ - -/** Empty Entrypoint of this module - No TS/JS code here, it just holds DMN files for testing purposes */ diff --git a/packages/dmn-testing-models/install.js b/packages/dmn-testing-models/install.js deleted file mode 100644 index 1e1c38e2b32..00000000000 --- a/packages/dmn-testing-models/install.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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 buildEnv = require("./env"); -const { setup } = require("@kie-tools/maven-config-setup-helper"); - -setup(` - -Drevision=${buildEnv.env.dmnTestingModels.version} -`); diff --git a/packages/dev-deployment-base-image/install.js b/packages/dmn-testing-models/mvn.bootstrap.js similarity index 74% rename from packages/dev-deployment-base-image/install.js rename to packages/dmn-testing-models/mvn.bootstrap.js index 5c348fae2e2..15bebecbd51 100644 --- a/packages/dev-deployment-base-image/install.js +++ b/packages/dmn-testing-models/mvn.bootstrap.js @@ -17,9 +17,10 @@ * under the License. */ -const buildEnv = require("./env"); -const { setup } = require("@kie-tools/maven-config-setup-helper"); +const { env } = require("./env"); +const { setupMavenConfigFile, buildTailFromPackageJsonDependencies } = require("@kie-tools/maven-base"); -setup(` - -Drevision=${buildEnv.env.devDeploymentBaseImage.version} +setupMavenConfigFile(` + -Drevision=${env.dmnTestingModels.version} + -Dmaven.repo.local.tail=${buildTailFromPackageJsonDependencies()} `); diff --git a/packages/dmn-testing-models/package.json b/packages/dmn-testing-models/package.json index 99540911e69..af4c0fbddca 100644 --- a/packages/dmn-testing-models/package.json +++ b/packages/dmn-testing-models/package.json @@ -20,14 +20,13 @@ "build:dev:linux:darwin": "mvn clean verify", "build:dev:win32": "pnpm powershell \"mvn clean verify\"", "build:prod": "pnpm build:dev", - "install": "node install.js", + "install": "node mvn.bootstrap.js", "powershell": "@powershell -NoProfile -ExecutionPolicy Unrestricted -Command" }, "dependencies": { "@kie-tools/maven-base": "workspace:*" }, "devDependencies": { - "@kie-tools/maven-config-setup-helper": "workspace:*", "@kie-tools/root-env": "workspace:*", "copyfiles": "^2.4.1", "rimraf": "^3.0.2", diff --git a/packages/dmn-vscode-extension/webpack.config.js b/packages/dmn-vscode-extension/webpack.config.js index 2d4f0da6919..be947339e93 100644 --- a/packages/dmn-vscode-extension/webpack.config.js +++ b/packages/dmn-vscode-extension/webpack.config.js @@ -25,8 +25,8 @@ const { merge } = require("webpack-merge"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const { ProvidePlugin } = require("webpack"); -const commonConfig = (env) => - merge(common(env), { +const commonConfig = (webpackEnv) => + merge(common(webpackEnv), { output: { library: "DmnEditor", libraryTarget: "umd", @@ -44,14 +44,14 @@ const commonConfig = (env) => }, }); -module.exports = async (env) => [ - merge(commonConfig(env), { +module.exports = async (webpackEnv) => [ + merge(commonConfig(webpackEnv), { target: "node", entry: { "extension/extension": "./src/extension/extension.ts", }, }), - merge(commonConfig(env), { + merge(commonConfig(webpackEnv), { target: "webworker", entry: { "extension/extensionWeb": "./src/extension/extension.ts", @@ -63,7 +63,7 @@ module.exports = async (env) => [ }), ], }), - merge(commonConfig(env), { + merge(commonConfig(webpackEnv), { target: "web", entry: { "webview/DmnEditorEnvelopeApp": "./src/webview/DmnEditorEnvelopeApp.ts", diff --git a/packages/extended-services-java/install.js b/packages/extended-services-java/install.js deleted file mode 100644 index 35b3e03912e..00000000000 --- a/packages/extended-services-java/install.js +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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 buildEnv = require("./env"); -const { setup } = require("@kie-tools/maven-config-setup-helper"); - -setup(` - -Drevision=${buildEnv.env.extendedServicesJava.version} - -Dquarkus.http.port=${buildEnv.env.extendedServicesJava.port} - -Dquarkus.http.host=${buildEnv.env.extendedServicesJava.host} -`); diff --git a/packages/extended-services-java/mvn.bootstrap.js b/packages/extended-services-java/mvn.bootstrap.js new file mode 100644 index 00000000000..18e441ce239 --- /dev/null +++ b/packages/extended-services-java/mvn.bootstrap.js @@ -0,0 +1,28 @@ +/* + * 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 { env } = require("./env"); +const { setupMavenConfigFile, buildTailFromPackageJsonDependencies } = require("@kie-tools/maven-base"); + +setupMavenConfigFile(` + -Drevision=${env.extendedServicesJava.version} + -Dquarkus.http.port=${env.extendedServicesJava.port} + -Dquarkus.http.host=${env.extendedServicesJava.host} + -Dmaven.repo.local.tail=${buildTailFromPackageJsonDependencies()} +`); diff --git a/packages/extended-services-java/package.json b/packages/extended-services-java/package.json index eb924c5c1b2..957d17acf2d 100644 --- a/packages/extended-services-java/package.json +++ b/packages/extended-services-java/package.json @@ -27,7 +27,7 @@ "copy:app:linux:darwin": "copyfiles -u 1 \"target/quarkus-app/**/*\" dist/", "copy:app:win32": "copyfiles -u 1 \"target/quarkus-app/**\" dist/", "dist": "rimraf dist && mkdir dist && pnpm copy:app && pnpm rename:app", - "install": "node install.js", + "install": "node mvn.bootstrap.js", "powershell": "@powershell -NoProfile -ExecutionPolicy Unrestricted -Command", "rename:app": "run-script-os", "rename:app:linux:darwin": "mv dist/quarkus-app dist/extended-services-java", @@ -38,7 +38,6 @@ "@kie-tools/maven-base": "workspace:*" }, "devDependencies": { - "@kie-tools/maven-config-setup-helper": "workspace:*", "@kie-tools/root-env": "workspace:*", "copyfiles": "^2.4.1", "rimraf": "^3.0.2", diff --git a/packages/extended-services-java/pom.xml b/packages/extended-services-java/pom.xml index 7eb6467d1da..476fed47aff 100644 --- a/packages/extended-services-java/pom.xml +++ b/packages/extended-services-java/pom.xml @@ -100,14 +100,12 @@ maven-compiler-plugin - ${compiler-plugin.version} ${maven.compiler.parameters} maven-surefire-plugin - ${surefire-plugin.version} org.jboss.logmanager.LogManager @@ -116,7 +114,6 @@ maven-failsafe-plugin - ${surefire-plugin.version} diff --git a/packages/extended-services-vscode-extension/webpack.config.js b/packages/extended-services-vscode-extension/webpack.config.js index 3d9f05537b0..d52f1fb6e7c 100644 --- a/packages/extended-services-vscode-extension/webpack.config.js +++ b/packages/extended-services-vscode-extension/webpack.config.js @@ -20,8 +20,8 @@ const { merge } = require("webpack-merge"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); -const commonConfig = (env) => - merge(common(env), { +const commonConfig = (webpackEnv) => + merge(common(webpackEnv), { output: { library: "ExtendedServices", libraryTarget: "umd", @@ -34,14 +34,14 @@ const commonConfig = (env) => plugins: [], }); -module.exports = async (env) => [ - merge(commonConfig(env), { +module.exports = async (webpackEnv) => [ + merge(commonConfig(webpackEnv), { target: "node", entry: { "extension/extension-main": "./src/extension/extension-main.ts", }, }), - merge(commonConfig(env), { + merge(commonConfig(webpackEnv), { target: "web", entry: { "extension/extension-browser": "./src/extension/extension-browser.ts", diff --git a/packages/feel-input-component/showcase/webpack.config.js b/packages/feel-input-component/showcase/webpack.config.js index 9b6c56db64c..89561d4f17a 100644 --- a/packages/feel-input-component/showcase/webpack.config.js +++ b/packages/feel-input-component/showcase/webpack.config.js @@ -24,10 +24,9 @@ const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const patternflyBase = require("@kie-tools-core/patternfly-base"); const { EnvironmentPlugin } = require("webpack"); const { env } = require("../env"); -const buildEnv = env; -module.exports = (env) => - merge(common(env), { +module.exports = (webpackEnv) => + merge(common(webpackEnv), { mode: "development", entry: { index: path.resolve(__dirname, "./index.tsx"), @@ -40,7 +39,7 @@ module.exports = (env) => patterns: [{ from: path.resolve(__dirname, "./static"), to: "./" }], }), new EnvironmentPlugin({ - WEBPACK_REPLACE__FEEL_INPUT_COMPONENT_DEV_WEBAPP__feelServerUrl: buildEnv.feelInputComponent.dev.feelServerUrl, + WEBPACK_REPLACE__FEEL_INPUT_COMPONENT_DEV_WEBAPP__feelServerUrl: env.feelInputComponent.dev.feelServerUrl, }), ], module: { @@ -63,7 +62,7 @@ module.exports = (env) => devServer: { historyApiFallback: true, compress: true, - port: buildEnv.feelInputComponent.dev.port, + port: env.feelInputComponent.dev.port, open: false, hot: true, client: { diff --git a/packages/form-generation-tool/webpack.config.js b/packages/form-generation-tool/webpack.config.js index 6063e28adf9..997c7bac8d9 100644 --- a/packages/form-generation-tool/webpack.config.js +++ b/packages/form-generation-tool/webpack.config.js @@ -21,8 +21,8 @@ const nodeExternals = require("webpack-node-externals"); const { merge } = require("webpack-merge"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); -module.exports = (env, argv) => [ - merge(common(env, argv), { +module.exports = (webpackEnv, webpackArgv) => [ + merge(common(webpackEnv, webpackArgv), { entry: { index: "./src/index.ts", }, diff --git a/packages/image-env-to-json/webpack.config.js b/packages/image-env-to-json/webpack.config.js index 4a6b1b48a69..a8e86a48830 100644 --- a/packages/image-env-to-json/webpack.config.js +++ b/packages/image-env-to-json/webpack.config.js @@ -21,8 +21,8 @@ const nodeExternals = require("webpack-node-externals"); const { merge } = require("webpack-merge"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); -module.exports = (env, argv) => [ - merge(common(env, argv), { +module.exports = (webpackEnv, webpackArgv) => [ + merge(common(webpackEnv, webpackArgv), { entry: { index: "./src/index.ts", }, diff --git a/packages/import-java-classes-component/showcase/webpack.config.js b/packages/import-java-classes-component/showcase/webpack.config.js index c6d339d7ed5..ed4b72ef51d 100644 --- a/packages/import-java-classes-component/showcase/webpack.config.js +++ b/packages/import-java-classes-component/showcase/webpack.config.js @@ -23,10 +23,9 @@ const { merge } = require("webpack-merge"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const patternflyBase = require("@kie-tools-core/patternfly-base"); const { env } = require("../env"); -const buildEnv = env; -module.exports = (env) => - merge(common(env), { +module.exports = (webpackEnv) => + merge(common(webpackEnv), { mode: "development", entry: { index: path.resolve(__dirname, "./index.tsx"), @@ -59,7 +58,7 @@ module.exports = (env) => devServer: { historyApiFallback: true, compress: true, - port: buildEnv.importJavaClassesComponent.dev.port, + port: env.importJavaClassesComponent.dev.port, open: false, hot: true, client: { diff --git a/packages/jbpm-quarkus-devui/dev/pom.xml b/packages/jbpm-quarkus-devui/dev/pom.xml index 66c31c82286..6b714728ca9 100644 --- a/packages/jbpm-quarkus-devui/dev/pom.xml +++ b/packages/jbpm-quarkus-devui/dev/pom.xml @@ -35,16 +35,7 @@ ${revision} - 3.13.0 true - 17 - 17 - UTF-8 - UTF-8 - 3.5.0 - 3.12.1 - 3.2.0 - 3.4.1 4.13.2 true 1.26.1 @@ -214,7 +205,6 @@ org.apache.maven.plugins maven-site-plugin - ${maven.site.plugin.version} org.apache.commons @@ -231,7 +221,6 @@ org.apache.maven.plugins maven-remote-resources-plugin - ${maven.remote.resources.plugin.version} org.apache.commons @@ -248,7 +237,6 @@ org.apache.maven.plugins maven-jar-plugin - ${maven.jar.plugin.version} org.iq80.snappy @@ -260,7 +248,6 @@ org.apache.maven.plugins maven-surefire-plugin - ${surefire-plugin.version} org.iq80.snappy @@ -292,14 +279,12 @@ maven-compiler-plugin - ${compiler-plugin.version} ${maven.compiler.parameters} maven-surefire-plugin - ${surefire-plugin.version} org.jboss.logmanager.LogManager @@ -310,7 +295,6 @@ org.codehaus.mojo flatten-maven-plugin - 1.6.0 true resolveCiFriendliesOnly diff --git a/packages/dashbuilder/install.js b/packages/jbpm-quarkus-devui/mvn.bootstrap.js similarity index 73% rename from packages/dashbuilder/install.js rename to packages/jbpm-quarkus-devui/mvn.bootstrap.js index d21b9e3744c..69cd5a3dcd4 100644 --- a/packages/dashbuilder/install.js +++ b/packages/jbpm-quarkus-devui/mvn.bootstrap.js @@ -17,9 +17,10 @@ * under the License. */ -const buildEnv = require("./env"); -const { setup } = require("@kie-tools/maven-config-setup-helper"); +const { env } = require("./env"); +const { setupMavenConfigFile, buildTailFromPackageJsonDependencies } = require("@kie-tools/maven-base"); -setup(` - -Drevision=${buildEnv.env.dashbuilder.version} +setupMavenConfigFile(` + -Drevision=${env.jbpmQuarkusDevuiExtension.version} + -Dmaven.repo.local.tail=${buildTailFromPackageJsonDependencies()} `); diff --git a/packages/jbpm-quarkus-devui/package.json b/packages/jbpm-quarkus-devui/package.json index d832c918046..295af2b34bf 100644 --- a/packages/jbpm-quarkus-devui/package.json +++ b/packages/jbpm-quarkus-devui/package.json @@ -15,23 +15,22 @@ "scripts": { "build:dev": "run-script-os", "build:dev:darwin:linux": "mvn clean install -DskipTests", - "build:dev:win32": "pnpm powershell \"mvn clean install -DskipTests \"", + "build:dev:win32": "pnpm powershell \"mvn clean install `-DskipTests\"", "build:prod": "pnpm lint && run-script-os", - "build:prod:darwin:linux": "mvn clean deploy -DdeployAtEnd -DskipTests=$(build-env tests.run --not) -Dmaven.test.failure.ignore=$(build-env tests.ignoreFailures) -Dmaven.deploy.skip=$(build-env maven.deploy.skip) -Dreproducible", - "build:prod:win32": "pnpm powershell \"mvn clean deploy `-DdeployAtEnd `-DskipTests `-Dmaven.test.failure.ignore=$(build-env tests.ignoreFailures) `-Dmaven.deploy.skip=$(build-env maven.deploy.skip) `-Dreproducible\"", - "install": "node install.js", + "build:prod:darwin:linux": "mvn clean deploy -DskipTests=$(build-env tests.run --not) -Dmaven.test.failure.ignore=$(build-env tests.ignoreFailures) -Dmaven.deploy.skip=$(build-env maven.deploy.skip) -Dreproducible", + "build:prod:win32": "pnpm powershell \"mvn clean deploy `-DskipTests `-Dmaven.test.failure.ignore=$(build-env tests.ignoreFailures) `-Dmaven.deploy.skip=$(build-env maven.deploy.skip) `-Dreproducible\"", + "install": "node mvn.bootstrap.js", "lint": "echo 'Linting'", "powershell": "@powershell -NoProfile -ExecutionPolicy Unrestricted -Command", "quarkus:dev": "run-script-os", "quarkus:dev:darwin:linux": "mvn clean package quarkus:dev -DskipTests", - "quarkus:dev:win32": "mvn clean package quarkus:dev -DskipTests", + "quarkus:dev:win32": "mvn clean package quarkus:dev `-DskipTests", "start": "pnpm build:dev && mvn -f ./dev/pom.xml quarkus:dev" }, "dependencies": { "@kie-tools/maven-base": "workspace:*" }, "devDependencies": { - "@kie-tools/maven-config-setup-helper": "workspace:*", "@kie-tools/root-env": "workspace:*", "@kie-tools/runtime-tools-process-dev-ui-webapp": "workspace:*", "run-script-os": "^1.1.6" diff --git a/packages/jobs-service-webapp/webpack.config.js b/packages/jobs-service-webapp/webpack.config.js index 8bfef9544ce..86e0614b66a 100644 --- a/packages/jobs-service-webapp/webpack.config.js +++ b/packages/jobs-service-webapp/webpack.config.js @@ -21,10 +21,9 @@ const CopyPlugin = require("copy-webpack-plugin"); const { merge } = require("webpack-merge"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const { env } = require("./env"); -const buildEnv = env; -module.exports = async (env) => - merge(common(env), { +module.exports = async (webpackEnv) => + merge(common(webpackEnv), { entry: {}, plugins: [ new CopyPlugin({ @@ -40,6 +39,6 @@ module.exports = async (env) => static: { directory: "./dist", }, - port: buildEnv.jobsServiceWebapp.dev.port, + port: env.jobsServiceWebapp.dev.port, }, }); diff --git a/packages/kie-editors-dev-vscode-extension/webpack.config.js b/packages/kie-editors-dev-vscode-extension/webpack.config.js index bc410bfe13d..9406ab23019 100644 --- a/packages/kie-editors-dev-vscode-extension/webpack.config.js +++ b/packages/kie-editors-dev-vscode-extension/webpack.config.js @@ -25,8 +25,8 @@ const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const stunnerEditors = require("@kie-tools/stunner-editors"); const vscodeJavaCodeCompletionExtensionPlugin = require("@kie-tools/vscode-java-code-completion-extension-plugin"); -module.exports = async (env) => [ - merge(common(env), { +module.exports = async (webpackEnv) => [ + merge(common(webpackEnv), { output: { library: "AppFormer.VsCodePack", libraryTarget: "umd", @@ -41,7 +41,7 @@ module.exports = async (env) => [ "extension/extension": "./src/extension/extension.ts", }, }), - merge(common(env), { + merge(common(webpackEnv), { output: { library: "AppFormer.VsCodePack", libraryTarget: "umd", @@ -62,7 +62,7 @@ module.exports = async (env) => [ }), ], }), - merge(common(env), { + merge(common(webpackEnv), { output: { library: "AppFormer.VsCodePackWebview", libraryTarget: "umd", @@ -112,7 +112,7 @@ module.exports = async (env) => [ }), ], }), - merge(common(env), { + merge(common(webpackEnv), { output: { library: "AppFormer.VsCodePackWebview", libraryTarget: "umd", diff --git a/packages/kie-editors-standalone/e2e-tests/webpack.config.js b/packages/kie-editors-standalone/e2e-tests/webpack.config.js index 7c9a7967fe5..bee9949535c 100644 --- a/packages/kie-editors-standalone/e2e-tests/webpack.config.js +++ b/packages/kie-editors-standalone/e2e-tests/webpack.config.js @@ -22,10 +22,9 @@ const HtmlWebPackPlugin = require("html-webpack-plugin"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const { merge } = require("webpack-merge"); const { env } = require("../env"); -const buildEnv = env; -module.exports = (env) => - merge(common(env), { +module.exports = (webpackEnv) => + merge(common(webpackEnv), { mode: "development", entry: { app: path.resolve(__dirname, "src", "index.tsx"), @@ -48,6 +47,6 @@ module.exports = (env) => overlay: true, }, open: false, - port: buildEnv.standaloneEditors.dev.port, + port: env.standaloneEditors.dev.port, }, }); diff --git a/packages/kie-editors-standalone/webpack.build-resources.config.js b/packages/kie-editors-standalone/webpack.build-resources.config.js index aa885e4ddd4..355624ae595 100644 --- a/packages/kie-editors-standalone/webpack.build-resources.config.js +++ b/packages/kie-editors-standalone/webpack.build-resources.config.js @@ -23,8 +23,8 @@ const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const CopyPlugin = require("copy-webpack-plugin"); const patternflyBase = require("@kie-tools-core/patternfly-base"); -module.exports = (env) => [ - merge(common(env), { +module.exports = (webpackEnv) => [ + merge(common(webpackEnv), { entry: { "preprocessor/preprocessor": "./src/preprocessor/preprocessor.ts", }, @@ -35,7 +35,7 @@ module.exports = (env) => [ __filename: true, //Uses current working dir }, }), - merge(common(env), { + merge(common(webpackEnv), { output: { publicPath: "", }, diff --git a/packages/kie-editors-standalone/webpack.package-resources.config.js b/packages/kie-editors-standalone/webpack.package-resources.config.js index 550deafb3b9..ec50e6a77ec 100644 --- a/packages/kie-editors-standalone/webpack.package-resources.config.js +++ b/packages/kie-editors-standalone/webpack.package-resources.config.js @@ -21,10 +21,9 @@ const { merge } = require("webpack-merge"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const path = require("path"); const { env } = require("./env"); -const buildEnv = env; -module.exports = (env) => - merge(common(env), { +module.exports = (webpackEnv) => + merge(common(webpackEnv), { output: { path: path.join(__dirname, "dist"), filename: "[name]/index.js", @@ -51,6 +50,6 @@ module.exports = (env) => historyApiFallback: false, static: [{ directory: path.join(__dirname, "./dist") }], compress: true, - port: buildEnv.standaloneEditors.dev.port, + port: env.standaloneEditors.dev.port, }, }); diff --git a/packages/kn-plugin-workflow/e2e-tests/gen_manifest_test.go b/packages/kn-plugin-workflow/e2e-tests/gen_manifest_test.go index 448d2be0730..8460519d5ac 100644 --- a/packages/kn-plugin-workflow/e2e-tests/gen_manifest_test.go +++ b/packages/kn-plugin-workflow/e2e-tests/gen_manifest_test.go @@ -94,6 +94,7 @@ func TestGenManifestProjectSuccess(t *testing.T) { projectDir := filepath.Join(TempTestsPath, projectName) err := os.Chdir(projectDir) require.NoErrorf(t, err, "Expected nil error, got %v", err) + WriteMavenConfigFileWithTailDirs(projectDir) for _, run := range tests { _, err = ExecuteKnWorkflow(run.args...) diff --git a/packages/kn-plugin-workflow/e2e-tests/helper_test.go b/packages/kn-plugin-workflow/e2e-tests/helper_test.go index 8d45777b8c6..d258fe143fa 100644 --- a/packages/kn-plugin-workflow/e2e-tests/helper_test.go +++ b/packages/kn-plugin-workflow/e2e-tests/helper_test.go @@ -25,6 +25,8 @@ import ( "bytes" "fmt" "io" + "io/fs" + "log" "os" "os/exec" "path/filepath" @@ -173,6 +175,60 @@ func CleanUpAndChdirTemp(t *testing.T) { } } +func WriteMavenConfigFileWithTailDirs(projectDir string) { + dirPath := filepath.Join(projectDir, ".mvn") + if _, err := os.Stat(dirPath); os.IsNotExist(err) { + err := os.Mkdir(dirPath, 0755) // Permissions: owner=rwx, group=rx, others=rx + if err != nil { + fmt.Printf("Error creating .mvn directory. %v", err) + os.Exit(1) + } + } + + sonataflowQuarkusDevUiM2, err := filepath.Abs("../../../node_modules/@kie-tools/sonataflow-quarkus-devui/dist/1st-party-m2/repository") + if err != nil { + fmt.Printf("Failed to resolve absolute path for `@kie-tools/sonataflow-quarkus-devui` package. %v", err) + os.Exit(1) + } + mavenBaseM2, err := filepath.Abs("../../../node_modules/@kie-tools/maven-base/dist/1st-party-m2/repository") + if err != nil { + fmt.Printf("Failed to resolve absolute path for `@kie-tools/maven-base` package. %v", err) + os.Exit(1) + } + + tail := mavenBaseM2 + "," + sonataflowQuarkusDevUiM2 + "\n" + fmt.Printf("Tail:" + tail) + + ListDirRecursively(mavenBaseM2) + ListDirRecursively(sonataflowQuarkusDevUiM2) + + err = os.WriteFile(filepath.Join(projectDir, ".mvn", "maven.config"), []byte("-Dmaven.repo.local.tail="+tail), 0644) + if err != nil { + fmt.Printf("Failed to create .mvn/maven.config file: %v", err) + os.Exit(1) + } +} + +func ListDirRecursively(absolutePath string) { + if _, err := os.Stat(absolutePath); os.IsNotExist(err) { + fmt.Println("Dir doesn't exist. " + absolutePath) + return + } + + // Walk through the directory and list files and directories + err := filepath.WalkDir(absolutePath, func(path string, d fs.DirEntry, err error) error { + if err != nil { + return err + } + fmt.Println(path) + return nil + }) + + if err != nil { + log.Fatal(err) + } +} + func AddSnapshotRepositoryDeclarationToPom(t *testing.T, projectDir string) { VerifyFilesExist(t, projectDir, []string{"pom.xml"}) pomFilePath := filepath.Join(projectDir, "pom.xml") diff --git a/packages/kn-plugin-workflow/e2e-tests/quarkus_build_test.go b/packages/kn-plugin-workflow/e2e-tests/quarkus_build_test.go index 753677c86e3..2b8e9af4122 100644 --- a/packages/kn-plugin-workflow/e2e-tests/quarkus_build_test.go +++ b/packages/kn-plugin-workflow/e2e-tests/quarkus_build_test.go @@ -121,6 +121,7 @@ func RunQuarkusBuildTest(t *testing.T, cfgTestInputQuarkusCreate CfgTestInputQua err = os.Chdir(projectDir) require.NoErrorf(t, err, "Expected nil error, got %v", err) + WriteMavenConfigFileWithTailDirs(projectDir) // Run `quarkus build` command args := transformQuarkusBuildCmdCfgToArgs(test.input) diff --git a/packages/kn-plugin-workflow/e2e-tests/quarkus_convert_test.go b/packages/kn-plugin-workflow/e2e-tests/quarkus_convert_test.go index d2b79047757..a6a94174f2d 100644 --- a/packages/kn-plugin-workflow/e2e-tests/quarkus_convert_test.go +++ b/packages/kn-plugin-workflow/e2e-tests/quarkus_convert_test.go @@ -106,6 +106,7 @@ func RunQuarkusConvertTest(t *testing.T, cfgTestInputCreateConvert CfgTestInputC err = os.Chdir(projectDir) require.NoErrorf(t, err, "Expected nil error, got %v", err) + WriteMavenConfigFileWithTailDirs(projectDir) // Run `quarkus convert` command _, err = ExecuteKnWorkflowQuarkus(transformQuarkusConvertCmdCfgToArgs(t, test.input)...) @@ -158,6 +159,7 @@ func TestQuarkusConvertProjectFailed(t *testing.T) { err = os.Chdir(projectDir) require.NoErrorf(t, err, "Expected nil error, got %v", err) + WriteMavenConfigFileWithTailDirs(projectDir) // Run `quarkus convert` command _, err = ExecuteKnWorkflowQuarkus(transformQuarkusConvertCmdCfgToArgs(t, test.input)...) @@ -182,6 +184,7 @@ func TestQuarkusConvertProjectFailedAlreadyQuarkus(t *testing.T) { err = os.Chdir(projectDir) require.NoErrorf(t, err, "Expected nil error, got %v", err) + WriteMavenConfigFileWithTailDirs(projectDir) // Run `quarkus convert` command _, err = ExecuteKnWorkflowQuarkus(transformQuarkusConvertCmdCfgToArgs(t, test.input)...) diff --git a/packages/kn-plugin-workflow/e2e-tests/quarkus_create_test.go b/packages/kn-plugin-workflow/e2e-tests/quarkus_create_test.go index b0b809a0e6b..23aabd99c8f 100644 --- a/packages/kn-plugin-workflow/e2e-tests/quarkus_create_test.go +++ b/packages/kn-plugin-workflow/e2e-tests/quarkus_create_test.go @@ -23,6 +23,7 @@ package e2e_tests import ( "fmt" + "os" "path/filepath" "testing" @@ -108,7 +109,10 @@ func RunQuarkusCreateTest(t *testing.T, test CfgTestInputQuarkusCreate) string { // Run `quarkus create` command _, err = ExecuteKnWorkflowQuarkus(transformQuarkusCreateCmdCfgToArgs(test.input)...) + + err = os.Chdir(projectDir) require.NoErrorf(t, err, "Expected nil error, got: %v", err) + WriteMavenConfigFileWithTailDirs(projectDir) // Check if the project directory was created require.DirExistsf(t, projectDir, "Expected project directory '%s' to be created", projectDir) diff --git a/packages/kn-plugin-workflow/e2e-tests/quarkus_run_test.go b/packages/kn-plugin-workflow/e2e-tests/quarkus_run_test.go index 8645ec844a6..f127d98575e 100644 --- a/packages/kn-plugin-workflow/e2e-tests/quarkus_run_test.go +++ b/packages/kn-plugin-workflow/e2e-tests/quarkus_run_test.go @@ -91,8 +91,10 @@ func RunQuarkusRunTest(t *testing.T, cfgTestInputPrepareQuarkusCreateRun CfgTest // Create and build the quarkus project projectName := RunQuarkusCreateTest(t, cfgTestInputPrepareQuarkusCreateRun) projectDir := filepath.Join(TempTestsPath, projectName) + err = os.Chdir(projectDir) require.NoErrorf(t, err, "Expected nil error, got %v", err) + WriteMavenConfigFileWithTailDirs(projectDir) cmd := exec.Command(KnExecutable) diff --git a/packages/kn-plugin-workflow/e2e-tests/run_test.go b/packages/kn-plugin-workflow/e2e-tests/run_test.go index 13a542b1e53..f3f371b4b21 100644 --- a/packages/kn-plugin-workflow/e2e-tests/run_test.go +++ b/packages/kn-plugin-workflow/e2e-tests/run_test.go @@ -86,8 +86,10 @@ func RunRunTest(t *testing.T, cfgTestInputPrepareCreate CfgTestInputCreate, test projectName := GetCreateProjectName(t, cfgTestInputPrepareCreateRun) projectDir := filepath.Join(TempTestsPath, projectName) + err = os.Chdir(projectDir) require.NoErrorf(t, err, "Expected nil error, got %v", err) + WriteMavenConfigFileWithTailDirs(projectDir) cmd := exec.Command(KnExecutable) diff --git a/packages/kn-plugin-workflow/env/index.js b/packages/kn-plugin-workflow/env/index.js index 81fdf4f1f29..a6ec7558357 100644 --- a/packages/kn-plugin-workflow/env/index.js +++ b/packages/kn-plugin-workflow/env/index.js @@ -35,7 +35,7 @@ module.exports = composeEnv([rootEnv, sonataflowDevModeImageEnv], { description: "Quarkus group to be used when creating the SonataFlow project", }, KN_PLUGIN_WORKFLOW__devModeImageUrl: { - default: `${sonataflowDevModeImageEnv.env.sonataflowDevModeImage.registry}/${sonataflowDevModeImageEnv.env.sonataflowDevModeImage.account}/${sonataflowDevModeImageEnv.env.sonataflowDevModeImage.name}:${sonataflowDevModeImageEnv.env.sonataflowDevModeImage.tag}`, + default: `${sonataflowDevModeImageEnv.env.sonataflowDevModeImage.registry}/${sonataflowDevModeImageEnv.env.sonataflowDevModeImage.account}/${sonataflowDevModeImageEnv.env.sonataflowDevModeImage.name}:${sonataflowDevModeImageEnv.env.sonataflowDevModeImage.buildTag}`, description: "Kogito SWF DevMode image URL.", }, }), diff --git a/packages/kn-plugin-workflow/package.json b/packages/kn-plugin-workflow/package.json index 34155f71362..b13f3cd5804 100644 --- a/packages/kn-plugin-workflow/package.json +++ b/packages/kn-plugin-workflow/package.json @@ -49,6 +49,10 @@ "test-e2e:quarkus": "run-script-if --ignore-errors \"$(build-env endToEndTests.ignoreFailures)\" --bool \"$(build-env endToEndTests.run)\" --then \"pnpm go:test-e2e:quarkus\" \"pnpm go:test-e2e:report\"", "test-e2e:quarkus:logs": "run-script-if --ignore-errors \"$(build-env endToEndTests.ignoreFailures)\" --bool \"$(build-env endToEndTests.run)\" --then \"pnpm go:test-e2e:quarkus:logs\" \"pnpm go:test-e2e:report\"" }, + "dependencies": { + "@kie-tools/maven-base": "workspace:*", + "@kie-tools/sonataflow-quarkus-devui": "workspace:*" + }, "devDependencies": { "@kie-tools/root-env": "workspace:*", "@kie-tools/sonataflow-devmode-image": "workspace:*", diff --git a/packages/kogito-base-builder-image/env/index.js b/packages/kogito-base-builder-image/env/index.js new file mode 100644 index 00000000000..c9e804e2c1a --- /dev/null +++ b/packages/kogito-base-builder-image/env/index.js @@ -0,0 +1,53 @@ +/* + * 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 { varsWithName, composeEnv, getOrDefault } = require("@kie-tools-scripts/build-env"); + +const rootEnv = require("@kie-tools/root-env/env"); + +module.exports = composeEnv([rootEnv], { + vars: varsWithName({ + KOGITO_BASE_BUILDER_IMAGE__registry: { + default: "docker.io", + description: "The image registry.", + }, + KOGITO_BASE_BUILDER_IMAGE__account: { + default: "apache", + description: "The image registry account.", + }, + KOGITO_BASE_BUILDER_IMAGE__name: { + default: "incubator-kie-kogito-base-builder", + description: "The image name.", + }, + KOGITO_BASE_BUILDER_IMAGE__buildTag: { + default: rootEnv.env.root.streamName, + description: "The image tag.", + }, + }), + get env() { + return { + kogitoBaseBuilderImage: { + registry: getOrDefault(this.vars.KOGITO_BASE_BUILDER_IMAGE__registry), + account: getOrDefault(this.vars.KOGITO_BASE_BUILDER_IMAGE__account), + name: getOrDefault(this.vars.KOGITO_BASE_BUILDER_IMAGE__name), + buildTag: getOrDefault(this.vars.KOGITO_BASE_BUILDER_IMAGE__buildTag), + }, + }; + }, +}); diff --git a/packages/kogito-base-builder-image/install.js b/packages/kogito-base-builder-image/install.js new file mode 100644 index 00000000000..0e3b3188d06 --- /dev/null +++ b/packages/kogito-base-builder-image/install.js @@ -0,0 +1,64 @@ +/* + * 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"); +const fs = require("fs"); + +const { env } = require("./env"); +const path = require("path"); +const pythonVenvDir = path.dirname(require.resolve("@kie-tools/python-venv/package.json")); +const sonataflowImageCommonDir = path.dirname(require.resolve("@kie-tools/sonataflow-image-common/package.json")); +const replaceInFile = require("replace-in-file"); + +const activateCmd = + process.platform === "win32" + ? `${pythonVenvDir}\\venv\\Scripts\\Activate.bat` + : `. ${pythonVenvDir}/venv/bin/activate`; + +execSync( + `${activateCmd} && \ + python3 ${sonataflowImageCommonDir}/resources/scripts/versions_manager.py --bump-to ${env.kogitoBaseBuilderImage.buildTag} --source-folder ./resources`, + { stdio: "inherit" } +); + +// Find and read the -image.yaml file +const resourcesPath = path.resolve(__dirname, "./resources"); +const files = fs.readdirSync(resourcesPath); +const imageYamlFiles = files.filter((fileName) => fileName.endsWith("-image.yaml")); +if (imageYamlFiles.length !== 1) { + throw new Error("There should only be one -image.yaml file on ./resources!"); +} +const originalYamlPath = path.join(resourcesPath, imageYamlFiles[0]); +let imageYaml = fs.readFileSync(originalYamlPath, "utf8"); + +const imageUrl = `${env.kogitoBaseBuilderImage.registry}/${env.kogitoBaseBuilderImage.account}/${env.kogitoBaseBuilderImage.name}`; + +// Replace the whole string between quotes ("") with the image name +imageYaml = imageYaml.replace(/(?<=")(.*kogito-base-builder.*)(?=")/gm, imageUrl); + +// Write file and then rename it to match the image name +fs.writeFileSync(originalYamlPath, imageYaml); +fs.renameSync(originalYamlPath, path.join(resourcesPath, `${env.kogitoBaseBuilderImage.name}-image.yaml`)); + +// Replace image URL in .feature files +replaceInFile.sync({ + files: ["**/*.feature"], + from: /@docker.io\/apache\/.*/g, + to: `@${imageUrl}`, +}); diff --git a/packages/kogito-base-builder-image/package.json b/packages/kogito-base-builder-image/package.json new file mode 100644 index 00000000000..a6542722da4 --- /dev/null +++ b/packages/kogito-base-builder-image/package.json @@ -0,0 +1,46 @@ +{ + "private": true, + "name": "@kie/kogito-base-builder-image", + "version": "0.0.0", + "description": "", + "license": "Apache-2.0", + "homepage": "https://github.com/apache/incubator-kie-tools", + "repository": { + "type": "git", + "url": "https://github.com/apache/incubator-kie-tools.git" + }, + "bugs": { + "url": "https://github.com/apache/incubator-kie-tools/issues" + }, + "scripts": { + "build:dev": "run-script-if --bool \"$(build-env containerImages.build)\" --then \"pnpm copy-assets\" \"pnpm image:build\"", + "build:prod": "pnpm build:dev && pnpm image:test", + "copy-assets": "run-script-os", + "copy-assets:linux:darwin": "rimraf build && cp -R ./node_modules/@kie-tools/sonataflow-image-common/resources build && cp -R resources/* build", + "format": "prettier --write . --ignore-path=../../.prettierignore --ignore-path=../../.gitignore", + "image:build": "run-script-os", + "image:build:darwin:linux": "pnpm setup:env make -C ./build build", + "image:build:win32": "echo \"Build skipped on Windows\"", + "image:test": "run-script-if --ignore-errors \"$(build-env tests.ignoreFailures)\" --bool \"$(build-env endToEndTests.run)\" --then \"mkdir -p build/target/test/results\" \"run-script-os\" --finally \"mkdir -p build/target/test/results && cp -R build/target/test/results dist-tests-e2e/\"", + "image:test:darwin:linux": "pnpm setup:env make -C ./build test-image", + "image:test:win32": "echo \"Tests skipped on Windows\"", + "install": "node install.js && pnpm format", + "setup:env": ". ./node_modules/@kie-tools/python-venv/venv/bin/activate && cross-env KOGITO_IMAGE_REGISTRY=$(build-env kogitoBaseBuilderImage.registry) KOGITO_IMAGE_REGISTRY_ACCOUNT=$(build-env kogitoBaseBuilderImage.account) KOGITO_IMAGE_NAME=$(build-env kogitoBaseBuilderImage.name) KOGITO_IMAGE_TAG=$(build-env kogitoBaseBuilderImage.buildTag) QUARKUS_PLATFORM_VERSION=$(build-env quarkusPlatform.version) KOGITO_VERSION=$(build-env kogitoRuntime.version)" + }, + "devDependencies": { + "@kie-tools/python-venv": "workspace:*", + "@kie-tools/root-env": "workspace:*", + "@kie-tools/sonataflow-image-common": "workspace:*", + "cross-env": "^7.0.3", + "replace-in-file": "^7.1.0", + "rimraf": "^3.0.2", + "run-script-os": "^1.1.6" + }, + "kieTools": { + "requiredPreinstalledCliCommands": [ + "python3", + "make", + "s2i" + ] + } +} diff --git a/packages/kogito-base-builder-image/resources/incubator-kie-kogito-base-builder-image.yaml b/packages/kogito-base-builder-image/resources/incubator-kie-kogito-base-builder-image.yaml new file mode 100644 index 00000000000..627f891be91 --- /dev/null +++ b/packages/kogito-base-builder-image/resources/incubator-kie-kogito-base-builder-image.yaml @@ -0,0 +1,63 @@ +# +# 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. +# +schema_version: 1 + +name: "docker.io/apache/incubator-kie-kogito-base-builder" +version: "main" +from: "registry.access.redhat.com/ubi8/openjdk-17:1.19" +description: "Image with JDK and Maven, used as a base image. It is used by Web Tools !" + +labels: + - name: "io.openshift.s2i.scripts-url" + value: "image:///usr/local/s2i" + - name: "io.openshift.s2i.destination" + value: "/tmp" + - name: "io.openshift.expose-services" + value: "8080:http" + - name: "io.quarkus.platform.version" + value: "### SET ME DURING BUILD PROCESS ###" + - name: "org.kie.kogito.version" + value: "### SET ME DURING BUILD PROCESS ###" + - name: "maintainer" + value: "Apache KIE " + - name: "io.k8s.description" + value: "Platform for building Kogito based on JDK and Maven" + - name: "io.k8s.display-name" + value: "Kogito based on JDK and Maven" + - name: "io.openshift.tags" + value: "base-builder,kogito" + +packages: + manager: microdnf + +modules: + repositories: + - path: modules + install: + - name: org.kie.kogito.system.user + - name: org.kie.kogito.logging + - name: org.kie.kogito.launch.scripts + - name: org.kie.kogito.dynamic.resources + - name: org.kie.kogito.maven.common + - name: org.kie.kogito.project.versions + - name: org.kie.kogito.security.custom.truststores + +run: + workdir: "/home/kogito" + user: 1001 diff --git a/packages/kogito-data-index-ephemeral-image/env/index.js b/packages/kogito-data-index-ephemeral-image/env/index.js new file mode 100644 index 00000000000..ea84bbde4e6 --- /dev/null +++ b/packages/kogito-data-index-ephemeral-image/env/index.js @@ -0,0 +1,53 @@ +/* + * 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 { varsWithName, composeEnv, getOrDefault } = require("@kie-tools-scripts/build-env"); + +const rootEnv = require("@kie-tools/root-env/env"); + +module.exports = composeEnv([rootEnv], { + vars: varsWithName({ + KOGITO_DATA_INDEX_EPHEMERAL_IMAGE__registry: { + default: "docker.io", + description: "The image registry.", + }, + KOGITO_DATA_INDEX_EPHEMERAL_IMAGE__account: { + default: "apache", + description: "The image registry account.", + }, + KOGITO_DATA_INDEX_EPHEMERAL_IMAGE__name: { + default: "incubator-kie-kogito-data-index-ephemeral", + description: "The image name.", + }, + KOGITO_DATA_INDEX_EPHEMERAL_IMAGE__buildTag: { + default: rootEnv.env.root.streamName, + description: "The image tag.", + }, + }), + get env() { + return { + kogitoDataIndexEphemeralImage: { + registry: getOrDefault(this.vars.KOGITO_DATA_INDEX_EPHEMERAL_IMAGE__registry), + account: getOrDefault(this.vars.KOGITO_DATA_INDEX_EPHEMERAL_IMAGE__account), + name: getOrDefault(this.vars.KOGITO_DATA_INDEX_EPHEMERAL_IMAGE__name), + buildTag: getOrDefault(this.vars.KOGITO_DATA_INDEX_EPHEMERAL_IMAGE__buildTag), + }, + }; + }, +}); diff --git a/packages/kogito-data-index-ephemeral-image/install.js b/packages/kogito-data-index-ephemeral-image/install.js new file mode 100644 index 00000000000..5e3e2c01d85 --- /dev/null +++ b/packages/kogito-data-index-ephemeral-image/install.js @@ -0,0 +1,64 @@ +/* + * 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"); +const fs = require("fs"); + +const { env } = require("./env"); +const path = require("path"); +const pythonVenvDir = path.dirname(require.resolve("@kie-tools/python-venv/package.json")); +const sonataflowImageCommonDir = path.dirname(require.resolve("@kie-tools/sonataflow-image-common/package.json")); +const replaceInFile = require("replace-in-file"); + +const activateCmd = + process.platform === "win32" + ? `${pythonVenvDir}\\venv\\Scripts\\Activate.bat` + : `. ${pythonVenvDir}/venv/bin/activate`; + +execSync( + `${activateCmd} && \ + python3 ${sonataflowImageCommonDir}/resources/scripts/versions_manager.py --bump-to ${env.kogitoDataIndexEphemeralImage.buildTag} --source-folder ./resources`, + { stdio: "inherit" } +); + +// Find and read the -image.yaml file +const resourcesPath = path.resolve(__dirname, "./resources"); +const files = fs.readdirSync(resourcesPath); +const imageYamlFiles = files.filter((fileName) => fileName.endsWith("-image.yaml")); +if (imageYamlFiles.length !== 1) { + throw new Error("There should only be one -image.yaml file on ./resources!"); +} +const originalYamlPath = path.join(resourcesPath, imageYamlFiles[0]); +let imageYaml = fs.readFileSync(originalYamlPath, "utf8"); + +const imageUrl = `${env.kogitoDataIndexEphemeralImage.registry}/${env.kogitoDataIndexEphemeralImage.account}/${env.kogitoDataIndexEphemeralImage.name}`; + +// Replace the whole string between quotes ("") with the image name +imageYaml = imageYaml.replace(/(?<=")(.*kogito-data-index-ephemeral.*)(?=")/gm, imageUrl); + +// Write file and then rename it to match the image name +fs.writeFileSync(originalYamlPath, imageYaml); +fs.renameSync(originalYamlPath, path.join(resourcesPath, `${env.kogitoDataIndexEphemeralImage.name}-image.yaml`)); + +// Replace image URL in .feature files +replaceInFile.sync({ + files: ["**/*.feature"], + from: /@docker.io\/apache\/.*/g, + to: `@${imageUrl}`, +}); diff --git a/packages/kogito-data-index-ephemeral-image/package.json b/packages/kogito-data-index-ephemeral-image/package.json new file mode 100644 index 00000000000..7905134b22f --- /dev/null +++ b/packages/kogito-data-index-ephemeral-image/package.json @@ -0,0 +1,48 @@ +{ + "private": true, + "name": "@kie/kogito-data-index-ephemeral-image", + "version": "0.0.0", + "description": "", + "license": "Apache-2.0", + "homepage": "https://github.com/apache/incubator-kie-tools", + "repository": { + "type": "git", + "url": "https://github.com/apache/incubator-kie-tools.git" + }, + "bugs": { + "url": "https://github.com/apache/incubator-kie-tools/issues" + }, + "scripts": { + "build:dev": "run-script-if --bool \"$(build-env containerImages.build)\" --then \"pnpm copy-assets\" \"pnpm image:build\"", + "build:prod": "pnpm build:dev && pnpm image:test", + "copy-assets": "run-script-os", + "copy-assets:linux:darwin": "rimraf build && cp -R ./node_modules/@kie-tools/sonataflow-image-common/resources build && cp -R resources/* build", + "copy-test-assets": "run-script-os", + "copy-test-assets:linux:darwin": "cp -R test-resources/. build", + "format": "prettier --write . --ignore-path=../../.prettierignore --ignore-path=../../.gitignore", + "image:build": "run-script-os", + "image:build:darwin:linux": "pnpm setup:env make -C ./build build-kogito-app build", + "image:build:win32": "echo \"Build skipped on Windows\"", + "image:test": "run-script-if --ignore-errors \"$(build-env tests.ignoreFailures)\" --bool \"$(build-env endToEndTests.run)\" --then \"mkdir -p build/target/test/results\" \"run-script-os\" --finally \"mkdir -p build/target/test/results && cp -R build/target/test/results dist-tests-e2e/\"", + "image:test:darwin:linux": "pnpm copy-test-assets && pnpm setup:env make -C ./build test-image", + "image:test:win32": "echo \"Tests skipped on Windows\"", + "install": "node install.js && pnpm format", + "setup:env": ". ./node_modules/@kie-tools/python-venv/venv/bin/activate && cross-env KOGITO_IMAGE_REGISTRY=$(build-env kogitoDataIndexEphemeralImage.registry) KOGITO_IMAGE_REGISTRY_ACCOUNT=$(build-env kogitoDataIndexEphemeralImage.account) KOGITO_IMAGE_NAME=$(build-env kogitoDataIndexEphemeralImage.name) KOGITO_IMAGE_TAG=$(build-env kogitoDataIndexEphemeralImage.buildTag) QUARKUS_PLATFORM_VERSION=$(build-env quarkusPlatform.version) KOGITO_VERSION=$(build-env kogitoRuntime.version)" + }, + "devDependencies": { + "@kie-tools/python-venv": "workspace:*", + "@kie-tools/root-env": "workspace:*", + "@kie-tools/sonataflow-image-common": "workspace:*", + "cross-env": "^7.0.3", + "replace-in-file": "^7.1.0", + "rimraf": "^3.0.2", + "run-script-os": "^1.1.6" + }, + "kieTools": { + "requiredPreinstalledCliCommands": [ + "python3", + "make", + "s2i" + ] + } +} diff --git a/packages/kogito-data-index-ephemeral-image/resources/incubator-kie-kogito-data-index-ephemeral-image.yaml b/packages/kogito-data-index-ephemeral-image/resources/incubator-kie-kogito-data-index-ephemeral-image.yaml new file mode 100644 index 00000000000..5c414019813 --- /dev/null +++ b/packages/kogito-data-index-ephemeral-image/resources/incubator-kie-kogito-data-index-ephemeral-image.yaml @@ -0,0 +1,67 @@ +# +# 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. +# +schema_version: 1 + +name: "docker.io/apache/incubator-kie-kogito-data-index-ephemeral" +version: "main" +from: "registry.access.redhat.com/ubi8/openjdk-17-runtime:1.19" +description: "Runtime image for Kogito Data Index Service for ephemeral PostgreSQL persistence provider" + +labels: + - name: "org.kie.kogito.version" + value: "### SET ME DURING BUILD PROCESS ###" + - name: "maintainer" + value: "Apache KIE " + - name: "io.k8s.description" + value: "Runtime image for Kogito Data Index Service for ephemeral PostgreSQL persistence provider" + - name: "io.k8s.display-name" + value: "Kogito Data Index Service - ephemeral PostgreSQL" + - name: "io.openshift.tags" + value: "kogito,data-index,data-index-ephemeral" + - name: "io.openshift.expose-services" + value: "8080:http" + +envs: + - name: "SCRIPT_DEBUG" + example: "true" + description: "If set to true, ensures that the bash scripts are executed with the -x option, printing the commands and their arguments as they are executed. Also debug JVM initialization." + - name: "KOGITO_DATA_INDEX_QUARKUS_PROFILE" + value: "http-events-support" + description: "Allows to change the event connection type. The possible values are :`kafka-events-support` or `http-events-support`(default)" + +modules: + repositories: + - path: modules + install: + - name: org.kie.kogito.system.user + - name: org.kie.kogito.logging + - name: org.kie.kogito.dynamic.resources + - name: org.kie.kogito.launch.scripts + - name: org.kie.kogito.dataindex.ephemeral + - name: org.kie.kogito.dataindex.common + - name: org.kie.kogito.security.custom.truststores + +ports: + - value: 8080 + +run: + workdir: "/home/kogito" + user: 1001 + cmd: + - "/home/kogito/kogito-app-launch.sh" diff --git a/packages/kogito-data-index-ephemeral-image/resources/modules/kogito-data-index-ephemeral/added/kogito-app-launch.sh b/packages/kogito-data-index-ephemeral-image/resources/modules/kogito-data-index-ephemeral/added/kogito-app-launch.sh new file mode 100644 index 00000000000..aa15cda2106 --- /dev/null +++ b/packages/kogito-data-index-ephemeral-image/resources/modules/kogito-data-index-ephemeral/added/kogito-app-launch.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash +# +# 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. +# + + +#import +source "${KOGITO_HOME}"/launch/logging.sh + +if [ "${SCRIPT_DEBUG}" = "true" ] ; then + set -x + SHOW_JVM_SETTINGS="-XshowSettings:properties" + log_info "Script debugging is enabled, allowing bash commands and their arguments to be printed as they are executed" + log_info "JVM settings debug is enabled." + printenv +fi + +# Configuration scripts +# Any configuration script that needs to run on image startup must be added here. +CONFIGURE_SCRIPTS=( + "${KOGITO_HOME}"/launch/kogito-data-index-common.sh + "${KOGITO_HOME}"/launch/configure-custom-truststore.sh +) +source "${KOGITO_HOME}"/launch/configure.sh +############################################# + +DYNAMIC_RESOURCES_OPTS="$(${JBOSS_CONTAINER_JAVA_JVM_MODULE}/java-default-options) $(${JBOSS_CONTAINER_JAVA_JVM_MODULE}/debug-options)" + +# shellcheck disable=SC2086 +exec java ${SHOW_JVM_SETTINGS} ${DYNAMIC_RESOURCES_OPTS} ${JAVA_OPTIONS} ${KOGITO_DATA_INDEX_PROPS} ${CUSTOM_TRUSTSTORE_ARGS} \ + -Djava.library.path="${KOGITO_HOME}"/lib \ + -Dquarkus.http.host=0.0.0.0 \ + -Dquarkus.http.port=8080 \ + -jar "${KOGITO_HOME}"/bin/quarkus-app/quarkus-run.jar + diff --git a/packages/kogito-data-index-ephemeral-image/resources/modules/kogito-data-index-ephemeral/configure b/packages/kogito-data-index-ephemeral-image/resources/modules/kogito-data-index-ephemeral/configure new file mode 100644 index 00000000000..ae5360b775e --- /dev/null +++ b/packages/kogito-data-index-ephemeral-image/resources/modules/kogito-data-index-ephemeral/configure @@ -0,0 +1,26 @@ +#!/bin/sh +# +# 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. +# +set -e + +SCRIPT_DIR=$(dirname "${0}") +ADDED_DIR="${SCRIPT_DIR}"/added + +cp -v "${ADDED_DIR}"/kogito-app-launch.sh "${KOGITO_HOME}" +chmod +x-w "${KOGITO_HOME}"/kogito-app-launch.sh diff --git a/packages/kogito-data-index-ephemeral-image/resources/modules/kogito-data-index-ephemeral/module.yaml b/packages/kogito-data-index-ephemeral-image/resources/modules/kogito-data-index-ephemeral/module.yaml new file mode 100644 index 00000000000..94e22660e5b --- /dev/null +++ b/packages/kogito-data-index-ephemeral-image/resources/modules/kogito-data-index-ephemeral/module.yaml @@ -0,0 +1,31 @@ +# +# 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. +# +schema_version: 1 +name: org.kie.kogito.dataindex.ephemeral +version: "main" + +# see build-kogito-apps-components.sh script, responsible for build it. +# called by the Makefile before builds +artifacts: + - path: /tmp/build/data-index-service-inmemory + dest: /home/kogito/bin + name: quarkus-app + +execute: + - script: configure diff --git a/packages/kogito-data-index-ephemeral-image/test-resources/tests/features/kogito-data-index-common.feature b/packages/kogito-data-index-ephemeral-image/test-resources/tests/features/kogito-data-index-common.feature new file mode 100644 index 00000000000..d5a359d17dd --- /dev/null +++ b/packages/kogito-data-index-ephemeral-image/test-resources/tests/features/kogito-data-index-common.feature @@ -0,0 +1,34 @@ +# +# 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. +# + +@docker.io/apache/incubator-kie-kogito-data-index-ephemeral +Feature: Kogito-data-index common feature. + + Scenario: Verify if the debug is correctly enabled and test default http port + When container is started with env + | variable | value | + | SCRIPT_DEBUG | true | + Then container log should contain -Djava.library.path=/home/kogito/lib -Dquarkus.http.host=0.0.0.0 -Dquarkus.http.port=8080 + + Scenario: check if a provided data index quarkus profile is correctly set on data index + When container is started with env + | variable | value | + | SCRIPT_DEBUG | true | + | KOGITO_DATA_INDEX_QUARKUS_PROFILE | http-events-support | + Then container log should contain -Dquarkus.profile=http-events-support \ No newline at end of file diff --git a/packages/kogito-data-index-ephemeral-image/test-resources/tests/features/kogito-data-index-ephemeral.feature b/packages/kogito-data-index-ephemeral-image/test-resources/tests/features/kogito-data-index-ephemeral.feature new file mode 100644 index 00000000000..f7e817c3c16 --- /dev/null +++ b/packages/kogito-data-index-ephemeral-image/test-resources/tests/features/kogito-data-index-ephemeral.feature @@ -0,0 +1,42 @@ +# +# 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. +# +@docker.io/apache/incubator-kie-kogito-data-index-ephemeral +Feature: Kogito-data-index ephemeral postgresql feature. + + Scenario: verify if all labels are correctly set on kogito-data-index-ephemeral image + Given image is built + Then the image should contain label maintainer with value Apache KIE + And the image should contain label io.openshift.expose-services with value 8080:http + And the image should contain label io.k8s.description with value Runtime image for Kogito Data Index Service for ephemeral PostgreSQL persistence provider + And the image should contain label io.k8s.display-name with value Kogito Data Index Service - ephemeral PostgreSQL + And the image should contain label io.openshift.tags with value kogito,data-index,data-index-ephemeral + + Scenario: verify if of kogito-data-index-ephemeral container is correctly started + When container is started with env + | variable | value | + | SCRIPT_DEBUG | true | + Then container log should contain -Djava.library.path=/home/kogito/lib -Dquarkus.http.host=0.0.0.0 -Dquarkus.http.port=8080 -jar /home/kogito/bin/quarkus-app/quarkus-run.jar + And container log should contain Embedded Postgres started at port + And container log should not contain Application failed to start + + Scenario: check if the default quarkus profile is correctly set on data index + When container is started with env + | variable | value | + | SCRIPT_DEBUG | true | + Then available container log should contain -Dquarkus.profile=http-events-support diff --git a/packages/kogito-data-index-postgresql-image/env/index.js b/packages/kogito-data-index-postgresql-image/env/index.js new file mode 100644 index 00000000000..2b6e41af30d --- /dev/null +++ b/packages/kogito-data-index-postgresql-image/env/index.js @@ -0,0 +1,53 @@ +/* + * 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 { varsWithName, composeEnv, getOrDefault } = require("@kie-tools-scripts/build-env"); + +const rootEnv = require("@kie-tools/root-env/env"); + +module.exports = composeEnv([rootEnv], { + vars: varsWithName({ + KOGITO_DATA_INDEX_POSTGRESQL_IMAGE__registry: { + default: "docker.io", + description: "The image registry.", + }, + KOGITO_DATA_INDEX_POSTGRESQL_IMAGE__account: { + default: "apache", + description: "The image registry account.", + }, + KOGITO_DATA_INDEX_POSTGRESQL_IMAGE__name: { + default: "incubator-kie-kogito-data-index-postgresql", + description: "The image name.", + }, + KOGITO_DATA_INDEX_POSTGRESQL_IMAGE__buildTag: { + default: rootEnv.env.root.streamName, + description: "The image tag.", + }, + }), + get env() { + return { + kogitoDataIndexPostgresqlImage: { + registry: getOrDefault(this.vars.KOGITO_DATA_INDEX_POSTGRESQL_IMAGE__registry), + account: getOrDefault(this.vars.KOGITO_DATA_INDEX_POSTGRESQL_IMAGE__account), + name: getOrDefault(this.vars.KOGITO_DATA_INDEX_POSTGRESQL_IMAGE__name), + buildTag: getOrDefault(this.vars.KOGITO_DATA_INDEX_POSTGRESQL_IMAGE__buildTag), + }, + }; + }, +}); diff --git a/packages/kogito-data-index-postgresql-image/install.js b/packages/kogito-data-index-postgresql-image/install.js new file mode 100644 index 00000000000..9b61611cc10 --- /dev/null +++ b/packages/kogito-data-index-postgresql-image/install.js @@ -0,0 +1,64 @@ +/* + * 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"); +const fs = require("fs"); + +const { env } = require("./env"); +const path = require("path"); +const pythonVenvDir = path.dirname(require.resolve("@kie-tools/python-venv/package.json")); +const sonataflowImageCommonDir = path.dirname(require.resolve("@kie-tools/sonataflow-image-common/package.json")); +const replaceInFile = require("replace-in-file"); + +const activateCmd = + process.platform === "win32" + ? `${pythonVenvDir}\\venv\\Scripts\\Activate.bat` + : `. ${pythonVenvDir}/venv/bin/activate`; + +execSync( + `${activateCmd} && \ + python3 ${sonataflowImageCommonDir}/resources/scripts/versions_manager.py --bump-to ${env.kogitoDataIndexPostgresqlImage.buildTag} --source-folder ./resources`, + { stdio: "inherit" } +); + +// Find and read the -image.yaml file +const resourcesPath = path.resolve(__dirname, "./resources"); +const files = fs.readdirSync(resourcesPath); +const imageYamlFiles = files.filter((fileName) => fileName.endsWith("-image.yaml")); +if (imageYamlFiles.length !== 1) { + throw new Error("There should only be one -image.yaml file on ./resources!"); +} +const originalYamlPath = path.join(resourcesPath, imageYamlFiles[0]); +let imageYaml = fs.readFileSync(originalYamlPath, "utf8"); + +const imageUrl = `${env.kogitoDataIndexPostgresqlImage.registry}/${env.kogitoDataIndexPostgresqlImage.account}/${env.kogitoDataIndexPostgresqlImage.name}`; + +// Replace the whole string between quotes ("") with the image name +imageYaml = imageYaml.replace(/(?<=")(.*kogito-data-index-postgresql.*)(?=")/gm, imageUrl); + +// Write file and then rename it to match the image name +fs.writeFileSync(originalYamlPath, imageYaml); +fs.renameSync(originalYamlPath, path.join(resourcesPath, `${env.kogitoDataIndexPostgresqlImage.name}-image.yaml`)); + +// Replace image URL in .feature files +replaceInFile.sync({ + files: ["**/*.feature"], + from: /@docker.io\/apache\/.*/g, + to: `@${imageUrl}`, +}); diff --git a/packages/kogito-data-index-postgresql-image/package.json b/packages/kogito-data-index-postgresql-image/package.json new file mode 100644 index 00000000000..f672f148df0 --- /dev/null +++ b/packages/kogito-data-index-postgresql-image/package.json @@ -0,0 +1,48 @@ +{ + "private": true, + "name": "@kie/kogito-data-index-postgresql-image", + "version": "0.0.0", + "description": "", + "license": "Apache-2.0", + "homepage": "https://github.com/apache/incubator-kie-tools", + "repository": { + "type": "git", + "url": "https://github.com/apache/incubator-kie-tools.git" + }, + "bugs": { + "url": "https://github.com/apache/incubator-kie-tools/issues" + }, + "scripts": { + "build:dev": "run-script-if --bool \"$(build-env containerImages.build)\" --then \"pnpm copy-assets\" \"pnpm image:build\"", + "build:prod": "pnpm build:dev && pnpm image:test", + "copy-assets": "run-script-os", + "copy-assets:linux:darwin": "rimraf build && cp -R ./node_modules/@kie-tools/sonataflow-image-common/resources build && cp -R resources/* build", + "copy-test-assets": "run-script-os", + "copy-test-assets:linux:darwin": "cp -R test-resources/. build", + "format": "prettier --write . --ignore-path=../../.prettierignore --ignore-path=../../.gitignore", + "image:build": "run-script-os", + "image:build:darwin:linux": "pnpm setup:env make -C ./build build-kogito-app build", + "image:build:win32": "echo \"Build skipped on Windows\"", + "image:test": "run-script-if --ignore-errors \"$(build-env tests.ignoreFailures)\" --bool \"$(build-env endToEndTests.run)\" --then \"mkdir -p build/target/test/results\" \"run-script-os\" --finally \"mkdir -p build/target/test/results && cp -R build/target/test/results dist-tests-e2e/\"", + "image:test:darwin:linux": "pnpm copy-test-assets && pnpm setup:env make -C ./build test-image", + "image:test:win32": "echo \"Tests skipped on Windows\"", + "install": "node install.js && pnpm format", + "setup:env": ". ./node_modules/@kie-tools/python-venv/venv/bin/activate && cross-env KOGITO_IMAGE_REGISTRY=$(build-env kogitoDataIndexPostgresqlImage.registry) KOGITO_IMAGE_REGISTRY_ACCOUNT=$(build-env kogitoDataIndexPostgresqlImage.account) KOGITO_IMAGE_NAME=$(build-env kogitoDataIndexPostgresqlImage.name) KOGITO_IMAGE_TAG=$(build-env kogitoDataIndexPostgresqlImage.buildTag) QUARKUS_PLATFORM_VERSION=$(build-env quarkusPlatform.version) KOGITO_VERSION=$(build-env kogitoRuntime.version)" + }, + "devDependencies": { + "@kie-tools/python-venv": "workspace:*", + "@kie-tools/root-env": "workspace:*", + "@kie-tools/sonataflow-image-common": "workspace:*", + "cross-env": "^7.0.3", + "replace-in-file": "^7.1.0", + "rimraf": "^3.0.2", + "run-script-os": "^1.1.6" + }, + "kieTools": { + "requiredPreinstalledCliCommands": [ + "python3", + "make", + "s2i" + ] + } +} diff --git a/packages/kogito-data-index-postgresql-image/resources/incubator-kie-kogito-data-index-postgresql-image.yaml b/packages/kogito-data-index-postgresql-image/resources/incubator-kie-kogito-data-index-postgresql-image.yaml new file mode 100644 index 00000000000..6baa79e3a5b --- /dev/null +++ b/packages/kogito-data-index-postgresql-image/resources/incubator-kie-kogito-data-index-postgresql-image.yaml @@ -0,0 +1,64 @@ +# +# 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. +# +schema_version: 1 + +name: "docker.io/apache/incubator-kie-kogito-data-index-ephemeral" +version: "main" +from: "registry.access.redhat.com/ubi8/openjdk-17-runtime:1.19" +description: "Runtime image for Kogito Data Index Service for PostgreSQL persistence provider" + +labels: + - name: "org.kie.kogito.version" + value: "### SET ME DURING BUILD PROCESS ###" + - name: "maintainer" + value: "Apache KIE " + - name: "io.k8s.description" + value: "Runtime image for Kogito Data Index Service for PostgreSQL persistence provider" + - name: "io.k8s.display-name" + value: "Kogito Data Index Service - PostgreSQL" + - name: "io.openshift.tags" + value: "kogito,data-index,data-index-postgresql" + - name: "io.openshift.expose-services" + value: "8080:http" + +envs: + - name: "SCRIPT_DEBUG" + example: "true" + description: "If set to true, ensures that the bash scripts are executed with the -x option, printing the commands and their arguments as they are executed. Also debug JVM initialization." + +ports: + - value: 8080 + +modules: + repositories: + - path: modules + install: + - name: org.kie.kogito.system.user + - name: org.kie.kogito.logging + - name: org.kie.kogito.dynamic.resources + - name: org.kie.kogito.launch.scripts + - name: org.kie.kogito.dataindex.postgresql + - name: org.kie.kogito.dataindex.common + - name: org.kie.kogito.security.custom.truststores + +run: + workdir: "/home/kogito" + user: 1001 + cmd: + - "/home/kogito/kogito-app-launch.sh" diff --git a/packages/kogito-data-index-postgresql-image/resources/modules/kogito-data-index-postgresql/added/kogito-app-launch.sh b/packages/kogito-data-index-postgresql-image/resources/modules/kogito-data-index-postgresql/added/kogito-app-launch.sh new file mode 100644 index 00000000000..ec77a25695a --- /dev/null +++ b/packages/kogito-data-index-postgresql-image/resources/modules/kogito-data-index-postgresql/added/kogito-app-launch.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env bash +# +# 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. +# + + +#import +source "${KOGITO_HOME}"/launch/logging.sh + +if [ "${SCRIPT_DEBUG}" = "true" ] ; then + set -x + SHOW_JVM_SETTINGS="-XshowSettings:properties" + log_info "Script debugging is enabled, allowing bash commands and their arguments to be printed as they are executed" + log_info "JVM settings debug is enabled." + printenv +fi + +# Configuration scripts +# Any configuration script that needs to run on image startup must be added here. +CONFIGURE_SCRIPTS=( + "${KOGITO_HOME}"/launch/kogito-data-index-common.sh + "${KOGITO_HOME}"/launch/configure-custom-truststore.sh +) +source "${KOGITO_HOME}"/launch/configure.sh +############################################# + +DYNAMIC_RESOURCES_OPTS="$(${JBOSS_CONTAINER_JAVA_JVM_MODULE}/java-default-options) $(${JBOSS_CONTAINER_JAVA_JVM_MODULE}/debug-options)" + +# shellcheck disable=SC2086 +exec java ${SHOW_JVM_SETTINGS} ${DYNAMIC_RESOURCES_OPTS} ${JAVA_OPTIONS} ${KOGITO_DATA_INDEX_PROPS} ${CUSTOM_TRUSTSTORE_ARGS} \ + -Djava.library.path="${KOGITO_HOME}"/lib \ + -Dquarkus.http.host=0.0.0.0 \ + -Dquarkus.http.port=8080 \ + -jar "${KOGITO_HOME}"/bin/quarkus-app/quarkus-run.jar \ No newline at end of file diff --git a/packages/kogito-data-index-postgresql-image/resources/modules/kogito-data-index-postgresql/configure b/packages/kogito-data-index-postgresql-image/resources/modules/kogito-data-index-postgresql/configure new file mode 100644 index 00000000000..ae5360b775e --- /dev/null +++ b/packages/kogito-data-index-postgresql-image/resources/modules/kogito-data-index-postgresql/configure @@ -0,0 +1,26 @@ +#!/bin/sh +# +# 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. +# +set -e + +SCRIPT_DIR=$(dirname "${0}") +ADDED_DIR="${SCRIPT_DIR}"/added + +cp -v "${ADDED_DIR}"/kogito-app-launch.sh "${KOGITO_HOME}" +chmod +x-w "${KOGITO_HOME}"/kogito-app-launch.sh diff --git a/packages/kogito-data-index-postgresql-image/resources/modules/kogito-data-index-postgresql/module.yaml b/packages/kogito-data-index-postgresql-image/resources/modules/kogito-data-index-postgresql/module.yaml new file mode 100644 index 00000000000..43c9fe6d9e9 --- /dev/null +++ b/packages/kogito-data-index-postgresql-image/resources/modules/kogito-data-index-postgresql/module.yaml @@ -0,0 +1,31 @@ +# +# 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. +# +schema_version: 1 +name: org.kie.kogito.dataindex.postgresql +version: "main" + +# see build-kogito-apps-components.sh script, responsible for build it. +# called by the Makefile before builds +artifacts: + - path: /tmp/build/data-index-service-postgresql + dest: /home/kogito/bin + name: quarkus-app + +execute: + - script: configure diff --git a/packages/kogito-data-index-postgresql-image/test-resources/tests/features/kogito-common-postresql-services.feature b/packages/kogito-data-index-postgresql-image/test-resources/tests/features/kogito-common-postresql-services.feature new file mode 100644 index 00000000000..a4146f52bb7 --- /dev/null +++ b/packages/kogito-data-index-postgresql-image/test-resources/tests/features/kogito-common-postresql-services.feature @@ -0,0 +1,31 @@ +# +# 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. +# + +@docker.io/apache/incubator-kie-kogito-data-index-postgresql +Feature: Kogito-data-index postgresql feature. + + Scenario: verify if of container is correctly started with postgresql parameters + When container is started with env + | variable | value | + | SCRIPT_DEBUG | true | + | QUARKUS_DATASOURCE_JDBC_URL | jdbc:postgresql://localhost:5432/quarkus | + | QUARKUS_DATASOURCE_USERNAME | kogito | + | QUARKUS_DATASOURCE_PASSWORD | s3cr3t | + Then container log should contain -Dquarkus.http.host=0.0.0.0 -Dquarkus.http.port=8080 -jar /home/kogito/bin/quarkus-app/quarkus-run.jar + And container log should contain Datasource '': Connection to localhost:5432 refused \ No newline at end of file diff --git a/packages/kogito-data-index-postgresql-image/test-resources/tests/features/kogito-data-index-common.feature b/packages/kogito-data-index-postgresql-image/test-resources/tests/features/kogito-data-index-common.feature new file mode 100644 index 00000000000..fae736f08d5 --- /dev/null +++ b/packages/kogito-data-index-postgresql-image/test-resources/tests/features/kogito-data-index-common.feature @@ -0,0 +1,34 @@ +# +# 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. +# + +@docker.io/apache/incubator-kie-kogito-data-index-postgresql +Feature: Kogito-data-index common feature. + + Scenario: Verify if the debug is correctly enabled and test default http port + When container is started with env + | variable | value | + | SCRIPT_DEBUG | true | + Then container log should contain -Djava.library.path=/home/kogito/lib -Dquarkus.http.host=0.0.0.0 -Dquarkus.http.port=8080 + + Scenario: check if a provided data index quarkus profile is correctly set on data index + When container is started with env + | variable | value | + | SCRIPT_DEBUG | true | + | KOGITO_DATA_INDEX_QUARKUS_PROFILE | http-events-support | + Then container log should contain -Dquarkus.profile=http-events-support \ No newline at end of file diff --git a/packages/kogito-data-index-postgresql-image/test-resources/tests/features/kogito-data-index-postgresql.feature b/packages/kogito-data-index-postgresql-image/test-resources/tests/features/kogito-data-index-postgresql.feature new file mode 100644 index 00000000000..ced19dc790a --- /dev/null +++ b/packages/kogito-data-index-postgresql-image/test-resources/tests/features/kogito-data-index-postgresql.feature @@ -0,0 +1,35 @@ +# +# 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. +# + +@docker.io/apache/incubator-kie-kogito-data-index-postgresql +Feature: Kogito-data-index postgresql feature. + + Scenario: verify if all labels are correctly set on kogito-data-index-postgresql image + Given image is built + Then the image should contain label maintainer with value Apache KIE + And the image should contain label io.openshift.expose-services with value 8080:http + And the image should contain label io.k8s.description with value Runtime image for Kogito Data Index Service for PostgreSQL persistence provider + And the image should contain label io.k8s.display-name with value Kogito Data Index Service - PostgreSQL + And the image should contain label io.openshift.tags with value kogito,data-index,data-index-postgresql + + Scenario: check if the default quarkus profile is correctly set on data index + When container is started with env + | variable | value | + | SCRIPT_DEBUG | true | + Then container log should contain -Dquarkus.profile=kafka-events-support \ No newline at end of file diff --git a/packages/kogito-jit-runner-image/env/index.js b/packages/kogito-jit-runner-image/env/index.js new file mode 100644 index 00000000000..a7772148f10 --- /dev/null +++ b/packages/kogito-jit-runner-image/env/index.js @@ -0,0 +1,53 @@ +/* + * 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 { varsWithName, composeEnv, getOrDefault } = require("@kie-tools-scripts/build-env"); + +const rootEnv = require("@kie-tools/root-env/env"); + +module.exports = composeEnv([rootEnv], { + vars: varsWithName({ + KOGITO_JIT_RUNNER_IMAGE__registry: { + default: "docker.io", + description: "The image registry.", + }, + KOGITO_JIT_RUNNER_IMAGE__account: { + default: "apache", + description: "The image registry account.", + }, + KOGITO_JIT_RUNNER_IMAGE__name: { + default: "incubator-kie-kogito-jit-runner", + description: "The image name.", + }, + KOGITO_JIT_RUNNER_IMAGE__buildTag: { + default: rootEnv.env.root.streamName, + description: "The image tag.", + }, + }), + get env() { + return { + kogitoJitRunnerImage: { + registry: getOrDefault(this.vars.KOGITO_JIT_RUNNER_IMAGE__registry), + account: getOrDefault(this.vars.KOGITO_JIT_RUNNER_IMAGE__account), + name: getOrDefault(this.vars.KOGITO_JIT_RUNNER_IMAGE__name), + buildTag: getOrDefault(this.vars.KOGITO_JIT_RUNNER_IMAGE__buildTag), + }, + }; + }, +}); diff --git a/packages/kogito-jit-runner-image/install.js b/packages/kogito-jit-runner-image/install.js new file mode 100644 index 00000000000..9be7a1027ef --- /dev/null +++ b/packages/kogito-jit-runner-image/install.js @@ -0,0 +1,64 @@ +/* + * 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"); +const fs = require("fs"); + +const { env } = require("./env"); +const path = require("path"); +const pythonVenvDir = path.dirname(require.resolve("@kie-tools/python-venv/package.json")); +const sonataflowImageCommonDir = path.dirname(require.resolve("@kie-tools/sonataflow-image-common/package.json")); +const replaceInFile = require("replace-in-file"); + +const activateCmd = + process.platform === "win32" + ? `${pythonVenvDir}\\venv\\Scripts\\Activate.bat` + : `. ${pythonVenvDir}/venv/bin/activate`; + +execSync( + `${activateCmd} && \ + python3 ${sonataflowImageCommonDir}/resources/scripts/versions_manager.py --bump-to ${env.kogitoJitRunnerImage.buildTag} --source-folder ./resources`, + { stdio: "inherit" } +); + +// Find and read the -image.yaml file +const resourcesPath = path.resolve(__dirname, "./resources"); +const files = fs.readdirSync(resourcesPath); +const imageYamlFiles = files.filter((fileName) => fileName.endsWith("-image.yaml")); +if (imageYamlFiles.length !== 1) { + throw new Error("There should only be one -image.yaml file on ./resources!"); +} +const originalYamlPath = path.join(resourcesPath, imageYamlFiles[0]); +let imageYaml = fs.readFileSync(originalYamlPath, "utf8"); + +const imageUrl = `${env.kogitoJitRunnerImage.registry}/${env.kogitoJitRunnerImage.account}/${env.kogitoJitRunnerImage.name}`; + +// Replace the whole string between quotes ("") with the image name +imageYaml = imageYaml.replace(/(?<=")(.*kogito-jit-runner.*)(?=")/gm, imageUrl); + +// Write file and then rename it to match the image name +fs.writeFileSync(originalYamlPath, imageYaml); +fs.renameSync(originalYamlPath, path.join(resourcesPath, `${env.kogitoJitRunnerImage.name}-image.yaml`)); + +// Replace image URL in .feature files +replaceInFile.sync({ + files: ["**/*.feature"], + from: /@docker.io\/apache\/.*/g, + to: `@${imageUrl}`, +}); diff --git a/packages/kogito-jit-runner-image/package.json b/packages/kogito-jit-runner-image/package.json new file mode 100644 index 00000000000..5762e0ea2eb --- /dev/null +++ b/packages/kogito-jit-runner-image/package.json @@ -0,0 +1,48 @@ +{ + "private": true, + "name": "@kie/kogito-jit-runner-image", + "version": "0.0.0", + "description": "", + "license": "Apache-2.0", + "homepage": "https://github.com/apache/incubator-kie-tools", + "repository": { + "type": "git", + "url": "https://github.com/apache/incubator-kie-tools.git" + }, + "bugs": { + "url": "https://github.com/apache/incubator-kie-tools/issues" + }, + "scripts": { + "build:dev": "run-script-if --bool \"$(build-env containerImages.build)\" --then \"pnpm copy-assets\" \"pnpm image:build\"", + "build:prod": "pnpm build:dev && pnpm image:test", + "copy-assets": "run-script-os", + "copy-assets:linux:darwin": "rimraf build && cp -R ./node_modules/@kie-tools/sonataflow-image-common/resources build && cp -R resources/* build", + "copy-test-assets": "run-script-os", + "copy-test-assets:linux:darwin": "cp -R test-resources/. build", + "format": "prettier --write . --ignore-path=../../.prettierignore --ignore-path=../../.gitignore", + "image:build": "run-script-os", + "image:build:darwin:linux": "pnpm setup:env make -C ./build build-kogito-app build", + "image:build:win32": "echo \"Build skipped on Windows\"", + "image:test": "run-script-if --ignore-errors \"$(build-env tests.ignoreFailures)\" --bool \"$(build-env endToEndTests.run)\" --then \"mkdir -p build/target/test/results\" \"run-script-os\" --finally \"mkdir -p build/target/test/results && cp -R build/target/test/results dist-tests-e2e/\"", + "image:test:darwin:linux": "pnpm copy-test-assets && pnpm setup:env make -C ./build test-image", + "image:test:win32": "echo \"Tests skipped on Windows\"", + "install": "node install.js && pnpm format", + "setup:env": ". ./node_modules/@kie-tools/python-venv/venv/bin/activate && cross-env KOGITO_IMAGE_REGISTRY=$(build-env kogitoJitRunnerImage.registry) KOGITO_IMAGE_REGISTRY_ACCOUNT=$(build-env kogitoJitRunnerImage.account) KOGITO_IMAGE_NAME=$(build-env kogitoJitRunnerImage.name) KOGITO_IMAGE_TAG=$(build-env kogitoJitRunnerImage.buildTag) QUARKUS_PLATFORM_VERSION=$(build-env quarkusPlatform.version) KOGITO_VERSION=$(build-env kogitoRuntime.version)" + }, + "devDependencies": { + "@kie-tools/python-venv": "workspace:*", + "@kie-tools/root-env": "workspace:*", + "@kie-tools/sonataflow-image-common": "workspace:*", + "cross-env": "^7.0.3", + "replace-in-file": "^7.1.0", + "rimraf": "^3.0.2", + "run-script-os": "^1.1.6" + }, + "kieTools": { + "requiredPreinstalledCliCommands": [ + "python3", + "make", + "s2i" + ] + } +} diff --git a/packages/kogito-jit-runner-image/resources/incubator-kie-kogito-jit-runner-image.yaml b/packages/kogito-jit-runner-image/resources/incubator-kie-kogito-jit-runner-image.yaml new file mode 100644 index 00000000000..e6b453f6112 --- /dev/null +++ b/packages/kogito-jit-runner-image/resources/incubator-kie-kogito-jit-runner-image.yaml @@ -0,0 +1,63 @@ +# +# 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. +# +schema_version: 1 + +name: "docker.io/apache/incubator-kie-kogito-jit-runner" +version: "main" +from: "registry.access.redhat.com/ubi8/openjdk-17-runtime:1.19" +description: "Runtime image for Kogito JIT Runner" + +labels: + - name: "org.kie.kogito.version" + value: "### SET ME DURING BUILD PROCESS ###" + - name: "maintainer" + value: "Apache KIE " + - name: "io.k8s.description" + value: "Runtime image for Kogito JIT Runner" + - name: "io.k8s.display-name" + value: "Kogito JIT Runner" + - name: "io.openshift.tags" + value: "kogito,jit-runner" + - name: "io.openshift.expose-services" + value: "8080:http" + +envs: + - name: "SCRIPT_DEBUG" + example: "true" + description: "If set to true, ensures that the bash scripts are executed with the -x option, printing the commands and their arguments as they are executed. Also debug JVM initialization." + +modules: + repositories: + - path: modules + install: + - name: org.kie.kogito.system.user + - name: org.kie.kogito.logging + - name: org.kie.kogito.dynamic.resources + - name: org.kie.kogito.launch.scripts + - name: org.kie.kogito.jit-runner + - name: org.kie.kogito.security.custom.truststores + +ports: + - value: 8080 + +run: + workdir: "/home/kogito" + user: 1001 + cmd: + - "/home/kogito/kogito-app-launch.sh" diff --git a/packages/kogito-jit-runner-image/resources/modules/kogito-jit-runner/added/kogito-app-launch.sh b/packages/kogito-jit-runner-image/resources/modules/kogito-jit-runner/added/kogito-app-launch.sh new file mode 100644 index 00000000000..f519f07d4eb --- /dev/null +++ b/packages/kogito-jit-runner-image/resources/modules/kogito-jit-runner/added/kogito-app-launch.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash +# +# 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. +# + + +#import +source "${KOGITO_HOME}"/launch/logging.sh + +if [ "${SCRIPT_DEBUG}" = "true" ] ; then + set -x + SHOW_JVM_SETTINGS="-XshowSettings:properties" + log_info "Script debugging is enabled, allowing bash commands and their arguments to be printed as they are executed" + log_info "JVM settings debug is enabled." + printenv +fi + +# Configuration scripts +# Any configuration script that needs to run on image startup must be added here. +CONFIGURE_SCRIPTS=( + "${KOGITO_HOME}"/launch/configure-custom-truststore.sh +) +source "${KOGITO_HOME}"/launch/configure.sh +############################################# + +DYNAMIC_RESOURCES_OPTS="$(${JBOSS_CONTAINER_JAVA_JVM_MODULE}/java-default-options) $(${JBOSS_CONTAINER_JAVA_JVM_MODULE}/debug-options)" + +# shellcheck disable=SC2086 +exec java ${SHOW_JVM_SETTINGS} ${DYNAMIC_RESOURCES_OPTS} ${JAVA_OPTIONS} ${CUSTOM_TRUSTSTORE_ARGS} \ + -Djava.library.path="${KOGITO_HOME}"/lib \ + -Dquarkus.http.host=0.0.0.0 \ + -Dquarkus.http.port=8080 \ + -jar "${KOGITO_HOME}"/bin/quarkus-app/quarkus-run.jar \ No newline at end of file diff --git a/packages/kogito-jit-runner-image/resources/modules/kogito-jit-runner/configure b/packages/kogito-jit-runner-image/resources/modules/kogito-jit-runner/configure new file mode 100644 index 00000000000..e1c6da21e36 --- /dev/null +++ b/packages/kogito-jit-runner-image/resources/modules/kogito-jit-runner/configure @@ -0,0 +1,30 @@ +#!/bin/sh +# +# 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. +# +set -e + +SCRIPT_DIR=$(dirname "${0}") +ADDED_DIR="${SCRIPT_DIR}"/added + +chown -R 1001:0 "${KOGITO_HOME}" +chmod -R ug+rwX "${KOGITO_HOME}" + +cp -v "${ADDED_DIR}"/kogito-app-launch.sh "${KOGITO_HOME}" +chmod +x-w "${KOGITO_HOME}"/kogito-app-launch.sh + diff --git a/packages/kogito-jit-runner-image/resources/modules/kogito-jit-runner/module.yaml b/packages/kogito-jit-runner-image/resources/modules/kogito-jit-runner/module.yaml new file mode 100644 index 00000000000..db1d8ec4666 --- /dev/null +++ b/packages/kogito-jit-runner-image/resources/modules/kogito-jit-runner/module.yaml @@ -0,0 +1,31 @@ +# +# 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. +# +schema_version: 1 +name: org.kie.kogito.jit-runner +version: "main" + +# see build-kogito-apps-components.sh script, responsible for build it. +# called by the Makefile before builds +artifacts: + - path: /tmp/build/jitexecutor-runner + dest: /home/kogito/bin + name: quarkus-app + +execute: + - script: configure diff --git a/packages/kogito-jit-runner-image/test-resources/tests/features/kogito-jit-runner.feature b/packages/kogito-jit-runner-image/test-resources/tests/features/kogito-jit-runner.feature new file mode 100644 index 00000000000..4c6e51aed3b --- /dev/null +++ b/packages/kogito-jit-runner-image/test-resources/tests/features/kogito-jit-runner.feature @@ -0,0 +1,49 @@ +# +# 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. +# + +@docker.io/apache/incubator-kie-kogito-jit-runner +Feature: Kogito-jit-runner feature. + + Scenario: verify if all labels are correctly set on kogito-jit-runner image + Given image is built + Then the image should contain label maintainer with value Apache KIE + And the image should contain label io.openshift.expose-services with value 8080:http + And the image should contain label io.k8s.description with value Runtime image for Kogito JIT Runner + And the image should contain label io.k8s.display-name with value Kogito JIT Runner + And the image should contain label io.openshift.tags with value kogito,jit-runner + + Scenario: Verify if the debug is correctly enabled and test default http port + When container is started with env + | variable | value | + | SCRIPT_DEBUG | true | + Then container log should contain -Djava.library.path=/home/kogito/lib -Dquarkus.http.host=0.0.0.0 -Dquarkus.http.port=8080 -jar /home/kogito/bin/quarkus-app/quarkus-run.jar + + Scenario: Verify that jit runner can evaluate a DMN model with a context + When container is started with env + | variable | value | + | SCRIPT_DEBUG | true | + Then check that page is served + | property | value | + | port | 8080 | + | path | /jitdmn | + | wait | 80 | + | expected_phrase | {"sum":3,"m":2,"n":1} | + | request_method | POST | + | content_type | application/json | + | request_body | {"context": {"n" : 1, "m" : 2}, "model": "\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n n + m\n \n \n \n \n \n \n \n \n \n \n \n 300\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n"} | diff --git a/packages/kogito-jobs-service-allinone-image/env/index.js b/packages/kogito-jobs-service-allinone-image/env/index.js new file mode 100644 index 00000000000..dd1f166123d --- /dev/null +++ b/packages/kogito-jobs-service-allinone-image/env/index.js @@ -0,0 +1,53 @@ +/* + * 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 { varsWithName, composeEnv, getOrDefault } = require("@kie-tools-scripts/build-env"); + +const rootEnv = require("@kie-tools/root-env/env"); + +module.exports = composeEnv([rootEnv], { + vars: varsWithName({ + KOGITO_JOBS_SERVICE_ALLINONE_IMAGE__registry: { + default: "docker.io", + description: "The image registry.", + }, + KOGITO_JOBS_SERVICE_ALLINONE_IMAGE__account: { + default: "apache", + description: "The image registry account.", + }, + KOGITO_JOBS_SERVICE_ALLINONE_IMAGE__name: { + default: "incubator-kie-kogito-jobs-service-allinone", + description: "The image name.", + }, + KOGITO_JOBS_SERVICE_ALLINONE_IMAGE__buildTag: { + default: rootEnv.env.root.streamName, + description: "The image tag.", + }, + }), + get env() { + return { + kogitoJobsServiceAllInOneImage: { + registry: getOrDefault(this.vars.KOGITO_JOBS_SERVICE_ALLINONE_IMAGE__registry), + account: getOrDefault(this.vars.KOGITO_JOBS_SERVICE_ALLINONE_IMAGE__account), + name: getOrDefault(this.vars.KOGITO_JOBS_SERVICE_ALLINONE_IMAGE__name), + buildTag: getOrDefault(this.vars.KOGITO_JOBS_SERVICE_ALLINONE_IMAGE__buildTag), + }, + }; + }, +}); diff --git a/packages/kogito-jobs-service-allinone-image/install.js b/packages/kogito-jobs-service-allinone-image/install.js new file mode 100644 index 00000000000..968e4e4e162 --- /dev/null +++ b/packages/kogito-jobs-service-allinone-image/install.js @@ -0,0 +1,64 @@ +/* + * 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"); +const fs = require("fs"); + +const { env } = require("./env"); +const path = require("path"); +const pythonVenvDir = path.dirname(require.resolve("@kie-tools/python-venv/package.json")); +const sonataflowImageCommonDir = path.dirname(require.resolve("@kie-tools/sonataflow-image-common/package.json")); +const replaceInFile = require("replace-in-file"); + +const activateCmd = + process.platform === "win32" + ? `${pythonVenvDir}\\venv\\Scripts\\Activate.bat` + : `. ${pythonVenvDir}/venv/bin/activate`; + +execSync( + `${activateCmd} && \ + python3 ${sonataflowImageCommonDir}/resources/scripts/versions_manager.py --bump-to ${env.kogitoJobsServiceAllInOneImage.buildTag} --source-folder ./resources`, + { stdio: "inherit" } +); + +// Find and read the -image.yaml file +const resourcesPath = path.resolve(__dirname, "./resources"); +const files = fs.readdirSync(resourcesPath); +const imageYamlFiles = files.filter((fileName) => fileName.endsWith("-image.yaml")); +if (imageYamlFiles.length !== 1) { + throw new Error("There should only be one -image.yaml file on ./resources!"); +} +const originalYamlPath = path.join(resourcesPath, imageYamlFiles[0]); +let imageYaml = fs.readFileSync(originalYamlPath, "utf8"); + +const imageUrl = `${env.kogitoJobsServiceAllInOneImage.registry}/${env.kogitoJobsServiceAllInOneImage.account}/${env.kogitoJobsServiceAllInOneImage.name}`; + +// Replace the whole string between quotes ("") with the image name +imageYaml = imageYaml.replace(/(?<=")(.*kogito-jobs-service-allinone.*)(?=")/gm, imageUrl); + +// Write file and then rename it to match the image name +fs.writeFileSync(originalYamlPath, imageYaml); +fs.renameSync(originalYamlPath, path.join(resourcesPath, `${env.kogitoJobsServiceAllInOneImage.name}-image.yaml`)); + +// Replace image URL in .feature files +replaceInFile.sync({ + files: ["**/*.feature"], + from: /@docker.io\/apache\/.*/g, + to: `@${imageUrl}`, +}); diff --git a/packages/kogito-jobs-service-allinone-image/package.json b/packages/kogito-jobs-service-allinone-image/package.json new file mode 100644 index 00000000000..465aa51336a --- /dev/null +++ b/packages/kogito-jobs-service-allinone-image/package.json @@ -0,0 +1,48 @@ +{ + "private": true, + "name": "@kie/kogito-jobs-service-allinone-image", + "version": "0.0.0", + "description": "", + "license": "Apache-2.0", + "homepage": "https://github.com/apache/incubator-kie-tools", + "repository": { + "type": "git", + "url": "https://github.com/apache/incubator-kie-tools.git" + }, + "bugs": { + "url": "https://github.com/apache/incubator-kie-tools/issues" + }, + "scripts": { + "build:dev": "run-script-if --bool \"$(build-env containerImages.build)\" --then \"pnpm copy-assets\" \"pnpm image:build\"", + "build:prod": "pnpm build:dev && pnpm image:test", + "copy-assets": "run-script-os", + "copy-assets:linux:darwin": "rimraf build && cp -R ./node_modules/@kie-tools/sonataflow-image-common/resources build && cp -R resources/* build", + "copy-test-assets": "run-script-os", + "copy-test-assets:linux:darwin": "cp -R test-resources/. build", + "format": "prettier --write . --ignore-path=../../.prettierignore --ignore-path=../../.gitignore", + "image:build": "run-script-os", + "image:build:darwin:linux": "pnpm setup:env make -C ./build build-kogito-app build", + "image:build:win32": "echo \"Build skipped on Windows\"", + "image:test": "run-script-if --ignore-errors \"$(build-env tests.ignoreFailures)\" --bool \"$(build-env endToEndTests.run)\" --then \"mkdir -p build/target/test/results\" \"run-script-os\" --finally \"mkdir -p build/target/test/results && cp -R build/target/test/results dist-tests-e2e/\"", + "image:test:darwin:linux": "pnpm copy-test-assets && pnpm setup:env make -C ./build test-image", + "image:test:win32": "echo \"Tests skipped on Windows\"", + "install": "node install.js && pnpm format", + "setup:env": ". ./node_modules/@kie-tools/python-venv/venv/bin/activate && cross-env KOGITO_IMAGE_REGISTRY=$(build-env kogitoJobsServiceAllInOneImage.registry) KOGITO_IMAGE_REGISTRY_ACCOUNT=$(build-env kogitoJobsServiceAllInOneImage.account) KOGITO_IMAGE_NAME=$(build-env kogitoJobsServiceAllInOneImage.name) KOGITO_IMAGE_TAG=$(build-env kogitoJobsServiceAllInOneImage.buildTag) QUARKUS_PLATFORM_VERSION=$(build-env quarkusPlatform.version) KOGITO_VERSION=$(build-env kogitoRuntime.version)" + }, + "devDependencies": { + "@kie-tools/python-venv": "workspace:*", + "@kie-tools/root-env": "workspace:*", + "@kie-tools/sonataflow-image-common": "workspace:*", + "cross-env": "^7.0.3", + "replace-in-file": "^7.1.0", + "rimraf": "^3.0.2", + "run-script-os": "^1.1.6" + }, + "kieTools": { + "requiredPreinstalledCliCommands": [ + "python3", + "make", + "s2i" + ] + } +} diff --git a/packages/kogito-jobs-service-allinone-image/resources/incubator-kie-kogito-jobs-service-allinone-image.yaml b/packages/kogito-jobs-service-allinone-image/resources/incubator-kie-kogito-jobs-service-allinone-image.yaml new file mode 100644 index 00000000000..eb63de643ee --- /dev/null +++ b/packages/kogito-jobs-service-allinone-image/resources/incubator-kie-kogito-jobs-service-allinone-image.yaml @@ -0,0 +1,70 @@ +# +# 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. +# +schema_version: 1 + +name: "docker.io/apache/incubator-kie-kogito-jobs-service-ephemeral" +version: "main" +from: "registry.access.redhat.com/ubi8/openjdk-17-runtime:1.19" +description: "Runtime image for Kogito Jobs Service with all available jdbc providers" + +labels: + - name: "org.kie.kogito.version" + value: "### SET ME DURING BUILD PROCESS ###" + - name: "maintainer" + value: "Apache KIE " + - name: "io.k8s.description" + value: "Runtime image for Kogito Jobs Service with all available jdbc providers" + - name: "io.k8s.display-name" + value: "Kogito Jobs Service All-in-One" + - name: "io.openshift.tags" + value: "kogito,jobs-service,postgresql,ephemeral" + - name: "io.openshift.expose-services" + value: "8080:http" + +envs: + - name: "SCRIPT_DEBUG" + example: "true" + description: "If set to true, ensures that the bash scripts are executed with the -x option, printing the commands and their arguments as they are executed. Also debug JVM initialization." + - name: "ENABLE_EVENTS" + example: "true" + description: "By default Jobs Service doesn't integrate with message systems (e.g. Kafka). Set this variable to true to enable the events add-on." + - name: "JOBS_SERVICE_PERSISTENCE" + example: "postgresql" + description: "The all in one image contains all the supported jdbc plugins for Jobs Service, ephemeral and postgresql, if empty, defaults to ephemeral" + +modules: + repositories: + - path: modules + install: + - name: org.kie.kogito.system.user + - name: org.kie.kogito.logging + - name: org.kie.kogito.dynamic.resources + - name: org.kie.kogito.launch.scripts + - name: org.kie.kogito.jobs.service.allinone + - name: org.kie.kogito.security.custom.truststores + - name: org.kie.kogito.jobs.service.common + +ports: + - value: 8080 + +run: + workdir: "/home/kogito" + user: 1001 + cmd: + - "/home/kogito/kogito-app-launch.sh" diff --git a/packages/kogito-jobs-service-allinone-image/resources/modules/kogito-jobs-service-all-in-one/added/kogito-app-launch.sh b/packages/kogito-jobs-service-allinone-image/resources/modules/kogito-jobs-service-all-in-one/added/kogito-app-launch.sh new file mode 100644 index 00000000000..43fc15e1c50 --- /dev/null +++ b/packages/kogito-jobs-service-allinone-image/resources/modules/kogito-jobs-service-all-in-one/added/kogito-app-launch.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash +# +# 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. +# + + +#import +source "${KOGITO_HOME}"/launch/logging.sh + +if [ "${SCRIPT_DEBUG}" = "true" ] ; then + set -x + SHOW_JVM_SETTINGS="-XshowSettings:properties" + log_info "Script debugging is enabled, allowing bash commands and their arguments to be printed as they are executed" + log_info "JVM settings debug is enabled." + printenv +fi + +allowed_jobs_service_flavors=("ephemeral" "postgresql") +jobs_service_flavor="ephemeral" +if [[ ! "${allowed_jobs_service_flavors[*]}" =~ ${JOBS_SERVICE_PERSISTENCE,,} ]]; then + log_warning "${JOBS_SERVICE_PERSISTENCE,,} is not supported, the allowed flavors are [${allowed_jobs_service_flavors[*]}], defaulting to ${jobs_service_flavor}" + unset JOBS_SERVICE_PERSISTENCE + +elif [ "x${JOBS_SERVICE_PERSISTENCE}" != "x" ]; then + jobs_service_flavor=${JOBS_SERVICE_PERSISTENCE,,} +fi + +# Configuration scripts +# Any configuration script that needs to run on image startup must be added here. +CONFIGURE_SCRIPTS=( + "${KOGITO_HOME}"/launch/kogito-jobs-service-common.sh + "${KOGITO_HOME}"/launch/configure-custom-truststore.sh +) +source "${KOGITO_HOME}"/launch/configure.sh +############################################# + +DYNAMIC_RESOURCES_OPTS="$(${JBOSS_CONTAINER_JAVA_JVM_MODULE}/java-default-options) $(${JBOSS_CONTAINER_JAVA_JVM_MODULE}/debug-options)" + +# shellcheck disable=SC2086 +exec java ${SHOW_JVM_SETTINGS} ${DYNAMIC_RESOURCES_OPTS} ${JAVA_OPTIONS} ${KOGITO_JOBS_PROPS} ${CUSTOM_TRUSTSTORE_ARGS} \ + -Dquarkus.http.host=0.0.0.0 \ + -Dquarkus.http.port=8080 \ + -jar "${KOGITO_HOME}"/bin/${jobs_service_flavor}/quarkus-app/quarkus-run.jar diff --git a/packages/kogito-jobs-service-allinone-image/resources/modules/kogito-jobs-service-all-in-one/configure b/packages/kogito-jobs-service-allinone-image/resources/modules/kogito-jobs-service-all-in-one/configure new file mode 100644 index 00000000000..0dcce19d402 --- /dev/null +++ b/packages/kogito-jobs-service-allinone-image/resources/modules/kogito-jobs-service-all-in-one/configure @@ -0,0 +1,37 @@ +#!/bin/sh +# +# 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. +# +set -e + +SCRIPT_DIR=$(dirname "${0}") +ADDED_DIR="${SCRIPT_DIR}"/added + +mkdir "${KOGITO_HOME}"/bin/shared-libs/ + +mv "${KOGITO_HOME}"/bin/ephemeral/quarkus-app/lib/* "${KOGITO_HOME}"/bin/shared-libs/ +rm -rf "${KOGITO_HOME}"/bin/ephemeral/quarkus-app/lib +ln -s "${KOGITO_HOME}"/bin/shared-libs "${KOGITO_HOME}"/bin/ephemeral/quarkus-app/lib + +cp -R "${KOGITO_HOME}"/bin/postgresql/quarkus-app/lib/* "${KOGITO_HOME}"/bin/shared-libs/ +rm -rf "${KOGITO_HOME}"/bin/postgresql/quarkus-app/lib +ln -s "${KOGITO_HOME}"/bin/shared-libs "${KOGITO_HOME}"/bin/postgresql/quarkus-app/lib + + +cp "${ADDED_DIR}"/kogito-app-launch.sh "${KOGITO_HOME}" +chmod +x-w "${KOGITO_HOME}"/kogito-app-launch.sh diff --git a/packages/kogito-jobs-service-allinone-image/resources/modules/kogito-jobs-service-all-in-one/module.yaml b/packages/kogito-jobs-service-allinone-image/resources/modules/kogito-jobs-service-all-in-one/module.yaml new file mode 100644 index 00000000000..1963808b63d --- /dev/null +++ b/packages/kogito-jobs-service-allinone-image/resources/modules/kogito-jobs-service-all-in-one/module.yaml @@ -0,0 +1,32 @@ +# +# 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. +# +schema_version: 1 +name: org.kie.kogito.jobs.service.allinone +version: "main" + +artifacts: + - path: /tmp/build/jobs-service-inmemory-all-in-one + name: jobs-service-inmemory-all-in-one + dest: /home/kogito/bin/ephemeral + - path: /tmp/build/jobs-service-postgresql-all-in-one + name: jobs-service-postgresql-all-in-one + dest: /home/kogito/bin/postgresql + +execute: + - script: configure diff --git a/packages/kogito-jobs-service-allinone-image/test-resources/tests/features/kogito-jobs-service-all-in-one.feature b/packages/kogito-jobs-service-allinone-image/test-resources/tests/features/kogito-jobs-service-all-in-one.feature new file mode 100644 index 00000000000..8d897bdf35f --- /dev/null +++ b/packages/kogito-jobs-service-allinone-image/test-resources/tests/features/kogito-jobs-service-all-in-one.feature @@ -0,0 +1,67 @@ +# +# 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. +# + +@docker.io/apache/incubator-kie-kogito-jobs-service-allinone +Feature: Kogito-jobs-service-all-in-one feature. + + Scenario: verify if all labels are correctly set kogito-jobs-service image image + Given image is built + Then the image should contain label maintainer with value Apache KIE + And the image should contain label io.openshift.expose-services with value 8080:http + And the image should contain label io.k8s.description with value Runtime image for Kogito Jobs Service with all available jdbc providers + And the image should contain label io.k8s.display-name with value Kogito Jobs Service All-in-One + And the image should contain label io.openshift.tags with value kogito,jobs-service,postgresql,ephemeral + + Scenario: Verify if all jobs-service flavors are in the image + When container is started with command bash + Then file /home/kogito/bin/ephemeral/quarkus-app/quarkus-run.jar should exist + And file /home/kogito/bin/postgresql/quarkus-app/quarkus-run.jar should exist + + Scenario: Verify if the debug is correctly enabled with the ephemeral jar + When container is started with env + | variable | value | + | SCRIPT_DEBUG | true | + Then container log should contain -Dquarkus.http.host=0.0.0.0 -Dquarkus.http.port=8080 -jar /home/kogito/bin/ephemeral/quarkus-app/quarkus-run.jar + And container log should contain started in + And container log should not contain Application failed to start + + Scenario: verify if the container is started with invalid jobs-service flavor + When container is started with env + | variable | value | + | SCRIPT_DEBUG | true | + | JOBS_SERVICE_PERSISTENCE | something | + Then container log should contain -Dquarkus.http.host=0.0.0.0 -Dquarkus.http.port=8080 -jar /home/kogito/bin/ephemeral/quarkus-app/quarkus-run.jar + And container log should contain something is not supported, the allowed flavors are [ephemeral postgresql], defaulting to ephemeral + + Scenario: verify if container starts as expected + When container is started with env + | variable | value | + | SCRIPT_DEBUG | true | + | QUARKUS_LOG_LEVEL | DEBUG | + | JOBS_SERVICE_PERSISTENCE | postgresql | + | QUARKUS_DATASOURCE_DB_KIND | postgresql | + | QUARKUS_DATASOURCE_USERNAME | test | + | QUARKUS_DATASOURCE_PASSWORD | 123456 | + | QUARKUS_DATASOURCE_JDBC_URL | jdbc:postgresql://10.11.12.13:5432/hibernate_orm_test | + Then container log should contain -Dquarkus.http.host=0.0.0.0 -Dquarkus.http.port=8080 -jar /home/kogito/bin/postgresql/quarkus-app/quarkus-run.jar + And container log should contain QUARKUS_DATASOURCE_DB_KIND=postgresql + And container log should contain QUARKUS_DATASOURCE_USERNAME=test + And container log should contain QUARKUS_DATASOURCE_PASSWORD=123456 + And container log should contain QUARKUS_DATASOURCE_JDBC_URL=jdbc:postgresql://10.11.12.13:5432/hibernate_orm_test + And container log should contain Trying to establish a protocol version 3 connection to 10.11.12.13:5432 diff --git a/packages/kogito-jobs-service-allinone-image/test-resources/tests/features/kogito-jobs-service-common.feature b/packages/kogito-jobs-service-allinone-image/test-resources/tests/features/kogito-jobs-service-common.feature new file mode 100644 index 00000000000..81743a49b80 --- /dev/null +++ b/packages/kogito-jobs-service-allinone-image/test-resources/tests/features/kogito-jobs-service-common.feature @@ -0,0 +1,31 @@ +# +# 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. +# + +@docker.io/apache/incubator-kie-kogito-jobs-service-allinone +@docker.io/apache/incubator-kie-kogito-jobs-service-allinone +@docker.io/apache/incubator-kie-kogito-jobs-service-allinone +Feature: Kogito-jobs-service common feature. + + Scenario: verify if the events is correctly enabled + When container is started with env + | variable | value | + | SCRIPT_DEBUG | true | + | ENABLE_EVENTS | true | + | KOGITO_JOBS_PROPS | -Dkafka.bootstrap.servers=localhost:11111 | + Then container log should contain -Dkafka.bootstrap.servers=localhost:11111 -Dquarkus.profile=events-support -Dquarkus.http.host=0.0.0.0 -Dquarkus.http.port=8080 -jar diff --git a/packages/kogito-jobs-service-ephemeral-image/env/index.js b/packages/kogito-jobs-service-ephemeral-image/env/index.js new file mode 100644 index 00000000000..fdd58dfdd07 --- /dev/null +++ b/packages/kogito-jobs-service-ephemeral-image/env/index.js @@ -0,0 +1,53 @@ +/* + * 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 { varsWithName, composeEnv, getOrDefault } = require("@kie-tools-scripts/build-env"); + +const rootEnv = require("@kie-tools/root-env/env"); + +module.exports = composeEnv([rootEnv], { + vars: varsWithName({ + KOGITO_JOBS_SERVICE_EPHEMERAL_IMAGE__registry: { + default: "docker.io", + description: "The image registry.", + }, + KOGITO_JOBS_SERVICE_EPHEMERAL_IMAGE__account: { + default: "apache", + description: "The image registry account.", + }, + KOGITO_JOBS_SERVICE_EPHEMERAL_IMAGE__name: { + default: "incubator-kie-kogito-jobs-service-ephemeral", + description: "The image name.", + }, + KOGITO_JOBS_SERVICE_EPHEMERAL_IMAGE__buildTag: { + default: rootEnv.env.root.streamName, + description: "The image tag.", + }, + }), + get env() { + return { + kogitoJobsServiceEphemeralImage: { + registry: getOrDefault(this.vars.KOGITO_JOBS_SERVICE_EPHEMERAL_IMAGE__registry), + account: getOrDefault(this.vars.KOGITO_JOBS_SERVICE_EPHEMERAL_IMAGE__account), + name: getOrDefault(this.vars.KOGITO_JOBS_SERVICE_EPHEMERAL_IMAGE__name), + buildTag: getOrDefault(this.vars.KOGITO_JOBS_SERVICE_EPHEMERAL_IMAGE__buildTag), + }, + }; + }, +}); diff --git a/packages/kogito-jobs-service-ephemeral-image/install.js b/packages/kogito-jobs-service-ephemeral-image/install.js new file mode 100644 index 00000000000..68c5fc634a6 --- /dev/null +++ b/packages/kogito-jobs-service-ephemeral-image/install.js @@ -0,0 +1,64 @@ +/* + * 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"); +const fs = require("fs"); + +const { env } = require("./env"); +const path = require("path"); +const pythonVenvDir = path.dirname(require.resolve("@kie-tools/python-venv/package.json")); +const sonataflowImageCommonDir = path.dirname(require.resolve("@kie-tools/sonataflow-image-common/package.json")); +const replaceInFile = require("replace-in-file"); + +const activateCmd = + process.platform === "win32" + ? `${pythonVenvDir}\\venv\\Scripts\\Activate.bat` + : `. ${pythonVenvDir}/venv/bin/activate`; + +execSync( + `${activateCmd} && \ + python3 ${sonataflowImageCommonDir}/resources/scripts/versions_manager.py --bump-to ${env.kogitoJobsServiceEphemeralImage.buildTag} --source-folder ./resources`, + { stdio: "inherit" } +); + +// Find and read the -image.yaml file +const resourcesPath = path.resolve(__dirname, "./resources"); +const files = fs.readdirSync(resourcesPath); +const imageYamlFiles = files.filter((fileName) => fileName.endsWith("-image.yaml")); +if (imageYamlFiles.length !== 1) { + throw new Error("There should only be one -image.yaml file on ./resources!"); +} +const originalYamlPath = path.join(resourcesPath, imageYamlFiles[0]); +let imageYaml = fs.readFileSync(originalYamlPath, "utf8"); + +const imageUrl = `${env.kogitoJobsServiceEphemeralImage.registry}/${env.kogitoJobsServiceEphemeralImage.account}/${env.kogitoJobsServiceEphemeralImage.name}`; + +// Replace the whole string between quotes ("") with the image name +imageYaml = imageYaml.replace(/(?<=")(.*kogito-jobs-service-ephemeral.*)(?=")/gm, imageUrl); + +// Write file and then rename it to match the image name +fs.writeFileSync(originalYamlPath, imageYaml); +fs.renameSync(originalYamlPath, path.join(resourcesPath, `${env.kogitoJobsServiceEphemeralImage.name}-image.yaml`)); + +// Replace image URL in .feature files +replaceInFile.sync({ + files: ["**/*.feature"], + from: /@docker.io\/apache\/.*/g, + to: `@${imageUrl}`, +}); diff --git a/packages/kogito-jobs-service-ephemeral-image/package.json b/packages/kogito-jobs-service-ephemeral-image/package.json new file mode 100644 index 00000000000..32d001b99e6 --- /dev/null +++ b/packages/kogito-jobs-service-ephemeral-image/package.json @@ -0,0 +1,48 @@ +{ + "private": true, + "name": "@kie/kogito-jobs-service-ephemeral-image", + "version": "0.0.0", + "description": "", + "license": "Apache-2.0", + "homepage": "https://github.com/apache/incubator-kie-tools", + "repository": { + "type": "git", + "url": "https://github.com/apache/incubator-kie-tools.git" + }, + "bugs": { + "url": "https://github.com/apache/incubator-kie-tools/issues" + }, + "scripts": { + "build:dev": "run-script-if --bool \"$(build-env containerImages.build)\" --then \"pnpm copy-assets\" \"pnpm image:build\"", + "build:prod": "pnpm build:dev && pnpm image:test", + "copy-assets": "run-script-os", + "copy-assets:linux:darwin": "rimraf build && cp -R ./node_modules/@kie-tools/sonataflow-image-common/resources build && cp -R resources/* build", + "copy-test-assets": "run-script-os", + "copy-test-assets:linux:darwin": "cp -R test-resources/. build", + "format": "prettier --write . --ignore-path=../../.prettierignore --ignore-path=../../.gitignore", + "image:build": "run-script-os", + "image:build:darwin:linux": "pnpm setup:env make -C ./build build-kogito-app build", + "image:build:win32": "echo \"Build skipped on Windows\"", + "image:test": "run-script-if --ignore-errors \"$(build-env tests.ignoreFailures)\" --bool \"$(build-env endToEndTests.run)\" --then \"mkdir -p build/target/test/results\" \"run-script-os\" --finally \"mkdir -p build/target/test/results && cp -R build/target/test/results dist-tests-e2e/\"", + "image:test:darwin:linux": "pnpm copy-test-assets && pnpm setup:env make -C ./build test-image", + "image:test:win32": "echo \"Tests skipped on Windows\"", + "install": "node install.js && pnpm format", + "setup:env": ". ./node_modules/@kie-tools/python-venv/venv/bin/activate && cross-env KOGITO_IMAGE_REGISTRY=$(build-env kogitoJobsServiceEphemeralImage.registry) KOGITO_IMAGE_REGISTRY_ACCOUNT=$(build-env kogitoJobsServiceEphemeralImage.account) KOGITO_IMAGE_NAME=$(build-env kogitoJobsServiceEphemeralImage.name) KOGITO_IMAGE_TAG=$(build-env kogitoJobsServiceEphemeralImage.buildTag) QUARKUS_PLATFORM_VERSION=$(build-env quarkusPlatform.version) KOGITO_VERSION=$(build-env kogitoRuntime.version)" + }, + "devDependencies": { + "@kie-tools/python-venv": "workspace:*", + "@kie-tools/root-env": "workspace:*", + "@kie-tools/sonataflow-image-common": "workspace:*", + "cross-env": "^7.0.3", + "replace-in-file": "^7.1.0", + "rimraf": "^3.0.2", + "run-script-os": "^1.1.6" + }, + "kieTools": { + "requiredPreinstalledCliCommands": [ + "python3", + "make", + "s2i" + ] + } +} diff --git a/packages/kogito-jobs-service-ephemeral-image/resources/incubator-kie-kogito-jobs-service-ephemeral-image.yaml b/packages/kogito-jobs-service-ephemeral-image/resources/incubator-kie-kogito-jobs-service-ephemeral-image.yaml new file mode 100644 index 00000000000..92536ef40f5 --- /dev/null +++ b/packages/kogito-jobs-service-ephemeral-image/resources/incubator-kie-kogito-jobs-service-ephemeral-image.yaml @@ -0,0 +1,67 @@ +# +# 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. +# +schema_version: 1 + +name: "docker.io/apache/incubator-kie-kogito-jobs-service-ephemeral" +version: "main" +from: "registry.access.redhat.com/ubi8/openjdk-17-runtime:1.19" +description: "Runtime image for Kogito in memory Jobs Service" + +labels: + - name: "org.kie.kogito.version" + value: "### SET ME DURING BUILD PROCESS ###" + - name: "maintainer" + value: "Apache KIE " + - name: "io.k8s.description" + value: "Runtime image for Kogito in memory Jobs Service" + - name: "io.k8s.display-name" + value: "Kogito in memory Jobs Service" + - name: "io.openshift.tags" + value: "kogito,jobs-service-ephemeral" + - name: "io.openshift.expose-services" + value: "8080:http" + +envs: + - name: "SCRIPT_DEBUG" + example: "true" + description: "If set to true, ensures that the bash scripts are executed with the -x option, printing the commands and their arguments as they are executed. Also debug JVM initialization." + - name: "ENABLE_EVENTS" + example: "true" + description: "By default Jobs Service doesn't integrate with message systems (e.g. Kafka). Set this variable to true to enable the events add-on." + +modules: + repositories: + - path: modules + install: + - name: org.kie.kogito.system.user + - name: org.kie.kogito.logging + - name: org.kie.kogito.dynamic.resources + - name: org.kie.kogito.launch.scripts + - name: org.kie.kogito.jobs.service.ephemeral + - name: org.kie.kogito.security.custom.truststores + - name: org.kie.kogito.jobs.service.common + +ports: + - value: 8080 + +run: + workdir: "/home/kogito" + user: 1001 + cmd: + - "/home/kogito/kogito-app-launch.sh" diff --git a/packages/kogito-jobs-service-ephemeral-image/resources/modules/added/kogito-app-launch.sh b/packages/kogito-jobs-service-ephemeral-image/resources/modules/added/kogito-app-launch.sh new file mode 100644 index 00000000000..66b2da357fe --- /dev/null +++ b/packages/kogito-jobs-service-ephemeral-image/resources/modules/added/kogito-app-launch.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash +# +# 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. +# + + +#import +source "${KOGITO_HOME}"/launch/logging.sh + +if [ "${SCRIPT_DEBUG}" = "true" ] ; then + set -x + SHOW_JVM_SETTINGS="-XshowSettings:properties" + log_info "Script debugging is enabled, allowing bash commands and their arguments to be printed as they are executed" + log_info "JVM settings debug is enabled." + printenv +fi + +# Configuration scripts +# Any configuration script that needs to run on image startup must be added here. +CONFIGURE_SCRIPTS=( + "${KOGITO_HOME}"/launch/kogito-jobs-service-common.sh + "${KOGITO_HOME}"/launch/configure-custom-truststore.sh +) +source "${KOGITO_HOME}"/launch/configure.sh +############################################# + +DYNAMIC_RESOURCES_OPTS="$(${JBOSS_CONTAINER_JAVA_JVM_MODULE}/java-default-options) $(${JBOSS_CONTAINER_JAVA_JVM_MODULE}/debug-options)" + +# shellcheck disable=SC2086 +exec java ${SHOW_JVM_SETTINGS} ${DYNAMIC_RESOURCES_OPTS} ${JAVA_OPTIONS} ${KOGITO_JOBS_PROPS} ${CUSTOM_TRUSTSTORE_ARGS} \ + -Dquarkus.http.host=0.0.0.0 \ + -Dquarkus.http.port=8080 \ + -jar "${KOGITO_HOME}"/bin/ephemeral/quarkus-app/quarkus-run.jar diff --git a/packages/kogito-jobs-service-ephemeral-image/resources/modules/configure b/packages/kogito-jobs-service-ephemeral-image/resources/modules/configure new file mode 100644 index 00000000000..10d0d252bfa --- /dev/null +++ b/packages/kogito-jobs-service-ephemeral-image/resources/modules/configure @@ -0,0 +1,26 @@ +#!/bin/sh +# +# 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. +# +set -e + +SCRIPT_DIR=$(dirname "${0}") +ADDED_DIR="${SCRIPT_DIR}"/added + +cp "${ADDED_DIR}"/kogito-app-launch.sh "${KOGITO_HOME}" +chmod +x-w "${KOGITO_HOME}"/kogito-app-launch.sh diff --git a/packages/kogito-jobs-service-ephemeral-image/resources/modules/module.yaml b/packages/kogito-jobs-service-ephemeral-image/resources/modules/module.yaml new file mode 100644 index 00000000000..b320c789219 --- /dev/null +++ b/packages/kogito-jobs-service-ephemeral-image/resources/modules/module.yaml @@ -0,0 +1,31 @@ +# +# 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. +# +schema_version: 1 +name: org.kie.kogito.jobs.service.ephemeral +version: "main" + +# see build-kogito-apps-components.sh script, responsible for build it. +# called by the Makefile before builds +artifacts: + - path: /tmp/build/jobs-service-inmemory + dest: /home/kogito/bin/ephemeral + name: quarkus-app + +execute: + - script: configure diff --git a/packages/kogito-jobs-service-ephemeral-image/test-resources/tests/features/kogito-jobs-service-common.feature b/packages/kogito-jobs-service-ephemeral-image/test-resources/tests/features/kogito-jobs-service-common.feature new file mode 100644 index 00000000000..56a431c9c5f --- /dev/null +++ b/packages/kogito-jobs-service-ephemeral-image/test-resources/tests/features/kogito-jobs-service-common.feature @@ -0,0 +1,31 @@ +# +# 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. +# + +@docker.io/apache/incubator-kie-kogito-jobs-service-ephemeral +@docker.io/apache/incubator-kie-kogito-jobs-service-ephemeral +@docker.io/apache/incubator-kie-kogito-jobs-service-ephemeral +Feature: Kogito-jobs-service common feature. + + Scenario: verify if the events is correctly enabled + When container is started with env + | variable | value | + | SCRIPT_DEBUG | true | + | ENABLE_EVENTS | true | + | KOGITO_JOBS_PROPS | -Dkafka.bootstrap.servers=localhost:11111 | + Then container log should contain -Dkafka.bootstrap.servers=localhost:11111 -Dquarkus.profile=events-support -Dquarkus.http.host=0.0.0.0 -Dquarkus.http.port=8080 -jar diff --git a/packages/kogito-jobs-service-ephemeral-image/test-resources/tests/features/kogito-jobs-service-ephemeral.feature b/packages/kogito-jobs-service-ephemeral-image/test-resources/tests/features/kogito-jobs-service-ephemeral.feature new file mode 100644 index 00000000000..bb0102bc084 --- /dev/null +++ b/packages/kogito-jobs-service-ephemeral-image/test-resources/tests/features/kogito-jobs-service-ephemeral.feature @@ -0,0 +1,42 @@ +# +# 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. +# + +@docker.io/apache/incubator-kie-kogito-jobs-service-ephemeral +Feature: Kogito-jobs-service-ephemeral feature. + + Scenario: verify if all labels are correctly set kogito-jobs-service image image + Given image is built + Then the image should contain label maintainer with value Apache KIE + And the image should contain label io.openshift.expose-services with value 8080:http + And the image should contain label io.k8s.description with value Runtime image for Kogito in memory Jobs Service + And the image should contain label io.k8s.display-name with value Kogito in memory Jobs Service + And the image should contain label io.openshift.tags with value kogito,jobs-service-ephemeral + + Scenario: Verify if the application jar exists + When container is started with command bash + Then run sh -c 'ls /home/kogito/bin/ephemeral/quarkus-app/quarkus-run.jar' in container and immediately check its output for /home/kogito/bin/ephemeral/quarkus-app/quarkus-run.jar + + Scenario: Verify if the debug is correctly enabled with the ephemeral jar + When container is started with env + | variable | value | + | SCRIPT_DEBUG | true | + Then container log should contain -Dquarkus.http.host=0.0.0.0 -Dquarkus.http.port=8080 -jar /home/kogito/bin/ephemeral/quarkus-app/quarkus-run.jar + And container log should contain started in + And container log should not contain Application failed to start + diff --git a/packages/kogito-jobs-service-postgresql-image/env/index.js b/packages/kogito-jobs-service-postgresql-image/env/index.js new file mode 100644 index 00000000000..538378a7353 --- /dev/null +++ b/packages/kogito-jobs-service-postgresql-image/env/index.js @@ -0,0 +1,53 @@ +/* + * 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 { varsWithName, composeEnv, getOrDefault } = require("@kie-tools-scripts/build-env"); + +const rootEnv = require("@kie-tools/root-env/env"); + +module.exports = composeEnv([rootEnv], { + vars: varsWithName({ + KOGITO_JOBS_SERVICE_POSTGRESQL_IMAGE__registry: { + default: "docker.io", + description: "The image registry.", + }, + KOGITO_JOBS_SERVICE_POSTGRESQL_IMAGE__account: { + default: "apache", + description: "The image registry account.", + }, + KOGITO_JOBS_SERVICE_POSTGRESQL_IMAGE__name: { + default: "incubator-kie-kogito-jobs-service-postgresql", + description: "The image name.", + }, + KOGITO_JOBS_SERVICE_POSTGRESQL_IMAGE__buildTag: { + default: rootEnv.env.root.streamName, + description: "The image tag.", + }, + }), + get env() { + return { + kogitoJobsServicePostgresqlImage: { + registry: getOrDefault(this.vars.KOGITO_JOBS_SERVICE_POSTGRESQL_IMAGE__registry), + account: getOrDefault(this.vars.KOGITO_JOBS_SERVICE_POSTGRESQL_IMAGE__account), + name: getOrDefault(this.vars.KOGITO_JOBS_SERVICE_POSTGRESQL_IMAGE__name), + buildTag: getOrDefault(this.vars.KOGITO_JOBS_SERVICE_POSTGRESQL_IMAGE__buildTag), + }, + }; + }, +}); diff --git a/packages/kogito-jobs-service-postgresql-image/install.js b/packages/kogito-jobs-service-postgresql-image/install.js new file mode 100644 index 00000000000..10ca5359643 --- /dev/null +++ b/packages/kogito-jobs-service-postgresql-image/install.js @@ -0,0 +1,64 @@ +/* + * 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"); +const fs = require("fs"); + +const { env } = require("./env"); +const path = require("path"); +const pythonVenvDir = path.dirname(require.resolve("@kie-tools/python-venv/package.json")); +const sonataflowImageCommonDir = path.dirname(require.resolve("@kie-tools/sonataflow-image-common/package.json")); +const replaceInFile = require("replace-in-file"); + +const activateCmd = + process.platform === "win32" + ? `${pythonVenvDir}\\venv\\Scripts\\Activate.bat` + : `. ${pythonVenvDir}/venv/bin/activate`; + +execSync( + `${activateCmd} && \ + python3 ${sonataflowImageCommonDir}/resources/scripts/versions_manager.py --bump-to ${env.kogitoJobsServicePostgresqlImage.buildTag} --source-folder ./resources`, + { stdio: "inherit" } +); + +// Find and read the -image.yaml file +const resourcesPath = path.resolve(__dirname, "./resources"); +const files = fs.readdirSync(resourcesPath); +const imageYamlFiles = files.filter((fileName) => fileName.endsWith("-image.yaml")); +if (imageYamlFiles.length !== 1) { + throw new Error("There should only be one -image.yaml file on ./resources!"); +} +const originalYamlPath = path.join(resourcesPath, imageYamlFiles[0]); +let imageYaml = fs.readFileSync(originalYamlPath, "utf8"); + +const imageUrl = `${env.kogitoJobsServicePostgresqlImage.registry}/${env.kogitoJobsServicePostgresqlImage.account}/${env.kogitoJobsServicePostgresqlImage.name}`; + +// Replace the whole string between quotes ("") with the image name +imageYaml = imageYaml.replace(/(?<=")(.*kogito-jobs-service-postgresql.*)(?=")/gm, imageUrl); + +// Write file and then rename it to match the image name +fs.writeFileSync(originalYamlPath, imageYaml); +fs.renameSync(originalYamlPath, path.join(resourcesPath, `${env.kogitoJobsServicePostgresqlImage.name}-image.yaml`)); + +// Replace image URL in .feature files +replaceInFile.sync({ + files: ["**/*.feature"], + from: /@docker.io\/apache\/.*/g, + to: `@${imageUrl}`, +}); diff --git a/packages/kogito-jobs-service-postgresql-image/package.json b/packages/kogito-jobs-service-postgresql-image/package.json new file mode 100644 index 00000000000..ef5fc8a6346 --- /dev/null +++ b/packages/kogito-jobs-service-postgresql-image/package.json @@ -0,0 +1,48 @@ +{ + "private": true, + "name": "@kie/kogito-jobs-service-postgresql-image", + "version": "0.0.0", + "description": "", + "license": "Apache-2.0", + "homepage": "https://github.com/apache/incubator-kie-tools", + "repository": { + "type": "git", + "url": "https://github.com/apache/incubator-kie-tools.git" + }, + "bugs": { + "url": "https://github.com/apache/incubator-kie-tools/issues" + }, + "scripts": { + "build:dev": "run-script-if --bool \"$(build-env containerImages.build)\" --then \"pnpm copy-assets\" \"pnpm image:build\"", + "build:prod": "pnpm build:dev && pnpm image:test", + "copy-assets": "run-script-os", + "copy-assets:linux:darwin": "rimraf build && cp -R ./node_modules/@kie-tools/sonataflow-image-common/resources build && cp -R resources/* build", + "copy-test-assets": "run-script-os", + "copy-test-assets:linux:darwin": "cp -R test-resources/. build", + "format": "prettier --write . --ignore-path=../../.prettierignore --ignore-path=../../.gitignore", + "image:build": "run-script-os", + "image:build:darwin:linux": "pnpm setup:env make -C ./build build-kogito-app build", + "image:build:win32": "echo \"Build skipped on Windows\"", + "image:test": "run-script-if --ignore-errors \"$(build-env tests.ignoreFailures)\" --bool \"$(build-env endToEndTests.run)\" --then \"mkdir -p build/target/test/results\" \"run-script-os\" --finally \"mkdir -p build/target/test/results && cp -R build/target/test/results dist-tests-e2e/\"", + "image:test:darwin:linux": "pnpm copy-test-assets && pnpm setup:env make -C ./build test-image", + "image:test:win32": "echo \"Tests skipped on Windows\"", + "install": "node install.js && pnpm format", + "setup:env": ". ./node_modules/@kie-tools/python-venv/venv/bin/activate && cross-env KOGITO_IMAGE_REGISTRY=$(build-env kogitoJobsServicePostgresqlImage.registry) KOGITO_IMAGE_REGISTRY_ACCOUNT=$(build-env kogitoJobsServicePostgresqlImage.account) KOGITO_IMAGE_NAME=$(build-env kogitoJobsServicePostgresqlImage.name) KOGITO_IMAGE_TAG=$(build-env kogitoJobsServicePostgresqlImage.buildTag) QUARKUS_PLATFORM_VERSION=$(build-env quarkusPlatform.version) KOGITO_VERSION=$(build-env kogitoRuntime.version)" + }, + "devDependencies": { + "@kie-tools/python-venv": "workspace:*", + "@kie-tools/root-env": "workspace:*", + "@kie-tools/sonataflow-image-common": "workspace:*", + "cross-env": "^7.0.3", + "replace-in-file": "^7.1.0", + "rimraf": "^3.0.2", + "run-script-os": "^1.1.6" + }, + "kieTools": { + "requiredPreinstalledCliCommands": [ + "python3", + "make", + "s2i" + ] + } +} diff --git a/packages/kogito-jobs-service-postgresql-image/resources/incubator-kie-kogito-jobs-service-postgresql-image.yaml b/packages/kogito-jobs-service-postgresql-image/resources/incubator-kie-kogito-jobs-service-postgresql-image.yaml new file mode 100644 index 00000000000..8458b48a849 --- /dev/null +++ b/packages/kogito-jobs-service-postgresql-image/resources/incubator-kie-kogito-jobs-service-postgresql-image.yaml @@ -0,0 +1,67 @@ +# +# 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. +# +schema_version: 1 + +name: "docker.io/apache/incubator-kie-kogito-jobs-service-postgresql" +version: "main" +from: "registry.access.redhat.com/ubi8/openjdk-17-runtime:1.19" +description: "Runtime image for Kogito Jobs Service based on Postgresql" + +labels: + - name: "org.kie.kogito.version" + value: "### SET ME DURING BUILD PROCESS ###" + - name: "maintainer" + value: "Apache KIE " + - name: "io.k8s.description" + value: "Runtime image for Kogito Jobs Service based on Postgresql" + - name: "io.k8s.display-name" + value: "Kogito Jobs Service based on Postgresql" + - name: "io.openshift.tags" + value: "kogito,jobs-service-postgresql" + - name: "io.openshift.expose-services" + value: "8080:http" + +envs: + - name: "SCRIPT_DEBUG" + example: "true" + description: "If set to true, ensures that the bash scripts are executed with the -x option, printing the commands and their arguments as they are executed. Also debug JVM initialization." + - name: "ENABLE_EVENTS" + example: "true" + description: "By default Jobs Service doesn't integrate with message systems (e.g. Kafka). Set this variable to true to enable the events add-on." + +modules: + repositories: + - path: modules + install: + - name: org.kie.kogito.system.user + - name: org.kie.kogito.logging + - name: org.kie.kogito.dynamic.resources + - name: org.kie.kogito.launch.scripts + - name: org.kie.kogito.jobs.service.postgresql + - name: org.kie.kogito.security.custom.truststores + - name: org.kie.kogito.jobs.service.common + +ports: + - value: 8080 + +run: + workdir: "/home/kogito" + user: 1001 + cmd: + - "/home/kogito/kogito-app-launch.sh" diff --git a/packages/kogito-jobs-service-postgresql-image/resources/modules/kogito-jobs-service-postgresql/added/kogito-app-launch.sh b/packages/kogito-jobs-service-postgresql-image/resources/modules/kogito-jobs-service-postgresql/added/kogito-app-launch.sh new file mode 100644 index 00000000000..4ee5b43d62b --- /dev/null +++ b/packages/kogito-jobs-service-postgresql-image/resources/modules/kogito-jobs-service-postgresql/added/kogito-app-launch.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash +# +# 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. +# + + +#import +source "${KOGITO_HOME}"/launch/logging.sh + +if [ "${SCRIPT_DEBUG}" = "true" ] ; then + set -x + SHOW_JVM_SETTINGS="-XshowSettings:properties" + log_info "Script debugging is enabled, allowing bash commands and their arguments to be printed as they are executed" + log_info "JVM settings debug is enabled." + printenv +fi + +# Configuration scripts +# Any configuration script that needs to run on image startup must be added here. +CONFIGURE_SCRIPTS=( + "${KOGITO_HOME}"/launch/kogito-jobs-service-common.sh + "${KOGITO_HOME}"/launch/configure-custom-truststore.sh +) +source "${KOGITO_HOME}"/launch/configure.sh +############################################# + +DYNAMIC_RESOURCES_OPTS="$(${JBOSS_CONTAINER_JAVA_JVM_MODULE}/java-default-options) $(${JBOSS_CONTAINER_JAVA_JVM_MODULE}/debug-options)" + +# shellcheck disable=SC2086 +exec java ${SHOW_JVM_SETTINGS} ${DYNAMIC_RESOURCES_OPTS} ${JAVA_OPTIONS} ${KOGITO_JOBS_PROPS} ${CUSTOM_TRUSTSTORE_ARGS} \ + -Dquarkus.http.host=0.0.0.0 \ + -Dquarkus.http.port=8080 \ + -jar "${KOGITO_HOME}"/bin/postgresql/quarkus-app/quarkus-run.jar diff --git a/packages/kogito-jobs-service-postgresql-image/resources/modules/kogito-jobs-service-postgresql/configure b/packages/kogito-jobs-service-postgresql-image/resources/modules/kogito-jobs-service-postgresql/configure new file mode 100644 index 00000000000..10d0d252bfa --- /dev/null +++ b/packages/kogito-jobs-service-postgresql-image/resources/modules/kogito-jobs-service-postgresql/configure @@ -0,0 +1,26 @@ +#!/bin/sh +# +# 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. +# +set -e + +SCRIPT_DIR=$(dirname "${0}") +ADDED_DIR="${SCRIPT_DIR}"/added + +cp "${ADDED_DIR}"/kogito-app-launch.sh "${KOGITO_HOME}" +chmod +x-w "${KOGITO_HOME}"/kogito-app-launch.sh diff --git a/packages/kogito-jobs-service-postgresql-image/resources/modules/kogito-jobs-service-postgresql/module.yaml b/packages/kogito-jobs-service-postgresql-image/resources/modules/kogito-jobs-service-postgresql/module.yaml new file mode 100644 index 00000000000..6bdc6b692cc --- /dev/null +++ b/packages/kogito-jobs-service-postgresql-image/resources/modules/kogito-jobs-service-postgresql/module.yaml @@ -0,0 +1,31 @@ +# +# 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. +# +schema_version: 1 +name: org.kie.kogito.jobs.service.postgresql +version: "main" + +# see build-kogito-apps-components.sh script, responsible for build it. +# called by the Makefile before builds +artifacts: + - path: /tmp/build/jobs-service-postgresql + dest: /home/kogito/bin/postgresql + name: quarkus-app + +execute: + - script: configure diff --git a/packages/kogito-jobs-service-postgresql-image/test-resources/tests/features/kogito-jobs-service-common.feature b/packages/kogito-jobs-service-postgresql-image/test-resources/tests/features/kogito-jobs-service-common.feature new file mode 100644 index 00000000000..6c9ad4a7738 --- /dev/null +++ b/packages/kogito-jobs-service-postgresql-image/test-resources/tests/features/kogito-jobs-service-common.feature @@ -0,0 +1,31 @@ +# +# 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. +# + +@docker.io/apache/incubator-kie-kogito-jobs-service-postgresql +@docker.io/apache/incubator-kie-kogito-jobs-service-postgresql +@docker.io/apache/incubator-kie-kogito-jobs-service-postgresql +Feature: Kogito-jobs-service common feature. + + Scenario: verify if the events is correctly enabled + When container is started with env + | variable | value | + | SCRIPT_DEBUG | true | + | ENABLE_EVENTS | true | + | KOGITO_JOBS_PROPS | -Dkafka.bootstrap.servers=localhost:11111 | + Then container log should contain -Dkafka.bootstrap.servers=localhost:11111 -Dquarkus.profile=events-support -Dquarkus.http.host=0.0.0.0 -Dquarkus.http.port=8080 -jar diff --git a/packages/kogito-jobs-service-postgresql-image/test-resources/tests/features/kogito-jobs-service-postgresql.feature b/packages/kogito-jobs-service-postgresql-image/test-resources/tests/features/kogito-jobs-service-postgresql.feature new file mode 100644 index 00000000000..4c601a9d361 --- /dev/null +++ b/packages/kogito-jobs-service-postgresql-image/test-resources/tests/features/kogito-jobs-service-postgresql.feature @@ -0,0 +1,49 @@ +# +# 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. +# + +@docker.io/apache/incubator-kie-kogito-jobs-service-postgresql +Feature: Kogito-jobs-service-postgresql feature. + + Scenario: verify if all labels are correctly set kogito-jobs-service image image + Given image is built + Then the image should contain label maintainer with value Apache KIE + And the image should contain label io.openshift.expose-services with value 8080:http + And the image should contain label io.k8s.description with value Runtime image for Kogito Jobs Service based on Postgresql + And the image should contain label io.k8s.display-name with value Kogito Jobs Service based on Postgresql + And the image should contain label io.openshift.tags with value kogito,jobs-service-postgresql + + Scenario: Verify if the application jar exists + When container is started with command bash + Then run sh -c 'ls /home/kogito/bin/postgresql/quarkus-app/quarkus-run.jar' in container and immediately check its output for /home/kogito/bin/postgresql/quarkus-app/quarkus-run.jar + + Scenario: verify if container starts as expected + When container is started with env + | variable | value | + | SCRIPT_DEBUG | true | + | QUARKUS_LOG_LEVEL | DEBUG | + | QUARKUS_DATASOURCE_DB_KIND | postgresql | + | QUARKUS_DATASOURCE_USERNAME | test | + | QUARKUS_DATASOURCE_PASSWORD | 123456 | + | QUARKUS_DATASOURCE_JDBC_URL | jdbc:postgresql://10.11.12.13:5432/hibernate_orm_test | + Then container log should contain -Dquarkus.http.host=0.0.0.0 -Dquarkus.http.port=8080 -jar /home/kogito/bin/postgresql/quarkus-app/quarkus-run.jar + And container log should contain QUARKUS_DATASOURCE_DB_KIND=postgresql + And container log should contain QUARKUS_DATASOURCE_USERNAME=test + And container log should contain QUARKUS_DATASOURCE_PASSWORD=123456 + And container log should contain QUARKUS_DATASOURCE_JDBC_URL=jdbc:postgresql://10.11.12.13:5432/hibernate_orm_test + And container log should contain Trying to establish a protocol version 3 connection to 10.11.12.13:5432 diff --git a/packages/dev-deployment-kogito-quarkus-blank-app-image/pom.xml b/packages/maven-base/empty-pom.xml similarity index 51% rename from packages/dev-deployment-kogito-quarkus-blank-app-image/pom.xml rename to packages/maven-base/empty-pom.xml index 5a9e0af1ed2..b11bb7a085d 100644 --- a/packages/dev-deployment-kogito-quarkus-blank-app-image/pom.xml +++ b/packages/maven-base/empty-pom.xml @@ -1,4 +1,4 @@ - + + --> 4.0.0 - org.kie.kogito - dev-deployment-kogito-quarkus-blank-app-image - ${revision} - - - - - org.kie - kie-tools-maven-base - ${project.version} - pom - - + + org.apache.kie + kie-tools-maven-base-empty-pom + 0.0.0-SNAPSHOT diff --git a/packages/maven-base/env/index.js b/packages/maven-base/env/index.js index 96c5d8d4e6f..71670217a09 100644 --- a/packages/maven-base/env/index.js +++ b/packages/maven-base/env/index.js @@ -31,6 +31,9 @@ module.exports = composeEnv([require("@kie-tools/root-env/env")], { mavenBase: { version: require("../package.json").version, }, + mvnw: { + version: "3.3.0", + }, maven: { deploy: { skip: getOrDefault(this.vars.KIE_TOOLS_BUILD__mavenDeploySkip), diff --git a/packages/maven-base/index.js b/packages/maven-base/index.js new file mode 100755 index 00000000000..54fa2ee5da0 --- /dev/null +++ b/packages/maven-base/index.js @@ -0,0 +1,211 @@ +/* + * 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 cp = require("child_process"); +const fs = require("fs"); +const path = require("path"); +const { env } = require("./env"); + +// Constants relative to consumer packages. +const MVN_CONFIG_ORIGINAL_FILE_PATH = path.join(".mvn", "maven.config.original"); +const MVN_CONFIG_FILE_PATH = path.join(".mvn", "maven.config"); + +// This package's constants. +const EMPTY_POM_XML_PATH = path.join(__dirname, "empty-pom.xml"); +const SETTINGS_XML_PATH = path.join(__dirname, "settings.xml"); + +const DEFAULT_MAVEN_CONFIG = ` +-Dstyle.color=always +--batch-mode +--settings=${SETTINGS_XML_PATH} +`.trim(); + +const DEFAULT_LOCAL_REPO = String( + cp.execSync(`mvn help:evaluate -Dexpression=settings.localRepository -q -DforceStdout -f ${EMPTY_POM_XML_PATH}`, { + stdio: "pipe", + encoding: "utf-8", + }) +).trim(); + +const BOOTSTRAP_CLI_ARGS = `-P-include-1st-party-dependencies --settings=${SETTINGS_XML_PATH}`; + +module.exports = { + /** + * Evaluation of ${settings.localRepository}. + */ + DEFAULT_LOCAL_REPO, + + /** + * Maven CLI arguments to be passed for `mvn` commands running during `bootstrap` phase. + */ + BOOTSTRAP_CLI_ARGS, + + /** + * An absolute path for an empty POM, in case someone needs to run `mvn` scripts without having a pom.xml file. + */ + EMPTY_POM_XML_PATH, + + /** + * Installs `mvnw` on the same directory of invocation. + * */ + installMvnw: () => { + console.info(`[maven-base] Installing mvnw...`); + console.time(`[maven-base] Installing mvnw...`); + + const cmd = `mvn -e org.apache.maven.plugins:maven-wrapper-plugin:${env.mvnw.version}:wrapper ${BOOTSTRAP_CLI_ARGS}`; + + if (process.platform === "win32") { + cp.execSync(cmd.replaceAll(" -", " `-"), { stdio: "inherit", shell: "powershell.exe" }); + } else { + cp.execSync(cmd, { stdio: "inherit" }); + } + + console.timeEnd(`[maven-base] Installing mvnw...`); + }, + + /** + * Helps setting up an array of absolute paths that will be used to configure `-Dmaven.repo.local.tail`. + * + * @param dirname Where to locate the first package.json. + * + * @returns A comma-separated string containing a flat list of absolute paths of local Maven repositories. + */ + buildTailFromPackageJsonDependencies: (dirname) => { + return deepResolveMavenLocalRepoTail(path.resolve(dirname ?? ".")).join(","); + }, + + /** + * Builds a single Maven repository directory out of multiple local Maven repositories using hard links. + * + * @param tmpM2Dir Relative path of this new Maven repository directory. It will be deleted and recreated for each invocation. + * @param dirname A list of paths representing additional Maven repository directories, to be concatenated the default one (I.e, `maven.repo.local`) + * */ + prepareHardLinkedM2ForPackage: (tmpM2Dir, relativePackagePath) => { + const resolvedTmpM2Dir = path.resolve(tmpM2Dir); + if (fs.existsSync(resolvedTmpM2Dir)) { + fs.rmSync(resolvedTmpM2Dir, { recursive: true, force: true }); + } + fs.mkdirSync(resolvedTmpM2Dir, { recursive: true }); + + // head + cp.execSync(`cp -nal ${DEFAULT_LOCAL_REPO}/* ${resolvedTmpM2Dir}`, { stdio: "inherit" }); + + const cwd = path.resolve(".", relativePackagePath); + const packageName = require(path.resolve(cwd, "package.json")).name; + const tail = deepResolveMavenLocalRepoTail(cwd, packageName); + + // tail + for (const t of tail) { + if (fs.existsSync(path.resolve(t))) { + cp.execSync(`cp -al ${path.resolve(t)}/* ${resolvedTmpM2Dir}`, { stdio: "inherit" }); + } + } + }, + + /** + * Sets a property on a POM. + * + * @param entry An object with `key` and `value` properties + */ + setPomProperty: ({ key, value }) => { + if (!key || value === undefined) { + console.error("[maven-base] Can't set a POM property without proper `key` and `value`."); + process.exit(1); + } + + console.info(`[maven-base] Setting property '${key}' with value '${value}'...`); + console.time(`[maven-base] Setting property '${key}' with value '${value}'...`); + + const cmd = `mvn versions:set-property -Dproperty=${key} -DnewVersion=${value} -DgenerateBackupPoms=false ${BOOTSTRAP_CLI_ARGS}`; + + if (process.platform === "win32") { + cp.execSync(cmd.replaceAll(" -", " `-"), { stdio: "inherit", shell: "powershell.exe" }); + } else { + cp.execSync(cmd, { stdio: "inherit" }); + } + + console.timeEnd(`[maven-base] Setting property '${key}' with value '${value}'...`); + }, + + /** + * Writes to `.mvn/maven.config` idempotently, preserving what was there before this function was called. + * + * @param mavenConfigString New-line-separated string containing arguments to the `mvn` command. + * @param args An object with a `ignoreDefault: boolean` property. + */ + setupMavenConfigFile: (mavenConfigString, args) => { + console.info(`[maven-base] Configuring Maven through .mvn/maven.config...`); + console.time(`[maven-base] Configuring Maven through .mvn/maven.config...`); + + let originalMvnConfigString; + if (fs.existsSync(MVN_CONFIG_ORIGINAL_FILE_PATH)) { + console.info(`[maven-base] Found '${MVN_CONFIG_ORIGINAL_FILE_PATH}'.`); + originalMvnConfigString = fs.readFileSync(MVN_CONFIG_ORIGINAL_FILE_PATH, "utf-8"); + } else if (fs.existsSync(MVN_CONFIG_FILE_PATH)) { + console.info(`[maven-base] Found '${MVN_CONFIG_FILE_PATH}'.`); + originalMvnConfigString = fs.readFileSync(MVN_CONFIG_FILE_PATH, "utf-8"); + } else { + console.info(`[maven-base] No previous config found.`); + originalMvnConfigString = ""; + } + + fs.mkdirSync(".mvn", { recursive: true }); + + console.info(`[maven-base] Writing '${MVN_CONFIG_ORIGINAL_FILE_PATH}'...`); + console.info(`${originalMvnConfigString}` || ""); + fs.writeFileSync(MVN_CONFIG_ORIGINAL_FILE_PATH, originalMvnConfigString); + + const trimmedMavenConfigString = mavenConfigString + .trim() + .split("\n") + .map((l) => l.trim()) + .join("\n"); + + const newMavenConfigString = `${originalMvnConfigString ? `\n${originalMvnConfigString}\n` : ``} +${trimmedMavenConfigString.trim()}`; + + console.info(`[maven-base] Writing '${MVN_CONFIG_FILE_PATH}'...`); + console.info(newMavenConfigString); + + const defaultMavenConfigString = args?.ignoreDefault + ? "" + : ` + +${DEFAULT_MAVEN_CONFIG}`; + + fs.writeFileSync(MVN_CONFIG_FILE_PATH, `${newMavenConfigString}${defaultMavenConfigString}`); + console.timeEnd(`[maven-base] Configuring Maven through .mvn/maven.config...`); + }, +}; + +// private functions + +function deepResolveMavenLocalRepoTail(cwd) { + const packageJsonDependencies = require(path.resolve(cwd, "package.json")).dependencies ?? {}; + return [ + ...new Set([ + path.resolve(fs.realpathSync(cwd), "dist/1st-party-m2/repository"), + ...Object.entries(packageJsonDependencies).flatMap(([depName, depVersion]) => + depVersion === "workspace:*" // It's an internal package. + ? deepResolveMavenLocalRepoTail(cwd + "/node_modules/" + depName) + : [] + ), + ]), + ]; +} diff --git a/packages/maven-base/install.js b/packages/maven-base/mvn.bootstrap.js similarity index 63% rename from packages/maven-base/install.js rename to packages/maven-base/mvn.bootstrap.js index a34033bc954..db247ab4ba5 100644 --- a/packages/maven-base/install.js +++ b/packages/maven-base/mvn.bootstrap.js @@ -17,9 +17,22 @@ * under the License. */ -const buildEnv = require("./env"); -const { setup } = require("@kie-tools/maven-config-setup-helper"); +const { env } = require("./env"); +const { setupMavenConfigFile, setPomProperty, buildTailFromPackageJsonDependencies } = require("."); -setup(` - -Drevision=${buildEnv.env.mavenBase.version} -`); +setupMavenConfigFile( + ` + -Drevision=${env.mavenBase.version} + -Dmaven.repo.local.tail=${buildTailFromPackageJsonDependencies()} +` +); + +setPomProperty({ + key: "version.org.kie.kogito", + value: env.kogitoRuntime.version, +}); + +setPomProperty({ + key: "quarkus.platform.version", + value: env.quarkusPlatform.version, +}); diff --git a/packages/maven-base/package.json b/packages/maven-base/package.json index 8af3e3cbf2f..4d4ca7af6e1 100644 --- a/packages/maven-base/package.json +++ b/packages/maven-base/package.json @@ -15,22 +15,15 @@ "scripts": { "build:dev": "run-script-os", "build:dev:darwin:linux": "mvn clean install -DskipTests", - "build:dev:win32": "pnpm powershell \"mvn clean install -DskipTests \"", + "build:dev:win32": "pnpm powershell \"mvn clean install `-DskipTests\"", "build:prod": "pnpm lint && run-script-os", - "build:prod:darwin:linux": "mvn clean deploy -DdeployAtEnd -DskipTests=$(build-env tests.run --not) -Dmaven.test.failure.ignore=$(build-env tests.ignoreFailures) -Dmaven.deploy.skip=$(build-env maven.deploy.skip) -Dreproducible", - "build:prod:win32": "pnpm powershell \"mvn clean deploy `-DdeployAtEnd `-DskipTests `-Dmaven.test.failure.ignore=$(build-env tests.ignoreFailures) `-Dmaven.deploy.skip=$(build-env maven.deploy.skip) `-Dreproducible\"", - "install": "pnpm set-quarkus-version && pnpm set-kogito-version && node install.js", + "build:prod:darwin:linux": "mvn clean deploy -DskipTests=$(build-env tests.run --not) -Dmaven.test.failure.ignore=$(build-env tests.ignoreFailures) -Dmaven.deploy.skip=$(build-env maven.deploy.skip) -Dreproducible", + "build:prod:win32": "pnpm powershell \"mvn clean deploy `-DskipTests `-Dmaven.test.failure.ignore=$(build-env tests.ignoreFailures) `-Dmaven.deploy.skip=$(build-env maven.deploy.skip) `-Dreproducible\"", + "install": "node mvn.bootstrap.js && pnpm build:dev", "lint": "echo 'Linting'", - "powershell": "@powershell -NoProfile -ExecutionPolicy Unrestricted -Command", - "set-kogito-version": "run-script-os", - "set-kogito-version:darwin:linux": "mvn versions:set-property -Dproperty=version.org.kie.kogito -DnewVersion=$(build-env kogitoRuntime.version)", - "set-kogito-version:win32": "pnpm powershell \"mvn versions:set-property `-Dproperty=version.org.kie.kogito `-DnewVersion=$(build-env kogitoRuntime.version)\"", - "set-quarkus-version": "run-script-os", - "set-quarkus-version:darwin:linux": "mvn versions:set-property -Dproperty=quarkus.platform.version -DnewVersion=$(build-env quarkusPlatform.version)", - "set-quarkus-version:win32": "pnpm powershell \"mvn versions:set-property `-Dproperty=quarkus.platform.version `-DnewVersion=$(build-env quarkusPlatform.version)\"" + "powershell": "@powershell -NoProfile -ExecutionPolicy Unrestricted -Command" }, "devDependencies": { - "@kie-tools/maven-config-setup-helper": "workspace:*", "@kie-tools/root-env": "workspace:*", "run-script-os": "^1.1.6" }, diff --git a/packages/maven-base/pom.xml b/packages/maven-base/pom.xml index 39104bcd1bb..7ef9194ebe4 100644 --- a/packages/maven-base/pom.xml +++ b/packages/maven-base/pom.xml @@ -96,23 +96,35 @@ - 2024-01-12T00:00:00Z - 3.4.1 17 17 - true UTF-8 UTF-8 - 3.13.0 - 3.2.0 - 1.6.0 + + + 2024-01-12T00:00:00Z + true + + + 3.4.1 + 3.13.0 + 3.2.0 + 3.0.0-M7 + 3.5.0 + 3.1.3 + 3.1.2 + 3.12.1 + 3.6.1 + 3.4.1 + 3.2.0 + 3.4.0 + 1.6.0 + + 4.13.2 - 3.5.0 3.8.6 + 999-20240912-SNAPSHOT - ${quarkus.platform.version} - io.quarkus - 3.0.0-M7 @@ -163,27 +175,80 @@ + org.apache.maven.plugins maven-artifact-plugin ${version.maven.artifact.plugin} ${project.build.outputTimestamp} - ${session.executionRootDirectory}/node_modules/@kie-tools/maven-base/not-reproducible-plugins.properties + + org.apache.maven.plugins + maven-install-plugin + ${version.maven.install.plugin} + + + org.apache.maven.plugins + maven-deploy-plugin + ${version.maven.deploy.plugin} + + + org.apache.maven.plugins + maven-dependency-plugin + ${version.maven.dependency.plugin} + + + org.apache.maven.plugins + maven-compiler-plugin + ${version.maven.compiler.plugin} + + + org.apache.maven.plugins + maven-failsafe-plugin + ${version.maven.failsafe.plugin} + + + org.apache.maven.plugins + maven-clean-plugin + ${version.maven.clean.plugin} + + + org.apache.maven.plugins + maven-surefire-plugin + ${version.maven.surefire.plugin} + + + org.apache.maven.plugins + maven-jar-plugin + ${version.maven.jar.plugin} + + + org.apache.maven.plugins + maven-remote-resources-plugin + ${version.maven.remote.resources.plugin} + + + org.codehaus.mojo + flatten-maven-plugin + ${version.codehaus.flatten.plugin} + + + + + org.codehaus.mojo flatten-maven-plugin - ${version.flatten.plugin} true resolveCiFriendliesOnly @@ -205,8 +270,10 @@ + + + - org.apache.maven.plugins maven-source-plugin @@ -227,6 +294,88 @@ + + + + + use-maven-repo-local-tail + + + + + kieTools.do-not-use-this-property.ignoreMavenRepoLocalTail + !true + + + + + + + + + + + org.apache.maven.plugins + maven-install-plugin + ${version.maven.install.plugin} + + true + + + + + + + + + + maven-clean-plugin + + + + ${basedir}/dist/1st-party-m2 + + **/* + + false + + + + + + clean + + clean + + + + + + + + + maven-deploy-plugin + + + deploy-to-local-dist-1st-party-m2 + install + + deploy + + + false + kie-tools--local-dist-1st-party-m2::file://${maven.multiModuleProjectDirectory}/dist/1st-party-m2/repository + + + + + + + + + + reproducible-build @@ -238,7 +387,6 @@ - org.apache.maven.plugins maven-artifact-plugin @@ -247,8 +395,11 @@ check-buildplan - + validate @@ -256,8 +407,11 @@ compare - + install diff --git a/packages/maven-base/settings.xml b/packages/maven-base/settings.xml new file mode 100644 index 00000000000..7b260596554 --- /dev/null +++ b/packages/maven-base/settings.xml @@ -0,0 +1,101 @@ + + + + apache-public-repository-group-mirror-to-central + apache-public-repository-group + https://repo.maven.apache.org/maven2 + + + jboss-public-repository-group-mirror-to-central + jboss-public-repository-group + https://repo.maven.apache.org/maven2 + + + jboss-enterprise-maven-repository-mirror-to-central + jboss-enterprise-maven-repository + https://repo.maven.apache.org/maven2 + + + + + + kie-tools--default-repos + + + ignore--kie-tools--default-repos + !true + + + + + apache.snapshots + Apache Snapshot Repository + https://repository.apache.org/snapshots + + false + + + true + never + + + + central + Central Repository + https://repo.maven.apache.org/maven2 + + false + + + + apache-public-repository-group + Apache Public Repository Group + https://repo.maven.apache.org/maven2 + default + + false + never + + + false + never + + + + jboss-public-repository-group + JBOSS Public Repository Group + https://repo.maven.apache.org/maven2 + default + + false + never + + + false + never + + + + + + apache-public-repository-group + Apache Public Repository Group + https://repository.apache.org/content/groups/public/ + default + + false + never + + + false + never + + + + + + diff --git a/packages/maven-config-setup-helper/README.md b/packages/maven-config-setup-helper/README.md deleted file mode 100644 index c056b4b62fb..00000000000 --- a/packages/maven-config-setup-helper/README.md +++ /dev/null @@ -1,48 +0,0 @@ - - -## @kie-tools/maven-config-setup-helper - -This package helps to write `.mvn/maven.config` file idempotently without loosing its previous value. - -It achieves that by creating a copy of the original file at `.mvn/maven.config.original`, so when writing to `.mvn/maven.config`, it combines the original file with the new contents. - ---- - -Apache KIE (incubating) is an effort undergoing incubation at The Apache Software -Foundation (ASF), sponsored by the name of Apache Incubator. Incubation is -required of all newly accepted projects until a further review indicates that -the infrastructure, communications, and decision making process have stabilized -in a manner consistent with other successful ASF projects. While incubation -status is not necessarily a reflection of the completeness or stability of the -code, it does indicate that the project has yet to be fully endorsed by the ASF. - -Some of the incubating project’s releases may not be fully compliant with ASF -policy. For example, releases may have incomplete or un-reviewed licensing -conditions. What follows is a list of known issues the project is currently -aware of (note that this list, by definition, is likely to be incomplete): - -- Hibernate, an LGPL project, is being used. Hibernate is in the process of - relicensing to ASL v2 -- Some files, particularly test files, and those not supporting comments, may - be missing the ASF Licensing Header - -If you are planning to incorporate this work into your product/project, please -be aware that you will need to conduct a thorough licensing review to determine -the overall implications of including this work. For the current status of this -project through the Apache Incubator visit: -https://incubator.apache.org/projects/kie.html diff --git a/packages/maven-config-setup-helper/index.js b/packages/maven-config-setup-helper/index.js deleted file mode 100755 index 8612c0ce73e..00000000000 --- a/packages/maven-config-setup-helper/index.js +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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"); -const fs = require("fs"); -const path = require("path"); - -const MVN_CONFIG_ORIGINAL_FILE_PATH = path.join(".mvn", "maven.config.original"); -const MVN_CONFIG_FILE_PATH = path.join(".mvn", "maven.config"); - -module.exports = { - setPomProperty: ({ key, value }) => { - if (!key || !value) { - console.error("[maven-config-setup-helper] Wrong values provided"); - process.exit(1); - } - - if (process.platform === "win32") { - execSync(`mvn versions:set-property \`-Dproperty=${key} \`-DnewVersion=${value} \`-DgenerateBackupPoms=false`, { - stdio: "inherit", - shell: "powershell.exe", - }); - } else { - execSync(`mvn versions:set-property -Dproperty=${key} -DnewVersion=${value} -DgenerateBackupPoms=false`, { - stdio: "inherit", - }); - } - }, - setup: (mavenConfigString) => { - let originalMvnConfigString; - if (fs.existsSync(MVN_CONFIG_ORIGINAL_FILE_PATH)) { - console.info(`[maven-config-setup-helper] Found '${MVN_CONFIG_ORIGINAL_FILE_PATH}'.`); - originalMvnConfigString = fs.readFileSync(MVN_CONFIG_ORIGINAL_FILE_PATH, "utf-8"); - } else if (fs.existsSync(MVN_CONFIG_FILE_PATH)) { - console.info(`[maven-config-setup-helper] Found '${MVN_CONFIG_FILE_PATH}'.`); - originalMvnConfigString = fs.readFileSync(MVN_CONFIG_FILE_PATH, "utf-8"); - } else { - console.info(`[maven-config-setup-helper] No previous config found.`); - originalMvnConfigString = ""; - } - - fs.mkdirSync(".mvn", { recursive: true }); - - console.info(`[maven-config-setup-helper] Writing '${MVN_CONFIG_ORIGINAL_FILE_PATH}'...`); - console.info(`${originalMvnConfigString}` || ""); - fs.writeFileSync(MVN_CONFIG_ORIGINAL_FILE_PATH, originalMvnConfigString); - - const trimmedMavenConfigString = mavenConfigString - .trim() - .split("\n") - .map((l) => l.trim()) - .join("\n"); - - const newMavenConfigString = `${originalMvnConfigString.trim()}\n${trimmedMavenConfigString.trim()}`.trim(); - console.info(`[maven-config-setup-helper] Writing '${MVN_CONFIG_FILE_PATH}'...`); - console.info(newMavenConfigString); - fs.writeFileSync(MVN_CONFIG_FILE_PATH, newMavenConfigString); - - console.info(`[maven-config-setup-helper] Done.`); - }, -}; diff --git a/packages/maven-config-setup-helper/package.json b/packages/maven-config-setup-helper/package.json deleted file mode 100644 index 626e6ddf24d..00000000000 --- a/packages/maven-config-setup-helper/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "private": true, - "name": "@kie-tools/maven-config-setup-helper", - "version": "0.0.0", - "description": "", - "license": "Apache-2.0", - "keywords": [], - "homepage": "https://github.com/apache/incubator-kie-tools", - "repository": { - "type": "git", - "url": "https://github.com/apache/incubator-kie-tools.git" - }, - "bugs": { - "url": "https://github.com/apache/incubator-kie-tools/issues" - }, - "files": [ - "index.js" - ], - "scripts": {}, - "devDependencies": {} -} diff --git a/packages/maven-m2-repo-via-http-image/env/index.js b/packages/maven-m2-repo-via-http-image/env/index.js index d989c25bd14..b5b8f0393be 100644 --- a/packages/maven-m2-repo-via-http-image/env/index.js +++ b/packages/maven-m2-repo-via-http-image/env/index.js @@ -46,7 +46,7 @@ module.exports = composeEnv([rootEnv], { registry: getOrDefault(this.vars.MAVEN_M2_REPO_VIA_HTTP_IMAGE__registry), account: getOrDefault(this.vars.MAVEN_M2_REPO_VIA_HTTP_IMAGE__account), name: getOrDefault(this.vars.MAVEN_M2_REPO_VIA_HTTP_IMAGE__name), - tag: getOrDefault(this.vars.MAVEN_M2_REPO_VIA_HTTP_IMAGE__buildTag), + buildTag: getOrDefault(this.vars.MAVEN_M2_REPO_VIA_HTTP_IMAGE__buildTag), }, }; }, diff --git a/packages/maven-m2-repo-via-http-image/package.json b/packages/maven-m2-repo-via-http-image/package.json index 4fc49abc485..342622b2cd4 100644 --- a/packages/maven-m2-repo-via-http-image/package.json +++ b/packages/maven-m2-repo-via-http-image/package.json @@ -16,7 +16,7 @@ "build": "run-script-if --bool \"$(build-env containerImages.build)\" --then \"pnpm image:docker:build\"", "build:dev": "pnpm build", "build:prod": "pnpm build", - "image:docker:build": "kie-tools--image-builder build -r \"$(build-env mavenM2RepoViaHttpImage.registry)\" -a \"$(build-env mavenM2RepoViaHttpImage.account)\" -n \"$(build-env mavenM2RepoViaHttpImage.name)\" -t \"$(build-env mavenM2RepoViaHttpImage.tag)\"" + "image:docker:build": "kie-tools--image-builder build -r \"$(build-env mavenM2RepoViaHttpImage.registry)\" -a \"$(build-env mavenM2RepoViaHttpImage.account)\" -n \"$(build-env mavenM2RepoViaHttpImage.name)\" -t \"$(build-env mavenM2RepoViaHttpImage.buildTag)\"" }, "devDependencies": { "@kie-tools/image-builder": "workspace:*", diff --git a/packages/online-editor/build/defaultEnvJson.ts b/packages/online-editor/build/defaultEnvJson.ts index 5c06712afec..55d0a27e9d4 100644 --- a/packages/online-editor/build/defaultEnvJson.ts +++ b/packages/online-editor/build/defaultEnvJson.ts @@ -19,13 +19,13 @@ import { EnvJson } from "../src/env/EnvJson"; import { routes } from "../src/navigation/Routes"; +import { AuthProviderGroup, AuthProviderType } from "../src/authProviders/AuthProvidersApi"; +import { FileTypes } from "@kie-tools-core/workspaces-git-fs/dist/constants/ExtensionHelper"; +import { GLOB_PATTERN } from "../src/envelopeLocator/EditorEnvelopeLocatorFactory"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore import { env } from "../env"; -import { AuthProviderGroup, AuthProviderType } from "../src/authProviders/AuthProvidersApi"; -import { FileTypes } from "@kie-tools-core/workspaces-git-fs/dist/constants/ExtensionHelper"; -import { GLOB_PATTERN } from "../src/envelopeLocator/EditorEnvelopeLocatorFactory"; const buildEnv: any = env; // build-env is not typed function getDevDeploymentImageUrl(imageEnvVars: any) { diff --git a/packages/online-editor/playwright.config.ts b/packages/online-editor/playwright.config.ts index 911125dffa2..3c1ac8f65ee 100644 --- a/packages/online-editor/playwright.config.ts +++ b/packages/online-editor/playwright.config.ts @@ -20,9 +20,9 @@ import { defineConfig } from "@playwright/test"; import playwirghtBaseConfig from "@kie-tools/playwright-base/playwright.config"; import merge from "lodash/merge"; -import { env } from "./env"; -const buildEnv: any = env; +import { env } from "./env"; +const buildEnv: any = env; // build-env is not typed const customConfig = defineConfig({ expect: { diff --git a/packages/online-editor/webpack.config.ts b/packages/online-editor/webpack.config.ts index 30d4a58ea8f..0ac197a7e27 100644 --- a/packages/online-editor/webpack.config.ts +++ b/packages/online-editor/webpack.config.ts @@ -37,7 +37,7 @@ import HtmlReplaceWebpackPlugin from "html-replace-webpack-plugin"; import { env } from "./env"; const buildEnv: any = env; // build-env is not typed -export default async (env: any, argv: any) => { +export default async (webpackEnv: any, webpackArgv: any) => { const buildInfo = getBuildInfo(); const [ extendedServices_linuxDownloadUrl, @@ -56,7 +56,7 @@ export default async (env: any, argv: any) => { } return [ - merge(common(env), { + merge(common(webpackEnv), { entry: { "workspace/worker/sharedWorker": "./src/workspace/worker/sharedWorker.ts", }, @@ -77,7 +77,7 @@ export default async (env: any, argv: any) => { ], }), { - ...merge(common(env), { + ...merge(common(webpackEnv), { entry: { index: "./src/index.tsx", "bpmn-envelope": "./src/envelope/BpmnEditorEnvelopeApp.ts", diff --git a/packages/pmml-editor/dev-webapp/webpack.config.js b/packages/pmml-editor/dev-webapp/webpack.config.js index c7e17860336..dadf2bdd805 100644 --- a/packages/pmml-editor/dev-webapp/webpack.config.js +++ b/packages/pmml-editor/dev-webapp/webpack.config.js @@ -23,10 +23,9 @@ const { merge } = require("webpack-merge"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const patternflyBase = require("@kie-tools-core/patternfly-base"); const { env } = require("../env"); -const buildEnv = env; -module.exports = (env) => - merge(common(env), { +module.exports = (webpackEnv) => + merge(common(webpackEnv), { mode: "development", entry: { index: path.resolve(__dirname, "./index.tsx"), @@ -67,7 +66,7 @@ module.exports = (env) => }, historyApiFallback: true, compress: true, - port: buildEnv.pmmlEditor.dev.port, + port: env.pmmlEditor.dev.port, open: false, hot: true, }, diff --git a/packages/pmml-vscode-extension/webpack.config.js b/packages/pmml-vscode-extension/webpack.config.js index 3c0d90d0e31..b7408cc7d8a 100644 --- a/packages/pmml-vscode-extension/webpack.config.js +++ b/packages/pmml-vscode-extension/webpack.config.js @@ -22,8 +22,8 @@ const { merge } = require("webpack-merge"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const { ProvidePlugin } = require("webpack"); -const commonConfig = (env) => - merge(common(env), { +const commonConfig = (webpackEnv) => + merge(common(webpackEnv), { output: { library: "PmmlEditor", libraryTarget: "umd", @@ -35,14 +35,14 @@ const commonConfig = (env) => }, }); -module.exports = async (env) => [ - merge(commonConfig(env), { +module.exports = async (webpackEnv) => [ + merge(commonConfig(webpackEnv), { target: "node", entry: { "extension/extension": "./src/extension/extension.ts", }, }), - merge(commonConfig(env), { + merge(commonConfig(webpackEnv), { target: "webworker", entry: { "extension/extensionWeb": "./src/extension/extension.ts", @@ -54,7 +54,7 @@ module.exports = async (env) => [ }), ], }), - merge(commonConfig(env), { + merge(commonConfig(webpackEnv), { target: "web", entry: { "webview/PmmlEditorEnvelopeApp": "./src/webview/PmmlEditorEnvelopeApp.ts", diff --git a/packages/runtime-tools-management-console-webapp/build/defaultEnvJson.js b/packages/runtime-tools-management-console-webapp/build/defaultEnvJson.js index 3f723e0772a..ad06a77878c 100644 --- a/packages/runtime-tools-management-console-webapp/build/defaultEnvJson.js +++ b/packages/runtime-tools-management-console-webapp/build/defaultEnvJson.js @@ -17,17 +17,16 @@ * under the License. */ -const { env: buildEnv } = require("../env"); +const { env } = require("../env"); const version = require("../package.json").version; module.exports = { defaultEnvJson: { - RUNTIME_TOOLS_MANAGEMENT_CONSOLE_KOGITO_ENV_MODE: buildEnv.runtimeToolsManagementConsoleWebapp.kogitoEnvMode, + RUNTIME_TOOLS_MANAGEMENT_CONSOLE_KOGITO_ENV_MODE: env.runtimeToolsManagementConsoleWebapp.kogitoEnvMode, RUNTIME_TOOLS_MANAGEMENT_CONSOLE_KOGITO_APP_NAME: "Management Console", RUNTIME_TOOLS_MANAGEMENT_CONSOLE_KOGITO_APP_VERSION: version, - RUNTIME_TOOLS_MANAGEMENT_CONSOLE_DATA_INDEX_ENDPOINT: - buildEnv.runtimeToolsManagementConsoleWebapp.kogitoDataIndexUrl, + RUNTIME_TOOLS_MANAGEMENT_CONSOLE_DATA_INDEX_ENDPOINT: env.runtimeToolsManagementConsoleWebapp.kogitoDataIndexUrl, KOGITO_CONSOLES_KEYCLOAK_DISABLE_HEALTH_CHECK: false, KOGITO_CONSOLES_KEYCLOAK_UPDATE_TOKEN_VALIDITY: 30, KOGITO_CONSOLES_KEYCLOAK_HEALTH_CHECK_URL: diff --git a/packages/runtime-tools-management-console-webapp/webpack.config.js b/packages/runtime-tools-management-console-webapp/webpack.config.js index 6083334a7bd..51d6ed79352 100644 --- a/packages/runtime-tools-management-console-webapp/webpack.config.js +++ b/packages/runtime-tools-management-console-webapp/webpack.config.js @@ -22,13 +22,13 @@ const { merge } = require("webpack-merge"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const HtmlWebpackPlugin = require("html-webpack-plugin"); const CopyPlugin = require("copy-webpack-plugin"); -const { env: buildEnv } = require("./env"); +const { env } = require("./env"); const { defaultEnvJson } = require("./build/defaultEnvJson"); const BG_IMAGES_DIRNAME = "bgimages"; -module.exports = async (env) => { - return merge(common(env), { +module.exports = async (webpackEnv) => { + return merge(common(webpackEnv), { entry: { index: path.resolve(__dirname, "src", "index.tsx"), }, @@ -36,8 +36,8 @@ module.exports = async (env) => { static: { directory: "./dist", }, - host: buildEnv.runtimeToolsManagementConsoleWebapp.host, - port: buildEnv.runtimeToolsManagementConsoleWebapp.port, + host: env.runtimeToolsManagementConsoleWebapp.host, + port: env.runtimeToolsManagementConsoleWebapp.port, compress: true, historyApiFallback: true, hot: true, diff --git a/packages/runtime-tools-process-dev-ui-webapp/webpack.config.js b/packages/runtime-tools-process-dev-ui-webapp/webpack.config.js index 62e07c79c02..7cf0e739beb 100644 --- a/packages/runtime-tools-process-dev-ui-webapp/webpack.config.js +++ b/packages/runtime-tools-process-dev-ui-webapp/webpack.config.js @@ -28,12 +28,11 @@ const NodePolyfillPlugin = require("node-polyfill-webpack-plugin"); const { merge } = require("webpack-merge"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const HtmlReplaceWebpackPlugin = require("html-replace-webpack-plugin"); +const { env } = require("./env"); -const { env: buildEnv } = require("./env"); - -module.exports = async (env) => { - const dataIndexURL = buildEnv.runtimeToolsProcessDevUIWebapp.kogitoDataIndexUrl; - return merge(common(env), { +module.exports = async (webpackEnv) => { + const dataIndexURL = env.runtimeToolsProcessDevUIWebapp.kogitoDataIndexUrl; + return merge(common(webpackEnv), { entry: { standalone: path.resolve(__dirname, "src", "standalone", "standalone.ts"), envelope: path.resolve(__dirname, "src", "standalone", "EnvelopeApp.ts"), @@ -43,7 +42,7 @@ module.exports = async (env) => { static: { directory: "./dist", }, - port: buildEnv.runtimeToolsProcessDevUIWebapp.port, + port: env.runtimeToolsProcessDevUIWebapp.port, compress: true, historyApiFallback: true, hot: true, @@ -69,7 +68,7 @@ module.exports = async (env) => { KOGITO_APP_VERSION: "DEV", KOGITO_APP_NAME: "Runtime tools dev-ui", KOGITO_DATAINDEX_HTTP_URL: dataIndexURL, - KOGITO_REMOTE_KOGITO_APP_URL: buildEnv.runtimeToolsProcessDevUIWebapp.kogitoAppUrl, + KOGITO_REMOTE_KOGITO_APP_URL: env.runtimeToolsProcessDevUIWebapp.kogitoAppUrl, }), new CopyPlugin({ patterns: [ @@ -99,11 +98,11 @@ module.exports = async (env) => { new HtmlReplaceWebpackPlugin([ { pattern: /\${WEBPACK_REPLACEMENT_WEBAPP_HOST}/g, - replacement: () => buildEnv.runtimeToolsProcessDevUIWebapp.host ?? "", + replacement: () => env.runtimeToolsProcessDevUIWebapp.host ?? "", }, { pattern: /\${WEBPACK_REPLACEMENT_WEBAPP_PORT}/g, - replacement: () => buildEnv.runtimeToolsProcessDevUIWebapp.port ?? "", + replacement: () => env.runtimeToolsProcessDevUIWebapp.port ?? "", }, ]), ], diff --git a/packages/runtime-tools-task-console-webapp/build/defaultEnvJson.js b/packages/runtime-tools-task-console-webapp/build/defaultEnvJson.js index 399e6b5c929..1dfbfde3c21 100644 --- a/packages/runtime-tools-task-console-webapp/build/defaultEnvJson.js +++ b/packages/runtime-tools-task-console-webapp/build/defaultEnvJson.js @@ -17,18 +17,18 @@ * under the License. */ -const { env: buildEnv } = require("../env"); +const { env } = require("../env"); const version = require("../package.json").version; module.exports = { defaultEnvJson: { - RUNTIME_TOOLS_TASK_CONSOLE_KOGITO_ENV_MODE: buildEnv.runtimeToolsTaskConsoleWebapp.kogitoEnvMode, + RUNTIME_TOOLS_TASK_CONSOLE_KOGITO_ENV_MODE: env.runtimeToolsTaskConsoleWebapp.kogitoEnvMode, RUNTIME_TOOLS_TASK_CONSOLE_KOGITO_APP_NAME: "Task Console", RUNTIME_TOOLS_TASK_CONSOLE_KOGITO_APP_VERSION: version, RUNTIME_TOOLS_TASK_CONSOLE_KOGITO_TASK_STATES_LIST: "Ready,Reserved,Completed,Aborted,Skipped", RUNTIME_TOOLS_TASK_CONSOLE_KOGITO_TASK_ACTIVE_STATES_LIST: "Ready,Reserved", - RUNTIME_TOOLS_TASK_CONSOLE_DATA_INDEX_ENDPOINT: buildEnv.runtimeToolsTaskConsoleWebapp.kogitoDataIndexUrl, + RUNTIME_TOOLS_TASK_CONSOLE_DATA_INDEX_ENDPOINT: env.runtimeToolsTaskConsoleWebapp.kogitoDataIndexUrl, KOGITO_CONSOLES_KEYCLOAK_DISABLE_HEALTH_CHECK: false, KOGITO_CONSOLES_KEYCLOAK_UPDATE_TOKEN_VALIDITY: 30, KOGITO_CONSOLES_KEYCLOAK_HEALTH_CHECK_URL: diff --git a/packages/runtime-tools-task-console-webapp/webpack.config.js b/packages/runtime-tools-task-console-webapp/webpack.config.js index 3191882517d..4dda3c7e5ee 100644 --- a/packages/runtime-tools-task-console-webapp/webpack.config.js +++ b/packages/runtime-tools-task-console-webapp/webpack.config.js @@ -22,13 +22,13 @@ const { merge } = require("webpack-merge"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const HtmlWebpackPlugin = require("html-webpack-plugin"); const CopyPlugin = require("copy-webpack-plugin"); -const { env: buildEnv } = require("./env"); +const { env } = require("./env"); const { defaultEnvJson } = require("./build/defaultEnvJson"); const BG_IMAGES_DIRNAME = "bgimages"; -module.exports = async (env) => { - return merge(common(env), { +module.exports = async (webpackEnv) => { + return merge(common(webpackEnv), { entry: { index: path.resolve(__dirname, "src", "index.tsx"), "resources/form-displayer": "./src/resources/form-displayer.ts", @@ -37,8 +37,8 @@ module.exports = async (env) => { static: { directory: "./dist", }, - host: buildEnv.runtimeToolsTaskConsoleWebapp.host, - port: buildEnv.runtimeToolsTaskConsoleWebapp.port, + host: env.runtimeToolsTaskConsoleWebapp.host, + port: env.runtimeToolsTaskConsoleWebapp.port, compress: true, historyApiFallback: true, hot: true, diff --git a/packages/scesim-editor/playwright.config.ts b/packages/scesim-editor/playwright.config.ts index b837bceb451..2d881010ce4 100644 --- a/packages/scesim-editor/playwright.config.ts +++ b/packages/scesim-editor/playwright.config.ts @@ -20,9 +20,9 @@ import { defineConfig } from "@playwright/test"; import playwrightBaseConfig from "@kie-tools/playwright-base/playwright.config"; import merge from "lodash/merge"; -import { env } from "./env"; -const buildEnv: any = env; +import { env } from "./env"; +const buildEnv: any = env; // build-env is not typed const customConfig = defineConfig({ use: { diff --git a/packages/serverless-logic-web-tools-base-builder-image-env/env/index.js b/packages/serverless-logic-web-tools-base-builder-image-env/env/index.js index afdfe513458..1978806b118 100644 --- a/packages/serverless-logic-web-tools-base-builder-image-env/env/index.js +++ b/packages/serverless-logic-web-tools-base-builder-image-env/env/index.js @@ -42,7 +42,7 @@ module.exports = composeEnv([rootEnv], { }), get env() { return { - baseBuilderImageEnv: { + slwtBaseBuilderImageEnv: { registry: getOrDefault(this.vars.SERVERLESS_LOGIC_WEB_TOOLS__baseBuilderImageRegistry), account: getOrDefault(this.vars.SERVERLESS_LOGIC_WEB_TOOLS__baseBuilderImageAccount), name: getOrDefault(this.vars.SERVERLESS_LOGIC_WEB_TOOLS__baseBuilderImageName), diff --git a/packages/serverless-logic-web-tools-base-builder-image/Containerfile b/packages/serverless-logic-web-tools-base-builder-image/Containerfile index b5c59c044f7..59434a0a31d 100644 --- a/packages/serverless-logic-web-tools-base-builder-image/Containerfile +++ b/packages/serverless-logic-web-tools-base-builder-image/Containerfile @@ -15,9 +15,9 @@ # specific language governing permissions and limitations # under the License. -ARG KOGITO_IMAGE_TAG +ARG BASE_IMAGE_TAG -FROM --platform=linux/amd64 docker.io/apache/incubator-kie-kogito-base-builder:$KOGITO_IMAGE_TAG +FROM --platform=linux/amd64 $BASE_IMAGE_TAG ARG KUBECTL_VERSION diff --git a/packages/serverless-logic-web-tools-base-builder-image/env/index.js b/packages/serverless-logic-web-tools-base-builder-image/env/index.js index e3eaefd9787..15c0e91d75f 100644 --- a/packages/serverless-logic-web-tools-base-builder-image/env/index.js +++ b/packages/serverless-logic-web-tools-base-builder-image/env/index.js @@ -19,26 +19,28 @@ const { varsWithName, getOrDefault, composeEnv } = require("@kie-tools-scripts/build-env"); +const { + env: { kogitoBaseBuilderImage: kogitoBaseBuilderImageEnv }, +} = require("@kie/kogito-base-builder-image/env"); + module.exports = composeEnv( [require("@kie-tools/root-env/env"), require("@kie-tools/serverless-logic-web-tools-base-builder-image-env/env")], { vars: varsWithName({ - SERVERLESS_LOGIC_WEB_TOOLS__baseBuilderKubectlVersion: { + SERVERLESS_LOGIC_WEB_TOOLS_BASE_BUILDER_IMAGE__kubectlVersion: { default: "v1.27.3", - description: "", + description: "kubectl version to install.", }, - /* (begin) This part of the file is referenced in `scripts/update-kogito-version` */ - SERVERLESS_LOGIC_WEB_TOOLS__baseBuilderKogitoImageTag: { - default: "main-20240905", - description: "", + SERVERLESS_LOGIC_WEB_TOOLS_BASE_BUILDER_IMAGE__baseImageTag: { + default: `${kogitoBaseBuilderImageEnv.registry}/${kogitoBaseBuilderImageEnv.account}/${kogitoBaseBuilderImageEnv.name}:${kogitoBaseBuilderImageEnv.buildTag}`, + description: "Base image complete tag.", }, - /* end */ }), get env() { return { - baseBuilderImage: { - kubectlVersion: getOrDefault(this.vars.SERVERLESS_LOGIC_WEB_TOOLS__baseBuilderKubectlVersion), - kogitoImageTag: getOrDefault(this.vars.SERVERLESS_LOGIC_WEB_TOOLS__baseBuilderKogitoImageTag), + slwtBaseBuilderImage: { + kubectlVersion: getOrDefault(this.vars.SERVERLESS_LOGIC_WEB_TOOLS_BASE_BUILDER_IMAGE__kubectlVersion), + baseImageTag: getOrDefault(this.vars.SERVERLESS_LOGIC_WEB_TOOLS_BASE_BUILDER_IMAGE__baseImageTag), }, }; }, diff --git a/packages/serverless-logic-web-tools-base-builder-image/package.json b/packages/serverless-logic-web-tools-base-builder-image/package.json index 1a579ec1422..e43d512b064 100644 --- a/packages/serverless-logic-web-tools-base-builder-image/package.json +++ b/packages/serverless-logic-web-tools-base-builder-image/package.json @@ -18,11 +18,12 @@ "build:prod:linux:darwin": "run-script-if --bool \"$(build-env containerImages.build)\" --then \"pnpm image:docker:build\"", "build:prod:win32": "echo \"Build not supported on Windows\"", "cleanup": "rimraf dist-dev && mkdir dist-dev", - "image:docker:build": "run-script-if --bool $([ $(command -v docker) ] && echo true || echo false) --then \"docker build --ulimit nofile=5000:5000 $(echo $(build-env baseBuilderImageEnv.buildTag) | xargs printf -- \"-t $(build-env baseBuilderImageEnv.registry)/$(build-env baseBuilderImageEnv.account)/$(build-env baseBuilderImageEnv.name):%s\n\" | xargs echo) --build-arg KOGITO_IMAGE_TAG=$(build-env baseBuilderImage.kogitoImageTag) --build-arg KUBECTL_VERSION=$(build-env baseBuilderImage.kubectlVersion) .\" --else \"echo Docker not found, skipping image build.\"" + "image:docker:build": "run-script-if --bool $([ $(command -v docker) ] && echo true || echo false) --then \"docker build --ulimit nofile=5000:5000 $(echo $(build-env slwtBaseBuilderImageEnv.buildTag) | xargs printf -- \"-t $(build-env slwtBaseBuilderImageEnv.registry)/$(build-env slwtBaseBuilderImageEnv.account)/$(build-env slwtBaseBuilderImageEnv.name):%s\n\" | xargs echo) --build-arg BASE_IMAGE_TAG=$(build-env slwtBaseBuilderImage.baseImageTag) --build-arg KUBECTL_VERSION=$(build-env slwtBaseBuilderImage.kubectlVersion) .\" --else \"echo Docker not found, skipping image build.\"" }, "devDependencies": { "@kie-tools/root-env": "workspace:*", "@kie-tools/serverless-logic-web-tools-base-builder-image-env": "workspace:*", + "@kie/kogito-base-builder-image": "workspace:*", "rimraf": "^3.0.2", "run-script-os": "^1.1.6" } diff --git a/packages/serverless-logic-web-tools-swf-builder-image-env/env/index.js b/packages/serverless-logic-web-tools-swf-builder-image-env/env/index.js index 12c1289cada..0f2c264d380 100644 --- a/packages/serverless-logic-web-tools-swf-builder-image-env/env/index.js +++ b/packages/serverless-logic-web-tools-swf-builder-image-env/env/index.js @@ -42,7 +42,7 @@ module.exports = composeEnv([rootEnv], { }), get env() { return { - swfBuilderImageEnv: { + slwtBuilderImageEnv: { registry: getOrDefault(this.vars.SERVERLESS_LOGIC_WEB_TOOLS__swfBuilderImageRegistry), account: getOrDefault(this.vars.SERVERLESS_LOGIC_WEB_TOOLS__swfBuilderImageAccount), name: getOrDefault(this.vars.SERVERLESS_LOGIC_WEB_TOOLS__swfBuilderImageName), diff --git a/packages/serverless-logic-web-tools-swf-builder-image/env/index.js b/packages/serverless-logic-web-tools-swf-builder-image/env/index.js index 86df3331a33..0efda095d0b 100644 --- a/packages/serverless-logic-web-tools-swf-builder-image/env/index.js +++ b/packages/serverless-logic-web-tools-swf-builder-image/env/index.js @@ -26,13 +26,13 @@ const sonataflowBuilderImageEnv = require("@kie-tools/sonataflow-builder-image/e module.exports = composeEnv([rootEnv, serverlessLogicWebToolsSwfBuilderImageEnv, sonataflowBuilderImageEnv], { vars: varsWithName({ SERVERLESS_LOGIC_WEB_TOOLS_SWF_BUILDER_IMAGE__baseImageUrl: { - default: `${sonataflowBuilderImageEnv.env.sonataflowBuilderImage.registry}/${sonataflowBuilderImageEnv.env.sonataflowBuilderImage.account}/${sonataflowBuilderImageEnv.env.sonataflowBuilderImage.name}:${sonataflowBuilderImageEnv.env.sonataflowBuilderImage.tag}`, + default: `${sonataflowBuilderImageEnv.env.sonataflowBuilderImage.registry}/${sonataflowBuilderImageEnv.env.sonataflowBuilderImage.account}/${sonataflowBuilderImageEnv.env.sonataflowBuilderImage.name}:${sonataflowBuilderImageEnv.env.sonataflowBuilderImage.buildTag}`, description: "The image used in the FROM import.", }, }), get env() { return { - swfBuilderImage: { + slwtBuilderImage: { baseImageUrl: getOrDefault(this.vars.SERVERLESS_LOGIC_WEB_TOOLS_SWF_BUILDER_IMAGE__baseImageUrl), }, }; diff --git a/packages/serverless-logic-web-tools-swf-builder-image/package.json b/packages/serverless-logic-web-tools-swf-builder-image/package.json index 7309aa8324e..d86f263f4cd 100644 --- a/packages/serverless-logic-web-tools-swf-builder-image/package.json +++ b/packages/serverless-logic-web-tools-swf-builder-image/package.json @@ -21,7 +21,7 @@ "cleanup": "rimraf dist-dev && mkdir dist-dev", "copy:assets": "pnpm copy:webapp", "copy:webapp": "cp -r ./node_modules/sonataflow-deployment-webapp/dist dist-dev/webapp", - "image:docker:build": "run-script-if --bool $([ $(command -v docker) ] && echo true || echo false) --then \"docker build --ulimit nofile=5000:5000 $(echo $(build-env swfBuilderImageEnv.buildTag) | xargs printf -- \"-t $(build-env swfBuilderImageEnv.registry)/$(build-env swfBuilderImageEnv.account)/$(build-env swfBuilderImageEnv.name):%s\n\" | xargs echo) --build-arg BASE_IMAGE_URL=$(build-env swfBuilderImage.baseImageUrl) .\" --else \"echo Docker not found, skipping image build.\"" + "image:docker:build": "run-script-if --bool $([ $(command -v docker) ] && echo true || echo false) --then \"docker build --ulimit nofile=5000:5000 $(echo $(build-env slwtBuilderImageEnv.buildTag) | xargs printf -- \"-t $(build-env slwtBuilderImageEnv.registry)/$(build-env slwtBuilderImageEnv.account)/$(build-env slwtBuilderImageEnv.name):%s\n\" | xargs echo) --build-arg BASE_IMAGE_URL=$(build-env slwtBuilderImage.baseImageUrl) .\" --else \"echo Docker not found, skipping image build.\"" }, "devDependencies": { "@kie-tools/root-env": "workspace:*", diff --git a/packages/serverless-logic-web-tools-swf-deployment-quarkus-app/install.js b/packages/serverless-logic-web-tools-swf-deployment-quarkus-app/install.js deleted file mode 100644 index b562eaace2c..00000000000 --- a/packages/serverless-logic-web-tools-swf-deployment-quarkus-app/install.js +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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 buildEnv = require("./env"); -const { setup } = require("@kie-tools/maven-config-setup-helper"); - -setup(` - -Drevision=${buildEnv.env.swfDeploymentQuarkusApp.version} - -Dquarkus.platform.version=${buildEnv.env.quarkusPlatform.version} - -Dversion.org.kie.kogito=${buildEnv.env.kogitoRuntime.version} -`); diff --git a/packages/serverless-logic-web-tools-swf-deployment-quarkus-app/mvn.bootstrap.js b/packages/serverless-logic-web-tools-swf-deployment-quarkus-app/mvn.bootstrap.js new file mode 100644 index 00000000000..a6a4c83aba8 --- /dev/null +++ b/packages/serverless-logic-web-tools-swf-deployment-quarkus-app/mvn.bootstrap.js @@ -0,0 +1,33 @@ +/* + * 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 { env } = require("./env"); +const { setupMavenConfigFile, buildTailFromPackageJsonDependencies } = require("@kie-tools/maven-base"); + +setupMavenConfigFile( + ` + --batch-mode + -Dstyle.color=always + -Drevision=${env.swfDeploymentQuarkusApp.version} + -Dquarkus.platform.version=${env.quarkusPlatform.version} + -Dversion.org.kie.kogito=${env.kogitoRuntime.version} + -Dmaven.repo.local.tail=${buildTailFromPackageJsonDependencies()} +`, + { ignoreDefault: true } // Can't have special configuration that only works inside this repo. +); diff --git a/packages/serverless-logic-web-tools-swf-deployment-quarkus-app/package.json b/packages/serverless-logic-web-tools-swf-deployment-quarkus-app/package.json index 94f344bb90b..66bb7bde434 100644 --- a/packages/serverless-logic-web-tools-swf-deployment-quarkus-app/package.json +++ b/packages/serverless-logic-web-tools-swf-deployment-quarkus-app/package.json @@ -19,7 +19,7 @@ "build:prod": "pnpm lint && run-script-os", "build:prod:darwin:linux": "mvn clean install -DskipTests=$(build-env tests.run --not) -Dmaven.test.failure.ignore=$(build-env tests.ignoreFailures)", "build:prod:win32": "pnpm powershell \"mvn clean install `-DskipTests=$(build-env tests.run --not) `-Dmaven.test.failure.ignore=$(build-env tests.ignoreFailures)\"", - "install": "node install.js", + "install": "node mvn.bootstrap.js", "lint": "echo 'Linting'", "powershell": "@powershell -NoProfile -ExecutionPolicy Unrestricted -Command", "quarkus:dev": "run-script-os", @@ -27,10 +27,10 @@ "quarkus:dev:win32": "mvn clean package quarkus:dev `-DskipTests" }, "dependencies": { + "@kie-tools/maven-base": "workspace:*", "@kie-tools/sonataflow-quarkus-devui": "workspace:*" }, "devDependencies": { - "@kie-tools/maven-config-setup-helper": "workspace:*", "@kie-tools/root-env": "workspace:*", "run-script-os": "^1.1.6" }, diff --git a/packages/serverless-logic-web-tools-swf-deployment-quarkus-app/pom.xml b/packages/serverless-logic-web-tools-swf-deployment-quarkus-app/pom.xml index 40a5864091d..1da3045fba5 100644 --- a/packages/serverless-logic-web-tools-swf-deployment-quarkus-app/pom.xml +++ b/packages/serverless-logic-web-tools-swf-deployment-quarkus-app/pom.xml @@ -42,10 +42,6 @@ 17 UTF-8 UTF-8 - quarkus-bom - io.quarkus - org.kie.kogito - kogito-bom 2.1.20 1.26.0 1.14.2 @@ -55,15 +51,15 @@ - ${quarkus.platform.group-id} - ${quarkus.platform.artifact-id} + io.quarkus + quarkus-bom ${quarkus.platform.version} pom import - ${kogito.bom.group-id} - ${kogito.bom.artifact-id} + org.kie.kogito + kogito-bom ${version.org.kie.kogito} pom import @@ -108,11 +104,6 @@ org.kie kie-addons-quarkus-knative-eventing - - org.apache.kie.sonataflow - sonataflow-quarkus-devui - ${project.version} - org.kie kogito-addons-quarkus-data-index-inmemory @@ -147,10 +138,64 @@ + + + include-1st-party-dependencies + + + kieTools.do-not-use-this-property.ignore1stPartyDependencies + !true + + + + + + org.apache.kie.sonataflow + sonataflow-quarkus-devui-bom + ${project.version} + pom + import + + + + + + org.apache.kie.sonataflow + sonataflow-quarkus-devui + + + + + + + + use-maven-repo-local-tail + + + kieTools.do-not-use-this-property.ignoreMavenRepoLocalTail + !true + + + + + + + org.apache.maven.plugins + maven-install-plugin + + true + + + + + + + + - ${quarkus.platform.group-id} + io.quarkus quarkus-maven-plugin ${quarkus.platform.version} true diff --git a/packages/serverless-logic-web-tools-swf-dev-mode-image-env/env/index.js b/packages/serverless-logic-web-tools-swf-dev-mode-image-env/env/index.js index bc9514484a1..804d8ff6bd6 100644 --- a/packages/serverless-logic-web-tools-swf-dev-mode-image-env/env/index.js +++ b/packages/serverless-logic-web-tools-swf-dev-mode-image-env/env/index.js @@ -42,7 +42,7 @@ module.exports = composeEnv([rootEnv], { }), get env() { return { - swfDevModeImageEnv: { + slwtDevModeImageEnv: { registry: getOrDefault(this.vars.SERVERLESS_LOGIC_WEB_TOOLS__swfDevModeImageRegistry), account: getOrDefault(this.vars.SERVERLESS_LOGIC_WEB_TOOLS__swfDevModeImageAccount), name: getOrDefault(this.vars.SERVERLESS_LOGIC_WEB_TOOLS__swfDevModeImageName), diff --git a/packages/serverless-logic-web-tools-swf-dev-mode-image/Containerfile b/packages/serverless-logic-web-tools-swf-dev-mode-image/Containerfile index 48395f4882c..1038ffd3cc4 100644 --- a/packages/serverless-logic-web-tools-swf-dev-mode-image/Containerfile +++ b/packages/serverless-logic-web-tools-swf-dev-mode-image/Containerfile @@ -15,9 +15,9 @@ # specific language governing permissions and limitations # under the License. -ARG KOGITO_IMAGE_TAG +ARG BASE_IMAGE_TAG -FROM --platform=linux/amd64 docker.io/apache/incubator-kie-kogito-base-builder:$KOGITO_IMAGE_TAG +FROM --platform=linux/amd64 $BASE_IMAGE_TAG ENV PATH="${PATH}:/usr/share/maven/bin" diff --git a/packages/serverless-logic-web-tools-swf-dev-mode-image/entrypoint.sh b/packages/serverless-logic-web-tools-swf-dev-mode-image/entrypoint.sh index 97c40b91eca..1b98d1080b6 100644 --- a/packages/serverless-logic-web-tools-swf-dev-mode-image/entrypoint.sh +++ b/packages/serverless-logic-web-tools-swf-dev-mode-image/entrypoint.sh @@ -26,6 +26,7 @@ cd /tmp/app/serverless-logic-web-tools-swf-deployment-quarkus-app mvn quarkus:dev \ -nsu \ + -ntp \ -o \ -s /home/kogito/.m2/settings.xml \ -Ddebug=false \ diff --git a/packages/serverless-logic-web-tools-swf-dev-mode-image/env/index.js b/packages/serverless-logic-web-tools-swf-dev-mode-image/env/index.js index 434d3870172..7e8dab30e31 100644 --- a/packages/serverless-logic-web-tools-swf-dev-mode-image/env/index.js +++ b/packages/serverless-logic-web-tools-swf-dev-mode-image/env/index.js @@ -25,28 +25,24 @@ const { env: { mavenM2RepoViaHttpImage: mavenM2RepoViaHttpImageEnv }, } = require("@kie-tools/maven-m2-repo-via-http-image/env"); +const { + env: { kogitoBaseBuilderImage: kogitoBaseBuilderImageEnv }, +} = require("@kie/kogito-base-builder-image/env"); + module.exports = composeEnv([rootEnv, require("@kie-tools/serverless-logic-web-tools-swf-dev-mode-image-env/env")], { vars: varsWithName({ - /* (begin) This part of the file is referenced in `scripts/update-kogito-version` */ - SERVERLESS_LOGIC_WEB_TOOLS_DEVMODE_IMAGE__kogitoBaseBuilderImageTag: { - default: "main-20240905", - description: "", - }, - /* end */ - SERVERLESS_LOGIC_WEB_TOOLS_DEVMODE_IMAGE__mavenM2RepoViaHttpImage: { - default: `${mavenM2RepoViaHttpImageEnv.registry}/${mavenM2RepoViaHttpImageEnv.account}/${mavenM2RepoViaHttpImageEnv.name}:${mavenM2RepoViaHttpImageEnv.tag}`, - description: "The image tag for the Maven M2 Repo via HTTP. Used during the build only.", + SERVERLESS_LOGIC_WEB_TOOLS_DEVMODE_IMAGE__baseImageTag: { + default: `${kogitoBaseBuilderImageEnv.registry}/${kogitoBaseBuilderImageEnv.account}/${kogitoBaseBuilderImageEnv.name}:${kogitoBaseBuilderImageEnv.buildTag}`, + description: "Base image complete tag.", }, }), get env() { return { - swfDevModeImage: { + slwtDevModeImage: { + baseImageTag: getOrDefault(this.vars.SERVERLESS_LOGIC_WEB_TOOLS_DEVMODE_IMAGE__baseImageTag), version: require("../package.json").version, - kogitoImageTag: getOrDefault(this.vars.SERVERLESS_LOGIC_WEB_TOOLS_DEVMODE_IMAGE__kogitoBaseBuilderImageTag), dev: { - mavenM2RepoViaHttpImage: getOrDefault( - this.vars.SERVERLESS_LOGIC_WEB_TOOLS_DEVMODE_IMAGE__mavenM2RepoViaHttpImage - ), + mavenM2RepoViaHttpImage: `${mavenM2RepoViaHttpImageEnv.registry}/${mavenM2RepoViaHttpImageEnv.account}/${mavenM2RepoViaHttpImageEnv.name}:${mavenM2RepoViaHttpImageEnv.buildTag}`, }, }, }; diff --git a/packages/serverless-logic-web-tools-swf-dev-mode-image/install.js b/packages/serverless-logic-web-tools-swf-dev-mode-image/install.js index 94df8d4a2e8..d73cc3c46df 100644 --- a/packages/serverless-logic-web-tools-swf-dev-mode-image/install.js +++ b/packages/serverless-logic-web-tools-swf-dev-mode-image/install.js @@ -17,9 +17,9 @@ * under the License. */ -const buildEnv = require("./env"); -const { setup } = require("@kie-tools/maven-config-setup-helper"); +const { env } = require("./env"); +const { setupMavenConfigFile } = require("@kie-tools/maven-base"); -setup(` - -Drevision=${buildEnv.env.swfDevModeImage.version} +setupMavenConfigFile(` + -Drevision=${env.slwtDevModeImage.version} `); diff --git a/packages/serverless-logic-web-tools-swf-dev-mode-image/package.json b/packages/serverless-logic-web-tools-swf-dev-mode-image/package.json index b9a76e09952..c5759d0320e 100644 --- a/packages/serverless-logic-web-tools-swf-dev-mode-image/package.json +++ b/packages/serverless-logic-web-tools-swf-dev-mode-image/package.json @@ -13,7 +13,7 @@ "url": "https://github.com/apache/incubator-kie-tools/issues" }, "scripts": { - "build": "run-script-if --bool \"$(build-env containerImages.build)\" --then \"pnpm m2-repo-via-http:container:run\" \"pnpm copy:assets\" \"pnpm image:docker:build\" \"pnpm image:docker:squash\" --finally \"pnpm m2-repo-via-http:container:kill\"", + "build": "run-script-if --bool \"$(build-env containerImages.build)\" --then \"pnpm m2-repo-via-http:container:run\" \"pnpm copy:assets\" \"pnpm image:docker:build\" \"pnpm image:docker:squash\" --finally \"pnpm m2-repo-via-http:container:kill\" \"rimraf ./dist/tmp-m2\"", "build:dev": "pnpm build", "build:prod": "pnpm build", "copy:assets": "rimraf dist-dev && mkdir -p ./dist-dev && pnpm copy:quarkus-app && pnpm copy:sonataflow-deployment-webapp && pnpm copy:maven-m2-repo-via-http-image--settings-xml", @@ -26,21 +26,23 @@ "copy:sonataflow-deployment-webapp": "run-script-os", "copy:sonataflow-deployment-webapp:linux:darwin": "cp -R ./node_modules/sonataflow-deployment-webapp/dist/* ./dist-dev/quarkus-app/src/main/resources/META-INF/resources", "copy:sonataflow-deployment-webapp:win32": "pnpm powershell \"Copy-Item -R ./node_modules/sonataflow-deployment-webapp/dist/* ./dist-dev/quarkus-app/src/main/resources/META-INF/resources\"", - "image:docker:build": "kie-tools--image-builder build --allowHostNetworkAccess -r \"$(build-env swfDevModeImageEnv.registry)\" -a \"$(build-env swfDevModeImageEnv.account)\" -n \"$(build-env swfDevModeImageEnv.name)\" -t \"$(build-env swfDevModeImageEnv.buildTag)\" --build-arg KOGITO_IMAGE_TAG=\"$(build-env swfDevModeImage.kogitoImageTag)\"", - "image:docker:squash": ". ./node_modules/@kie-tools/python-venv/venv/bin/activate && DOCKER_HOST=$(docker context inspect | jq '.[].Endpoints.docker.Host' | tr -d '\"') docker-squash -t $(build-env swfDevModeImageEnv.registry)/$(build-env swfDevModeImageEnv.account)/$(build-env swfDevModeImageEnv.name):$(build-env swfDevModeImageEnv.buildTag) $(build-env swfDevModeImageEnv.registry)/$(build-env swfDevModeImageEnv.account)/$(build-env swfDevModeImageEnv.name):$(build-env swfDevModeImageEnv.buildTag)", + "image:docker:build": "kie-tools--image-builder build --allowHostNetworkAccess -r \"$(build-env slwtDevModeImageEnv.registry)\" -a \"$(build-env slwtDevModeImageEnv.account)\" -n \"$(build-env slwtDevModeImageEnv.name)\" -t \"$(build-env slwtDevModeImageEnv.buildTag)\" --build-arg BASE_IMAGE_TAG=\"$(build-env slwtDevModeImage.baseImageTag)\"", + "image:docker:squash": ". ./node_modules/@kie-tools/python-venv/venv/bin/activate && DOCKER_HOST=$(docker context inspect | jq '.[].Endpoints.docker.Host' | tr -d '\"') docker-squash -t $(build-env slwtDevModeImageEnv.registry)/$(build-env slwtDevModeImageEnv.account)/$(build-env slwtDevModeImageEnv.name):$(build-env slwtDevModeImageEnv.buildTag) $(build-env slwtDevModeImageEnv.registry)/$(build-env slwtDevModeImageEnv.account)/$(build-env slwtDevModeImageEnv.name):$(build-env slwtDevModeImageEnv.buildTag)", "install": "node install.js", "m2-repo-via-http:container:kill": "(docker container kill m2-repo-via-http || true) && (docker container rm m2-repo-via-http || true)", - "m2-repo-via-http:container:run": "(pnpm m2-repo-via-http:container:kill || true) && docker run --name m2-repo-via-http -v \"$(mvn help:evaluate -Dexpression=settings.localRepository -q -DforceStdout):/var/www/html\" -dit $(build-env swfDevModeImage.dev.mavenM2RepoViaHttpImage)", + "m2-repo-via-http:container:prepare-m2-repo-volume": "node -e 'require(`@kie-tools/maven-base`).prepareHardLinkedM2ForPackage(`./dist/tmp-m2/repository`, `./node_modules/@kie-tools/serverless-logic-web-tools-swf-deployment-quarkus-app`)'", + "m2-repo-via-http:container:run": "(pnpm m2-repo-via-http:container:kill || true) && pnpm m2-repo-via-http:container:prepare-m2-repo-volume && docker run --name m2-repo-via-http -v \"./dist/tmp-m2/repository:/var/www/html\" -dit $(build-env slwtDevModeImage.dev.mavenM2RepoViaHttpImage)", "powershell": "@powershell -NoProfile -ExecutionPolicy Unrestricted -Command" }, "devDependencies": { "@kie-tools/image-builder": "workspace:*", - "@kie-tools/maven-config-setup-helper": "workspace:*", + "@kie-tools/maven-base": "workspace:*", "@kie-tools/maven-m2-repo-via-http-image": "workspace:*", "@kie-tools/python-venv": "workspace:*", "@kie-tools/root-env": "workspace:*", "@kie-tools/serverless-logic-web-tools-swf-deployment-quarkus-app": "workspace:*", "@kie-tools/serverless-logic-web-tools-swf-dev-mode-image-env": "workspace:*", + "@kie/kogito-base-builder-image": "workspace:*", "rimraf": "^3.0.2", "run-script-os": "^1.1.6", "sonataflow-deployment-webapp": "workspace:*" diff --git a/packages/serverless-logic-web-tools/build/defaultEnvJson.ts b/packages/serverless-logic-web-tools/build/defaultEnvJson.ts index 95c73bfb6db..3b37893e395 100644 --- a/packages/serverless-logic-web-tools/build/defaultEnvJson.ts +++ b/packages/serverless-logic-web-tools/build/defaultEnvJson.ts @@ -22,7 +22,6 @@ import { EnvJson } from "../src/env/EnvJson"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore import { env } from "../env"; - const buildEnv: any = env; // build-env is not typed export const defaultEnvJson: EnvJson = { diff --git a/packages/serverless-logic-web-tools/env/index.js b/packages/serverless-logic-web-tools/env/index.js index 41004e01ce5..01c2c8611fb 100644 --- a/packages/serverless-logic-web-tools/env/index.js +++ b/packages/serverless-logic-web-tools/env/index.js @@ -86,16 +86,16 @@ module.exports = composeEnv( cypressUrl: getOrDefault(this.vars.SERVERLESS_LOGIC_WEB_TOOLS__cypressUrl), port: 9020, }, - swfBuilderImage: { + slwtBuilderImageEnv: { tag: getOrDefault(this.vars.SERVERLESS_LOGIC_WEB_TOOLS__swfBuilderImageTag), }, - baseBuilderImage: { + slwtBaseBuilderImage: { tag: getOrDefault(this.vars.SERVERLESS_LOGIC_WEB_TOOLS__baseBuilderImageTag), }, dashbuilderViewerImage: { tag: getOrDefault(this.vars.SERVERLESS_LOGIC_WEB_TOOLS__dashbuilderViewerImageTag), }, - swfDevModeImage: { + slwtDevModeImage: { tag: getOrDefault(this.vars.SERVERLESS_LOGIC_WEB_TOOLS__swfDevModeImageTag), }, corsProxyUrl: getOrDefault(this.vars.SERVERLESS_LOGIC_WEB_TOOLS__corsProxyUrl), diff --git a/packages/serverless-logic-web-tools/webpack.config.ts b/packages/serverless-logic-web-tools/webpack.config.ts index 689a4aa196e..5ab93ac0360 100644 --- a/packages/serverless-logic-web-tools/webpack.config.ts +++ b/packages/serverless-logic-web-tools/webpack.config.ts @@ -36,10 +36,9 @@ import HtmlReplaceWebpackPlugin from "html-replace-webpack-plugin"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore import { env } from "./env"; - const buildEnv: any = env; // build-env is not typed -export default async (env: any, argv: any) => { +export default async (webpackEnv: any, webpackArgv: any) => { const buildInfo = getBuildInfo(); const gtmResource = getGtmResource(); const [swfBuilderImageRegistry, swfBuilderImageAccount, swfBuilderImageName, swfBuilderImageTag] = @@ -56,7 +55,7 @@ export default async (env: any, argv: any) => { ] = getDashbuilderViewerImageArgs(); return [ - merge(common(env), { + merge(common(webpackEnv), { entry: { "workspace/worker/sharedWorker": "./src/workspace/worker/sharedWorker.ts", }, @@ -80,7 +79,7 @@ export default async (env: any, argv: any) => { ], }), { - ...merge(common(env), { + ...merge(common(webpackEnv), { entry: { index: "./src/index.tsx", "yard-editor-envelope": "./src/envelope/YardEditorEnvelopeApp.ts", @@ -220,10 +219,10 @@ export default async (env: any, argv: any) => { }; function getSwfBuilderImageArgs() { - const swfBuilderImageRegistry = buildEnv.swfBuilderImageEnv.registry; - const swfBuilderImageAccount = buildEnv.swfBuilderImageEnv.account; - const swfBuilderImageName = buildEnv.swfBuilderImageEnv.name; - const swfBuilderImageTag = buildEnv.serverlessLogicWebTools.swfBuilderImage.tag; + const swfBuilderImageRegistry = buildEnv.slwtBuilderImageEnv.registry; + const swfBuilderImageAccount = buildEnv.slwtBuilderImageEnv.account; + const swfBuilderImageName = buildEnv.slwtBuilderImageEnv.name; + const swfBuilderImageTag = buildEnv.serverlessLogicWebTools.slwtBuilderImageEnv.tag; console.info("Serverless Logic Web Tools :: SWF Builder Image Registry: " + swfBuilderImageRegistry); console.info("Serverless Logic Web Tools :: SWF Builder Image Account: " + swfBuilderImageAccount); @@ -234,10 +233,10 @@ function getSwfBuilderImageArgs() { } function getSwfDevModeImageArgs() { - const swfDevModeImageRegistry = buildEnv.swfDevModeImageEnv.registry; - const swfDevModeImageAccount = buildEnv.swfDevModeImageEnv.account; - const swfDevModeImageName = buildEnv.swfDevModeImageEnv.name; - const swfDevModeImageTag = buildEnv.serverlessLogicWebTools.swfDevModeImage.tag; + const swfDevModeImageRegistry = buildEnv.slwtDevModeImageEnv.registry; + const swfDevModeImageAccount = buildEnv.slwtDevModeImageEnv.account; + const swfDevModeImageName = buildEnv.slwtDevModeImageEnv.name; + const swfDevModeImageTag = buildEnv.serverlessLogicWebTools.slwtDevModeImage.tag; console.info("Serverless Logic Web Tools :: Dev Mode Image Registry: " + swfDevModeImageRegistry); console.info("Serverless Logic Web Tools :: Dev Mode Image Account: " + swfDevModeImageAccount); @@ -248,10 +247,10 @@ function getSwfDevModeImageArgs() { } function getBaseBuilderImageArgs() { - const baseBuilderImageRegistry = buildEnv.baseBuilderImageEnv.registry; - const baseBuilderImageAccount = buildEnv.baseBuilderImageEnv.account; - const baseBuilderImageName = buildEnv.baseBuilderImageEnv.name; - const baseBuilderImageTag = buildEnv.serverlessLogicWebTools.baseBuilderImage.tag; + const baseBuilderImageRegistry = buildEnv.slwtBaseBuilderImageEnv.registry; + const baseBuilderImageAccount = buildEnv.slwtBaseBuilderImageEnv.account; + const baseBuilderImageName = buildEnv.slwtBaseBuilderImageEnv.name; + const baseBuilderImageTag = buildEnv.serverlessLogicWebTools.slwtBaseBuilderImage.tag; console.info("Serverless Logic Web Tools :: Base Builder Image Registry: " + baseBuilderImageRegistry); console.info("Serverless Logic Web Tools :: Base Builder Image Account: " + baseBuilderImageAccount); diff --git a/packages/serverless-workflow-combined-editor/dev-webapp/webpack.config.js b/packages/serverless-workflow-combined-editor/dev-webapp/webpack.config.js index 82d442e7915..867e11d98ad 100644 --- a/packages/serverless-workflow-combined-editor/dev-webapp/webpack.config.js +++ b/packages/serverless-workflow-combined-editor/dev-webapp/webpack.config.js @@ -25,10 +25,9 @@ const patternflyBase = require("@kie-tools-core/patternfly-base"); const MonacoWebpackPlugin = require("monaco-editor-webpack-plugin"); const swEditorAssets = require("@kie-tools/serverless-workflow-diagram-editor-assets"); const { env } = require("../env"); -const buildEnv = env; -module.exports = (env) => - merge(common(env), { +module.exports = (webpackEnv) => + merge(common(webpackEnv), { mode: "development", entry: { index: path.resolve(__dirname, "./index.tsx"), @@ -100,6 +99,6 @@ module.exports = (env) => historyApiFallback: true, static: [{ directory: path.join(__dirname) }], compress: true, - port: buildEnv.serverlessWorkflowCombinedEditor.dev.port, + port: env.serverlessWorkflowCombinedEditor.dev.port, }, }); diff --git a/packages/serverless-workflow-dev-ui-webapp/webpack.config.js b/packages/serverless-workflow-dev-ui-webapp/webpack.config.js index 8f66faab9e4..a7732717cff 100644 --- a/packages/serverless-workflow-dev-ui-webapp/webpack.config.js +++ b/packages/serverless-workflow-dev-ui-webapp/webpack.config.js @@ -29,10 +29,9 @@ const swEditor = require("@kie-tools/serverless-workflow-diagram-editor-assets") const { merge } = require("webpack-merge"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const { env } = require("./env"); -const buildEnv = env; -module.exports = async (env) => - merge(common(env), { +module.exports = async (webpackEnv) => + merge(common(webpackEnv), { entry: { standalone: path.resolve(__dirname, "src", "standalone", "standalone.ts"), envelope: path.resolve(__dirname, "src", "standalone", "EnvelopeApp.ts"), @@ -45,7 +44,7 @@ module.exports = async (env) => static: { directory: "./dist", }, - port: buildEnv.runtimeToolsDevUiWebapp.dev.port, + port: env.runtimeToolsDevUiWebapp.dev.port, compress: true, historyApiFallback: true, hot: true, diff --git a/packages/serverless-workflow-diagram-editor/install.js b/packages/serverless-workflow-diagram-editor/install.js deleted file mode 100644 index 3f2131f2de3..00000000000 --- a/packages/serverless-workflow-diagram-editor/install.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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 buildEnv = require("./env"); -const { setup } = require("@kie-tools/maven-config-setup-helper"); - -setup(` - -Drevision=${buildEnv.env.swfDiagramEditor.version} -`); diff --git a/packages/serverless-workflow-diagram-editor/mvn.bootstrap.js b/packages/serverless-workflow-diagram-editor/mvn.bootstrap.js new file mode 100644 index 00000000000..562adaeaeab --- /dev/null +++ b/packages/serverless-workflow-diagram-editor/mvn.bootstrap.js @@ -0,0 +1,35 @@ +/* + * 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 { env } = require("./env"); +const { + setupMavenConfigFile, + buildTailFromPackageJsonDependencies, + DEFAULT_LOCAL_REPO, +} = require("@kie-tools/maven-base"); + +setupMavenConfigFile( + ` + --batch-mode + -Dstyle.color=always + -Drevision=${env.swfDiagramEditor.version} + -Dmaven.repo.local.tail=${buildTailFromPackageJsonDependencies()},${DEFAULT_LOCAL_REPO} + `, // For some reason, j2cl-maven-plugin needs the DEFAULT_LOCAL_REPO here as the last tail too. + { ignoreDefault: true } // Default configuration doesn't work for this module. Since this module is not going to last long, we rely on this workaround for a while. +); diff --git a/packages/serverless-workflow-diagram-editor/package.json b/packages/serverless-workflow-diagram-editor/package.json index afdb0988436..15b1cc0d500 100644 --- a/packages/serverless-workflow-diagram-editor/package.json +++ b/packages/serverless-workflow-diagram-editor/package.json @@ -23,12 +23,12 @@ "build:prod": "run-script-os", "build:prod:linux:darwin": "pnpm lint && mvn clean install -DskipTests=$(build-env tests.run --not) -Dmaven.test.failure.ignore=$(build-env tests.ignoreFailures) -DskipITs=$(build-env endToEndTests.run --not) -Pno-showcase", "build:prod:win32": "pnpm lint && pnpm powershell \"mvn clean install `-DskipTests=$(build-env tests.run --not) `-Dmaven.test.failure.ignore=$(build-env tests.ignoreFailures) `-DskipITs=$(build-env endToEndTests.run --not) `-Pno-showcase\"", - "install": "node install.js", + "install": "node mvn.bootstrap.js", "lint": "echo 'Linting'", "powershell": "@powershell -NoProfile -ExecutionPolicy Unrestricted -Command" }, "devDependencies": { - "@kie-tools/maven-config-setup-helper": "workspace:*", + "@kie-tools/maven-base": "workspace:*", "@kie-tools/root-env": "workspace:*", "cpr": "^3.0.1", "rimraf": "^3.0.2", diff --git a/packages/serverless-workflow-diagram-editor/pom.xml b/packages/serverless-workflow-diagram-editor/pom.xml index 91080e2cd77..7d787d1d35e 100644 --- a/packages/serverless-workflow-diagram-editor/pom.xml +++ b/packages/serverless-workflow-diagram-editor/pom.xml @@ -2053,5 +2053,31 @@ ${env.ghprbTargetBranch} + + + + + + use-maven-repo-local-tail + + + kieTools.do-not-use-this-property.ignoreMavenRepoLocalTail + !true + + + + + + + org.apache.maven.plugins + maven-install-plugin + + true + + + + + + diff --git a/packages/serverless-workflow-standalone-editor/webpack.build-resources.config.js b/packages/serverless-workflow-standalone-editor/webpack.build-resources.config.js index 6d5ea48456a..80f18e960db 100644 --- a/packages/serverless-workflow-standalone-editor/webpack.build-resources.config.js +++ b/packages/serverless-workflow-standalone-editor/webpack.build-resources.config.js @@ -22,8 +22,8 @@ const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const CopyPlugin = require("copy-webpack-plugin"); const patternflyBase = require("@kie-tools-core/patternfly-base"); -module.exports = (env) => [ - merge(common(env), { +module.exports = (webpackEnv) => [ + merge(common(webpackEnv), { entry: { "preprocessor/preprocessor": "./src/preprocessor/preprocessor.ts", }, @@ -34,7 +34,7 @@ module.exports = (env) => [ __filename: true, //Uses current working dir }, }), - merge(common(env), { + merge(common(webpackEnv), { output: { publicPath: "", }, diff --git a/packages/serverless-workflow-standalone-editor/webpack.editor-resources.config.js b/packages/serverless-workflow-standalone-editor/webpack.editor-resources.config.js index 43133134c3e..24b178fa0d3 100644 --- a/packages/serverless-workflow-standalone-editor/webpack.editor-resources.config.js +++ b/packages/serverless-workflow-standalone-editor/webpack.editor-resources.config.js @@ -23,8 +23,8 @@ const patternflyBase = require("@kie-tools-core/patternfly-base"); const FileManagerPlugin = require("filemanager-webpack-plugin"); const MonacoWebpackPlugin = require("monaco-editor-webpack-plugin"); -module.exports = (env) => [ - merge(common(env), { +module.exports = (webpackEnv) => [ + merge(common(webpackEnv), { output: { publicPath: "", }, diff --git a/packages/serverless-workflow-standalone-editor/webpack.package-resources.config.js b/packages/serverless-workflow-standalone-editor/webpack.package-resources.config.js index a182723a81e..e288290f12d 100644 --- a/packages/serverless-workflow-standalone-editor/webpack.package-resources.config.js +++ b/packages/serverless-workflow-standalone-editor/webpack.package-resources.config.js @@ -21,11 +21,10 @@ const { merge } = require("webpack-merge"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const path = require("path"); const { env } = require("./env"); -const buildEnv = env; const patternflyBase = require("@kie-tools-core/patternfly-base"); -module.exports = (env) => - merge(common(env), { +module.exports = (webpackEnv) => + merge(common(webpackEnv), { output: { path: path.join(__dirname, "dist"), filename: "[name]/index.js", @@ -42,7 +41,7 @@ module.exports = (env) => historyApiFallback: false, static: [{ directory: path.join(__dirname, "./dist") }], compress: true, - port: buildEnv.standaloneEditors.dev.port, + port: env.standaloneEditors.dev.port, }, ignoreWarnings: [/Failed to parse source map/], }); diff --git a/packages/serverless-workflow-text-editor/dev-webapp/webpack.config.js b/packages/serverless-workflow-text-editor/dev-webapp/webpack.config.js index 6b579a40fe3..93626a0336b 100644 --- a/packages/serverless-workflow-text-editor/dev-webapp/webpack.config.js +++ b/packages/serverless-workflow-text-editor/dev-webapp/webpack.config.js @@ -24,10 +24,9 @@ const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const patternflyBase = require("@kie-tools-core/patternfly-base"); const MonacoWebpackPlugin = require("monaco-editor-webpack-plugin"); const { env } = require("../env"); -const buildEnv = env; -module.exports = (env) => - merge(common(env), { +module.exports = (webpackEnv) => + merge(common(webpackEnv), { mode: "development", entry: { index: path.resolve(__dirname, "./index.tsx"), @@ -72,6 +71,6 @@ module.exports = (env) => historyApiFallback: true, static: [{ directory: path.join(__dirname) }], compress: true, - port: buildEnv.serverlessWorkflowTextEditor.dev.port, + port: env.serverlessWorkflowTextEditor.dev.port, }, }); diff --git a/packages/serverless-workflow-vscode-extension/e2e-tests/resources/greeting-flow/pom.xml b/packages/serverless-workflow-vscode-extension/e2e-tests/resources/greeting-flow/pom.xml index 17ee5c338aa..7886ca166fe 100644 --- a/packages/serverless-workflow-vscode-extension/e2e-tests/resources/greeting-flow/pom.xml +++ b/packages/serverless-workflow-vscode-extension/e2e-tests/resources/greeting-flow/pom.xml @@ -32,7 +32,6 @@ UTF-8 UTF-8 quarkus-bom - io.quarkus.platform 2.13.1.Final true 3.0.0-M7 @@ -40,15 +39,8 @@ - ${quarkus.platform.group-id} - ${quarkus.platform.artifact-id} - ${quarkus.platform.version} - pom - import - - - ${quarkus.platform.group-id} - quarkus-kogito-bom + io.quarkus + quarkus-bom ${quarkus.platform.version} pom import @@ -94,7 +86,7 @@ - ${quarkus.platform.group-id} + io.quarkus quarkus-maven-plugin ${quarkus.platform.version} true diff --git a/packages/serverless-workflow-vscode-extension/webpack.config.js b/packages/serverless-workflow-vscode-extension/webpack.config.js index 791145178d5..b8b113dc1ec 100644 --- a/packages/serverless-workflow-vscode-extension/webpack.config.js +++ b/packages/serverless-workflow-vscode-extension/webpack.config.js @@ -24,8 +24,8 @@ const { merge } = require("webpack-merge"); const { ProvidePlugin } = require("webpack"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); -const commonConfig = (env) => - merge(common(env), { +const commonConfig = (webpackEnv) => + merge(common(webpackEnv), { output: { library: "ServerlessWorkflowEditor", libraryTarget: "umd", @@ -37,14 +37,14 @@ const commonConfig = (env) => }, }); -module.exports = async (env) => [ - merge(commonConfig(env), { +module.exports = async (webpackEnv) => [ + merge(commonConfig(webpackEnv), { target: "node", entry: { "extension/extension": "./src/extension/extension.ts", }, }), - merge(commonConfig(env), { + merge(commonConfig(webpackEnv), { target: "webworker", entry: { "extension/extensionWeb": "./src/extension/extension.ts", @@ -56,7 +56,7 @@ module.exports = async (env) => [ }), ], }), - merge(commonConfig(env), { + merge(commonConfig(webpackEnv), { target: "web", entry: { "webview/editors/serverless-workflow/serverless-workflow-diagram-editor-envelope": diff --git a/packages/sonataflow-builder-image/.gitignore b/packages/sonataflow-builder-image/.gitignore new file mode 100644 index 00000000000..82ed5072e72 --- /dev/null +++ b/packages/sonataflow-builder-image/.gitignore @@ -0,0 +1 @@ +bats-home \ No newline at end of file diff --git a/packages/sonataflow-builder-image/README.md b/packages/sonataflow-builder-image/README.md index d6ec5463641..79e20e3cefc 100644 --- a/packages/sonataflow-builder-image/README.md +++ b/packages/sonataflow-builder-image/README.md @@ -24,7 +24,7 @@ image along with the modules and scripts provided in `@kie-tools/sonataflow-imag - **python3** with the following packages installed: - `behave` `lxml` `docker` `docker-squash` `elementPath` `pyyaml` `ruamel.yaml` `python-dateutil` `Jinja2` `pykwalify` `colorlog` `click` -- **cekit 4.11.0**: [docs.cekit.io](https://docs.cekit.io/en/latest/index.html) +- **cekit 4.12.0**: [docs.cekit.io](https://docs.cekit.io/en/latest/index.html) - **s2i**: [source-to-image](https://github.com/openshift/source-to-image) - **make** - **docker** diff --git a/packages/sonataflow-builder-image/env/index.js b/packages/sonataflow-builder-image/env/index.js index 4c6bfb01333..4ff09d9fc35 100644 --- a/packages/sonataflow-builder-image/env/index.js +++ b/packages/sonataflow-builder-image/env/index.js @@ -19,6 +19,10 @@ const { varsWithName, composeEnv, getOrDefault } = require("@kie-tools-scripts/build-env"); +const { + env: { mavenM2RepoViaHttpImage: mavenM2RepoViaHttpImageEnv }, +} = require("@kie-tools/maven-m2-repo-via-http-image/env"); + const rootEnv = require("@kie-tools/root-env/env"); module.exports = composeEnv([rootEnv], { @@ -46,8 +50,11 @@ module.exports = composeEnv([rootEnv], { registry: getOrDefault(this.vars.SONATAFLOW_BUILDER_IMAGE__registry), account: getOrDefault(this.vars.SONATAFLOW_BUILDER_IMAGE__account), name: getOrDefault(this.vars.SONATAFLOW_BUILDER_IMAGE__name), - tag: getOrDefault(this.vars.SONATAFLOW_BUILDER_IMAGE__buildTag), + buildTag: getOrDefault(this.vars.SONATAFLOW_BUILDER_IMAGE__buildTag), version: require("../package.json").version, + dev: { + mavenM2RepoViaHttpImage: `${mavenM2RepoViaHttpImageEnv.registry}/${mavenM2RepoViaHttpImageEnv.account}/${mavenM2RepoViaHttpImageEnv.name}:${mavenM2RepoViaHttpImageEnv.buildTag}`, + }, }, }; }, diff --git a/packages/sonataflow-builder-image/install.js b/packages/sonataflow-builder-image/install.js index a3090a5364a..bd2a2098f1e 100644 --- a/packages/sonataflow-builder-image/install.js +++ b/packages/sonataflow-builder-image/install.js @@ -20,7 +20,7 @@ const { execSync } = require("child_process"); const fs = require("fs"); -const buildEnv = require("./env"); +const { env } = require("./env"); const path = require("path"); const pythonVenvDir = path.dirname(require.resolve("@kie-tools/python-venv/package.json")); const sonataflowImageCommonDir = path.dirname(require.resolve("@kie-tools/sonataflow-image-common/package.json")); @@ -33,10 +33,19 @@ const activateCmd = execSync( `${activateCmd} && \ - python3 ${sonataflowImageCommonDir}/resources/scripts/versions_manager.py --bump-to ${buildEnv.env.sonataflowBuilderImage.version} --source-folder ./resources`, + python3 ${sonataflowImageCommonDir}/resources/scripts/versions_manager.py --bump-to ${env.sonataflowBuilderImage.buildTag} --source-folder ./resources`, { stdio: "inherit" } ); +// Creates a symlink to the bats installation dir +try { + fs.symlinkSync(`${sonataflowImageCommonDir}/bats-home`, path.resolve(__dirname, "./bats-home"), "dir"); +} catch (err) { + if (err.code !== "EEXIST") { + throw err; + } +} + // Find and read the -image.yaml file const resourcesPath = path.resolve(__dirname, "./resources"); const files = fs.readdirSync(resourcesPath); @@ -47,14 +56,14 @@ if (imageYamlFiles.length !== 1) { const originalYamlPath = path.join(resourcesPath, imageYamlFiles[0]); let imageYaml = fs.readFileSync(originalYamlPath, "utf8"); -const imageUrl = `${buildEnv.env.sonataflowBuilderImage.registry}/${buildEnv.env.sonataflowBuilderImage.account}/${buildEnv.env.sonataflowBuilderImage.name}`; +const imageUrl = `${env.sonataflowBuilderImage.registry}/${env.sonataflowBuilderImage.account}/${env.sonataflowBuilderImage.name}`; // Replace the whole string between quotes ("") with the image name imageYaml = imageYaml.replace(/(?<=")(.*sonataflow-builder.*)(?=")/gm, imageUrl); // Write file and then rename it to match the image name fs.writeFileSync(originalYamlPath, imageYaml); -fs.renameSync(originalYamlPath, path.join(resourcesPath, `${buildEnv.env.sonataflowBuilderImage.name}-image.yaml`)); +fs.renameSync(originalYamlPath, path.join(resourcesPath, `${env.sonataflowBuilderImage.name}-image.yaml`)); // Replace image URL in .feature files replaceInFile.sync({ diff --git a/packages/sonataflow-builder-image/package.json b/packages/sonataflow-builder-image/package.json index 8819e58502e..6d26f7bf890 100644 --- a/packages/sonataflow-builder-image/package.json +++ b/packages/sonataflow-builder-image/package.json @@ -13,23 +13,38 @@ "url": "https://github.com/apache/incubator-kie-tools/issues" }, "scripts": { - "build:dev": "run-script-if --bool \"$(build-env containerImages.build)\" --then \"pnpm copy-assets\" \"pnpm image:build\"", - "build:prod": "pnpm build:dev && pnpm image:test", + "build": "run-script-if --bool \"$(build-env containerImages.build)\" --then \"pnpm m2-repo-via-http:container:run\" \"pnpm copy-assets\" \"pnpm test\" \"pnpm image:build\" --finally \"pnpm m2-repo-via-http:container:kill\" \"rimraf ./dist/tmp-m2\"", + "build:dev": "pnpm build", + "build:prod": "pnpm build && pnpm image:test", + "copy:maven-m2-repo-via-http-image--settings-xml": "run-script-os", + "copy:maven-m2-repo-via-http-image--settings-xml:linux:darwin": "M2_REPO_VIA_HTTP_URL_WITHOUT_PROTOCOL=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' m2-repo-via-http) envsubst < build/modules/kogito-maven/common/maven/maven-m2-repo-via-http-settings.xml.envsubst > build/modules/kogito-maven/common/maven/maven-m2-repo-via-http-settings.xml && rm build/modules/kogito-maven/common/maven/maven-m2-repo-via-http-settings.xml.envsubst", + "copy:maven-m2-repo-via-http-image--settings-xml:win32": "echo \"Build skipped on macOS and Windows\"", "copy-assets": "run-script-os", - "copy-assets:linux:darwin": "rimraf build && cp -R ./node_modules/@kie-tools/sonataflow-image-common/resources build && cp -R resources/* build", + "copy-assets:linux:darwin": "rimraf build && rsync -av --exclude '*.bats' ./node_modules/@kie-tools/sonataflow-image-common/resources/ build && cp -R resources/* build && pnpm copy:maven-m2-repo-via-http-image--settings-xml", "copy-test-assets": "run-script-os", - "copy-test-assets:linux:darwin": "cp -R ./node_modules/@kie-tools/sonataflow-image-common/test-resources/* build && cp -R test-resources/* build", + "copy-test-assets:linux:darwin": "cp -R test-resources/* build", "format": "prettier --write . --ignore-path=../../.prettierignore --ignore-path=../../.gitignore", "image:build": "run-script-os", - "image:build:darwin:win32": "echo \"Build skipped on macOS and Windows\"", - "image:build:linux": "pnpm setup:env make -C ./build build", - "image:test": "run-script-if --ignore-errors \"$(build-env tests.ignoreFailures)\" --bool \"$(build-env endToEndTests.run)\" --then \"mkdir -p build/target/test/results\" \"run-script-os\" --finally \"cp -r build/target/test/results dist-e2e-tests/\"", + "image:build:darwin:linux": "pnpm setup:env make -C ./build build", + "image:build:win32": "echo \"Build skipped on Windows\"", + "image:test": "run-script-if --ignore-errors \"$(build-env tests.ignoreFailures)\" --bool \"$(build-env endToEndTests.run)\" --then \"mkdir -p build/target/test/results\" \"run-script-os\" --finally \"cp -R build/target/test/results dist-tests-e2e/\"", "image:test:darwin:win32": "echo \"Tests skipped on macOS and Windows\"", "image:test:linux": "pnpm copy-test-assets && pnpm setup:env make -C ./build test-image", "install": "node install.js && pnpm format", - "setup:env": ". ./node_modules/@kie-tools/python-venv/venv/bin/activate && cross-env SWF_IMAGE_REGISTRY=$(build-env sonataflowBuilderImage.registry) SWF_IMAGE_REGISTRY_ACCOUNT=$(build-env sonataflowBuilderImage.account) SWF_IMAGE_NAME=$(build-env sonataflowBuilderImage.name) SWF_IMAGE_TAG=$(build-env sonataflowBuilderImage.tag) QUARKUS_PLATFORM_VERSION=$(build-env quarkusPlatform.version) KOGITO_VERSION=$(build-env kogitoRuntime.version)" + "m2-repo-via-http:container:kill": "(docker container kill m2-repo-via-http || true) && (docker container rm m2-repo-via-http || true)", + "m2-repo-via-http:container:run": "(pnpm m2-repo-via-http:container:kill || true) && docker run --name m2-repo-via-http -v \"$(mvn help:evaluate -Dexpression=settings.localRepository -q -DforceStdout):/var/www/html\" -dit $(build-env sonataflowBuilderImage.dev.mavenM2RepoViaHttpImage)", + "setup:env": ". ./node_modules/@kie-tools/python-venv/venv/bin/activate && cross-env KOGITO_IMAGE_REGISTRY=$(build-env sonataflowBuilderImage.registry) KOGITO_IMAGE_REGISTRY_ACCOUNT=$(build-env sonataflowBuilderImage.account) KOGITO_IMAGE_NAME=$(build-env sonataflowBuilderImage.name) KOGITO_IMAGE_TAG=$(build-env sonataflowBuilderImage.buildTag) QUARKUS_PLATFORM_VERSION=$(build-env quarkusPlatform.version) KOGITO_VERSION=$(build-env kogitoRuntime.version)", + "test": "run-script-os", + "test:cleanup": "mv dist-tests/report.xml dist-tests/junit-report.xml || true", + "test:linux:darwin": "run-script-if --bool \"$(build-env tests.run)\" --then \"pnpm test:setup\" \"pnpm test:run\" --finally \"pnpm test:cleanup\"", + "test:run": "make -C ./build bats || $(build-env tests.ignoreFailures)", + "test:setup": "pnpm copy-test-assets && mkdir -p dist-tests && rm -rf dist-tests/*", + "test:win32": "echo \"Tests are skipped in Windows\"" }, "devDependencies": { + "@kie-tools/image-builder": "workspace:*", + "@kie-tools/maven-base": "workspace:*", + "@kie-tools/maven-m2-repo-via-http-image": "workspace:*", "@kie-tools/python-venv": "workspace:*", "@kie-tools/root-env": "workspace:*", "@kie-tools/sonataflow-image-common": "workspace:*", diff --git a/packages/sonataflow-builder-image/resources/incubator-kie-sonataflow-builder-image.yaml b/packages/sonataflow-builder-image/resources/incubator-kie-sonataflow-builder-image.yaml index a32e547ac9e..5955cbad3a6 100644 --- a/packages/sonataflow-builder-image/resources/incubator-kie-sonataflow-builder-image.yaml +++ b/packages/sonataflow-builder-image/resources/incubator-kie-sonataflow-builder-image.yaml @@ -18,7 +18,7 @@ # - name: builder from: "registry.access.redhat.com/ubi8/openjdk-17:1.19" - version: "0.0.0" + version: "main" modules: repositories: - path: modules @@ -35,7 +35,7 @@ - name: "docker.io/apache/incubator-kie-sonataflow-builder" from: "registry.access.redhat.com/ubi8/openjdk-17:1.19" - version: "0.0.0" + version: "main" description: "Kogito Serverless Workflow base builder with Quarkus extensions libraries preinstalled" labels: diff --git a/packages/sonataflow-builder-image/resources/modules/sonataflow/builder/build-config/module.yaml b/packages/sonataflow-builder-image/resources/modules/sonataflow/builder/build-config/module.yaml index 42fc4129494..02f5a3682c7 100644 --- a/packages/sonataflow-builder-image/resources/modules/sonataflow/builder/build-config/module.yaml +++ b/packages/sonataflow-builder-image/resources/modules/sonataflow/builder/build-config/module.yaml @@ -18,7 +18,7 @@ # schema_version: 1 name: org.kie.sonataflow.builder.build-config -version: "0.0.0" +version: "main" description: "Sonataflow builder image build configuration" envs: diff --git a/packages/sonataflow-builder-image/resources/modules/sonataflow/builder/runtime/community/configure.sh b/packages/sonataflow-builder-image/resources/modules/sonataflow/builder/runtime/community/configure.sh index 8d26bb5940e..66318545159 100644 --- a/packages/sonataflow-builder-image/resources/modules/sonataflow/builder/runtime/community/configure.sh +++ b/packages/sonataflow-builder-image/resources/modules/sonataflow/builder/runtime/community/configure.sh @@ -31,3 +31,6 @@ tar xf "${SOURCES_DIR}"/kogito-swf-maven-repo.tar -C "${KOGITO_HOME}"/.m2/reposi chown -R 1001:0 "${KOGITO_HOME}" chmod -R ug+rwX "${KOGITO_HOME}" + +# Cleanup Maven M2 Repo Via HTTP Settings XML +rm ${MAVEN_CONTAINER_BUILD_SETTINGS_PATH} diff --git a/packages/sonataflow-builder-image/resources/modules/sonataflow/builder/runtime/community/module.yaml b/packages/sonataflow-builder-image/resources/modules/sonataflow/builder/runtime/community/module.yaml index c15fa0af09f..96f4388f0d5 100644 --- a/packages/sonataflow-builder-image/resources/modules/sonataflow/builder/runtime/community/module.yaml +++ b/packages/sonataflow-builder-image/resources/modules/sonataflow/builder/runtime/community/module.yaml @@ -18,7 +18,7 @@ # schema_version: 1 name: org.kie.sonataflow.builder.runtime.community -version: "0.0.0" +version: "main" description: "Sonataflow builder runtime module" artifacts: diff --git a/packages/sonataflow-builder-image/test-resources/modules/sonataflow/common/scripts/tests/bats/sonataflow-builder-build-app.bats b/packages/sonataflow-builder-image/resources/modules/sonataflow/builder/tests/bats/sonataflow-builder-build-app.bats similarity index 78% rename from packages/sonataflow-builder-image/test-resources/modules/sonataflow/common/scripts/tests/bats/sonataflow-builder-build-app.bats rename to packages/sonataflow-builder-image/resources/modules/sonataflow/builder/tests/bats/sonataflow-builder-build-app.bats index 9a85ce1a47a..c6b5748279c 100644 --- a/packages/sonataflow-builder-image/test-resources/modules/sonataflow/common/scripts/tests/bats/sonataflow-builder-build-app.bats +++ b/packages/sonataflow-builder-image/resources/modules/sonataflow/builder/tests/bats/sonataflow-builder-build-app.bats @@ -23,9 +23,9 @@ setup() { export HOME="${KOGITO_HOME}" mkdir -p "${KOGITO_HOME}"/launch mkdir -p "${KOGITO_HOME}"/serverless-workflow-project/src/main/resources/ - cp $BATS_TEST_DIRNAME/../../../../../kogito-logging/added/logging.sh "${KOGITO_HOME}"/launch/ - cp $BATS_TEST_DIRNAME/../../added/jvm-settings.sh "${KOGITO_HOME}"/launch/ - cp $BATS_TEST_DIRNAME/../../added/build-app.sh "${KOGITO_HOME}"/launch/ + cp $BATS_TEST_DIRNAME/../../../../kogito-logging/added/logging.sh "${KOGITO_HOME}"/launch/ + cp $BATS_TEST_DIRNAME/../../../common/scripts/added/jvm-settings.sh "${KOGITO_HOME}"/launch/ + cp $BATS_TEST_DIRNAME/../../../common/scripts/added/build-app.sh "${KOGITO_HOME}"/launch/ } teardown() { @@ -35,7 +35,7 @@ teardown() { @test "verify copy resources is working" { TEMPD=$(mktemp -d) - cp -r $BATS_TEST_DIRNAME/../../../../../../tests/shell/sonataflow-builder/resources/greet-with-inputschema/* ${TEMPD} + cp -R $BATS_TEST_DIRNAME/../../../../../tests/shell/sonataflow-builder/resources/greet-with-inputschema/* ${TEMPD} # We don't care about the errors to try to execute and build the program, just the copy matters source ${KOGITO_HOME}/launch/build-app.sh ${TEMPD} || true diff --git a/packages/sonataflow-deployment-webapp/webpack.config.js b/packages/sonataflow-deployment-webapp/webpack.config.js index 04f5504fcd9..5375790ae26 100644 --- a/packages/sonataflow-deployment-webapp/webpack.config.js +++ b/packages/sonataflow-deployment-webapp/webpack.config.js @@ -27,10 +27,9 @@ const MonacoWebpackPlugin = require("monaco-editor-webpack-plugin"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const swEditorAssets = require("@kie-tools/serverless-workflow-diagram-editor-assets"); const { env } = require("./env"); -const buildEnv = env; -module.exports = async (env) => - merge(common(env), { +module.exports = async (webpackEnv) => + merge(common(webpackEnv), { entry: { index: "./src/index.tsx", "serverless-workflow-combined-editor-envelope": "./src/envelope/ServerlessWorkflowCombinedEditorEnvelopeApp.ts", @@ -95,7 +94,7 @@ module.exports = async (env) => historyApiFallback: false, static: [{ directory: path.join(__dirname, "./dist") }, { directory: path.join(__dirname, "./static") }], compress: true, - port: buildEnv.sonataFlowDeploymentWebapp.dev.port, + port: env.sonataFlowDeploymentWebapp.dev.port, client: { overlay: false, }, diff --git a/packages/sonataflow-devmode-image/README.md b/packages/sonataflow-devmode-image/README.md index 61e0381674c..fd140d5a66f 100644 --- a/packages/sonataflow-devmode-image/README.md +++ b/packages/sonataflow-devmode-image/README.md @@ -24,7 +24,7 @@ image along with the modules and scripts provided in `@kie-tools/sonataflow-imag - **python3** with the following packages installed: - `behave` `lxml` `docker` `docker-squash` `elementPath` `pyyaml` `ruamel.yaml` `python-dateutil` `Jinja2` `pykwalify` `colorlog` `click` -- **cekit 4.11.0**: [docs.cekit.io](https://docs.cekit.io/en/latest/index.html) +- **cekit 4.12.0**: [docs.cekit.io](https://docs.cekit.io/en/latest/index.html) - **s2i**: [source-to-image](https://github.com/openshift/source-to-image) - **make** - **docker** diff --git a/packages/sonataflow-devmode-image/env/index.js b/packages/sonataflow-devmode-image/env/index.js index 660f9197301..2d22f206f0d 100644 --- a/packages/sonataflow-devmode-image/env/index.js +++ b/packages/sonataflow-devmode-image/env/index.js @@ -20,6 +20,10 @@ const { varsWithName, composeEnv, getOrDefault } = require("@kie-tools-scripts/build-env"); const sonataFlowQuarkusDevUiEnv = require("@kie-tools/sonataflow-quarkus-devui/env"); +const { + env: { mavenM2RepoViaHttpImage: mavenM2RepoViaHttpImageEnv }, +} = require("@kie-tools/maven-m2-repo-via-http-image/env"); + const rootEnv = require("@kie-tools/root-env/env"); module.exports = composeEnv([rootEnv], { @@ -51,9 +55,11 @@ module.exports = composeEnv([rootEnv], { registry: getOrDefault(this.vars.SONATAFLOW_DEVMODE_IMAGE__registry), account: getOrDefault(this.vars.SONATAFLOW_DEVMODE_IMAGE__account), name: getOrDefault(this.vars.SONATAFLOW_DEVMODE_IMAGE__name), - tag: getOrDefault(this.vars.SONATAFLOW_DEVMODE_IMAGE__buildTag), - version: require("../package.json").version, + buildTag: getOrDefault(this.vars.SONATAFLOW_DEVMODE_IMAGE__buildTag), sonataflowQuarkusDevUiVersion: getOrDefault(this.vars.SONATAFLOW_DEVMODE_IMAGE__sonataflowQuarkusDevUiVersion), + dev: { + mavenM2RepoViaHttpImage: `${mavenM2RepoViaHttpImageEnv.registry}/${mavenM2RepoViaHttpImageEnv.account}/${mavenM2RepoViaHttpImageEnv.name}:${mavenM2RepoViaHttpImageEnv.buildTag}`, + }, }, }; }, diff --git a/packages/sonataflow-devmode-image/install.js b/packages/sonataflow-devmode-image/install.js index 79fee7113bc..baaa6f34bc7 100644 --- a/packages/sonataflow-devmode-image/install.js +++ b/packages/sonataflow-devmode-image/install.js @@ -20,7 +20,7 @@ const { execSync } = require("child_process"); const fs = require("fs"); -const buildEnv = require("./env"); +const { env } = require("./env"); const path = require("path"); const pythonVenvDir = path.dirname(require.resolve("@kie-tools/python-venv/package.json")); const sonataflowImageCommonDir = path.dirname(require.resolve("@kie-tools/sonataflow-image-common/package.json")); @@ -33,7 +33,7 @@ const activateCmd = execSync( `${activateCmd} && \ - python3 ${sonataflowImageCommonDir}/resources/scripts/versions_manager.py --bump-to ${buildEnv.env.sonataflowDevModeImage.version} --source-folder ./resources`, + python3 ${sonataflowImageCommonDir}/resources/scripts/versions_manager.py --bump-to ${env.sonataflowDevModeImage.buildTag} --source-folder ./resources`, { stdio: "inherit" } ); @@ -47,14 +47,14 @@ if (imageYamlFiles.length !== 1) { const originalYamlPath = path.join(resourcesPath, imageYamlFiles[0]); let imageYaml = fs.readFileSync(originalYamlPath, "utf8"); -const imageUrl = `${buildEnv.env.sonataflowDevModeImage.registry}/${buildEnv.env.sonataflowDevModeImage.account}/${buildEnv.env.sonataflowDevModeImage.name}`; +const imageUrl = `${env.sonataflowDevModeImage.registry}/${env.sonataflowDevModeImage.account}/${env.sonataflowDevModeImage.name}`; // Replace the whole string between quotes ("") with the image name imageYaml = imageYaml.replace(/(?<=")(.*sonataflow-devmode.*)(?=")/gm, imageUrl); // Write file and then rename it to match the image name fs.writeFileSync(originalYamlPath, imageYaml); -fs.renameSync(originalYamlPath, path.join(resourcesPath, `${buildEnv.env.sonataflowDevModeImage.name}-image.yaml`)); +fs.renameSync(originalYamlPath, path.join(resourcesPath, `${env.sonataflowDevModeImage.name}-image.yaml`)); // Replace image URL in .feature files replaceInFile.sync({ diff --git a/packages/sonataflow-devmode-image/package.json b/packages/sonataflow-devmode-image/package.json index d46b4029e61..ea6316d93ce 100644 --- a/packages/sonataflow-devmode-image/package.json +++ b/packages/sonataflow-devmode-image/package.json @@ -13,24 +13,33 @@ "url": "https://github.com/apache/incubator-kie-tools/issues" }, "scripts": { - "build:dev": "run-script-if --bool \"$(build-env containerImages.build)\" --then \"pnpm copy-assets\" \"pnpm image:build\"", - "build:prod": "pnpm build:dev && pnpm image:test", + "build": "run-script-if --bool \"$(build-env containerImages.build)\" --then \"pnpm m2-repo-via-http:container:run\" \"pnpm copy-assets\" \"pnpm image:build\" --finally \"pnpm m2-repo-via-http:container:kill\" \"rimraf ./dist/tmp-m2\"", + "build:dev": "pnpm build", + "build:prod": "pnpm build && pnpm image:test", + "copy:maven-m2-repo-via-http-image--settings-xml": "run-script-os", + "copy:maven-m2-repo-via-http-image--settings-xml:linux:darwin": "M2_REPO_VIA_HTTP_URL_WITHOUT_PROTOCOL=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' m2-repo-via-http) envsubst < build/modules/kogito-maven/common/maven/maven-m2-repo-via-http-settings.xml.envsubst > build/modules/kogito-maven/common/maven/maven-m2-repo-via-http-settings.xml && rm build/modules/kogito-maven/common/maven/maven-m2-repo-via-http-settings.xml.envsubst", + "copy:maven-m2-repo-via-http-image--settings-xml:win32": "echo \"Build skipped on macOS and Windows\"", "copy-assets": "run-script-os", - "copy-assets:linux:darwin": "rimraf build && cp -R ./node_modules/@kie-tools/sonataflow-image-common/resources build && cp -R resources/* build && pnpm copy-devui-repo", - "copy-devui-repo": "tar -C ~/.m2/repository/org/apache/kie/ -cvf build/modules/sonataflow/devmode/build-config/sonataflow-quarkus-devui-maven-repo.tar sonataflow && tar -C ~/.m2/repository/org/kie/ -cvf build/modules/sonataflow/devmode/build-config/kie-tools-maven-base-maven-repo.tar kie-tools-maven-base", + "copy-assets:linux:darwin": "rimraf build && cp -R ./node_modules/@kie-tools/sonataflow-image-common/resources build && cp -R resources/* build && pnpm copy:maven-m2-repo-via-http-image--settings-xml", "copy-test-assets": "run-script-os", - "copy-test-assets:linux:darwin": "cp -R ./node_modules/@kie-tools/sonataflow-image-common/test-resources/* build && cp -R test-resources/* build", + "copy-test-assets:linux:darwin": "cp -R test-resources/* build", "format": "prettier --write . --ignore-path=../../.prettierignore --ignore-path=../../.gitignore", "image:build": "run-script-os", - "image:build:darwin:win32": "echo \"Build skipped on macOS and Windows\"", - "image:build:linux": "pnpm setup:env make -C ./build build", - "image:test": "run-script-if --ignore-errors \"$(build-env tests.ignoreFailures)\" --bool \"$(build-env endToEndTests.run)\" --then \"mkdir -p build/target/test/results\" \"run-script-os\" --finally \"cp -r build/target/test/results dist-e2e-tests/\"", + "image:build:darwin:linux": "pnpm setup:env make -C ./build build", + "image:build:win32": "echo \"Build skipped on Windows\"", + "image:test": "run-script-if --ignore-errors \"$(build-env tests.ignoreFailures)\" --bool \"$(build-env endToEndTests.run)\" --then \"mkdir -p build/target/test/results\" \"run-script-os\" --finally \"cp -R build/target/test/results dist-tests-e2e/\"", "image:test:darwin:win32": "echo \"Tests skipped on macOS and Windows\"", "image:test:linux": "pnpm copy-test-assets && pnpm setup:env make -C ./build test-image", "install": "node install.js && pnpm format", - "setup:env": ". ./node_modules/@kie-tools/python-venv/venv/bin/activate && cross-env SWF_IMAGE_REGISTRY=$(build-env sonataflowDevModeImage.registry) SWF_IMAGE_REGISTRY_ACCOUNT=$(build-env sonataflowDevModeImage.account) SWF_IMAGE_NAME=$(build-env sonataflowDevModeImage.name) SWF_IMAGE_TAG=$(build-env sonataflowDevModeImage.tag) QUARKUS_PLATFORM_VERSION=$(build-env quarkusPlatform.version) KOGITO_VERSION=$(build-env kogitoRuntime.version) SONATAFLOW_QUARKUS_DEVUI_VERSION=$(build-env sonataflowDevModeImage.sonataflowQuarkusDevUiVersion)" + "m2-repo-via-http:container:kill": "(docker container kill m2-repo-via-http || true) && (docker container rm m2-repo-via-http || true)", + "m2-repo-via-http:container:prepare-m2-repo-volume": "node -e 'require(`@kie-tools/maven-base`).prepareHardLinkedM2ForPackage(`./dist/tmp-m2/repository`, `./node_modules/@kie-tools/sonataflow-quarkus-devui`)'", + "m2-repo-via-http:container:run": "(pnpm m2-repo-via-http:container:kill || true) && pnpm m2-repo-via-http:container:prepare-m2-repo-volume && docker run --name m2-repo-via-http -v \"./dist/tmp-m2/repository:/var/www/html\" -dit $(build-env sonataflowDevModeImage.dev.mavenM2RepoViaHttpImage)", + "setup:env": ". ./node_modules/@kie-tools/python-venv/venv/bin/activate && cross-env KOGITO_IMAGE_REGISTRY=$(build-env sonataflowDevModeImage.registry) KOGITO_IMAGE_REGISTRY_ACCOUNT=$(build-env sonataflowDevModeImage.account) KOGITO_IMAGE_NAME=$(build-env sonataflowDevModeImage.name) KOGITO_IMAGE_TAG=$(build-env sonataflowDevModeImage.buildTag) QUARKUS_PLATFORM_VERSION=$(build-env quarkusPlatform.version) KOGITO_VERSION=$(build-env kogitoRuntime.version) SONATAFLOW_QUARKUS_DEVUI_VERSION=$(build-env sonataflowDevModeImage.sonataflowQuarkusDevUiVersion)" }, "devDependencies": { + "@kie-tools/image-builder": "workspace:*", + "@kie-tools/maven-base": "workspace:*", + "@kie-tools/maven-m2-repo-via-http-image": "workspace:*", "@kie-tools/python-venv": "workspace:*", "@kie-tools/root-env": "workspace:*", "@kie-tools/sonataflow-image-common": "workspace:*", diff --git a/packages/sonataflow-devmode-image/resources/incubator-kie-sonataflow-devmode-image.yaml b/packages/sonataflow-devmode-image/resources/incubator-kie-sonataflow-devmode-image.yaml index a4a7f56a14c..8bd15fb6bfd 100644 --- a/packages/sonataflow-devmode-image/resources/incubator-kie-sonataflow-devmode-image.yaml +++ b/packages/sonataflow-devmode-image/resources/incubator-kie-sonataflow-devmode-image.yaml @@ -18,7 +18,7 @@ # - name: builder from: "registry.access.redhat.com/ubi8/openjdk-17:1.19" - version: "0.0.0" + version: "main" modules: repositories: - path: modules @@ -38,7 +38,7 @@ - name: "docker.io/apache/incubator-kie-sonataflow-devmode" from: "registry.access.redhat.com/ubi8/openjdk-17:1.19" - version: "0.0.0" + version: "main" description: "Kogito Serverless Workflow development mode with Quarkus extensions libraries preinstalled" labels: diff --git a/packages/sonataflow-devmode-image/resources/modules/sonataflow/devmode/build-config/configure b/packages/sonataflow-devmode-image/resources/modules/sonataflow/devmode/build-config/configure index 8c27f782926..fa1f6e30291 100644 --- a/packages/sonataflow-devmode-image/resources/modules/sonataflow/devmode/build-config/configure +++ b/packages/sonataflow-devmode-image/resources/modules/sonataflow/devmode/build-config/configure @@ -27,12 +27,14 @@ set -e # -Dpackaging=jar \ # -DgeneratePom=true -ls -la /tmp/artifacts +# ls -la /tmp/artifacts -mkdir -p "${KOGITO_HOME}"/.m2/repository/org/apache/kie/ -mkdir -p "${KOGITO_HOME}"/.m2/repository/org/kie/ -tar xf /tmp/artifacts/sonataflow-quarkus-devui-maven-repo.tar -C "${KOGITO_HOME}"/.m2/repository/org/apache/kie/ -tar xf /tmp/artifacts/kie-tools-maven-base-maven-repo.tar -C "${KOGITO_HOME}"/.m2/repository/org/kie/ +# mkdir -p "${KOGITO_HOME}"/.m2/repository/org/apache/kie/ +# mkdir -p "${KOGITO_HOME}"/.m2/repository/org/kie/ +# tar xf /tmp/artifacts/sonataflow-quarkus-devui-maven-repo.tar -C "${KOGITO_HOME}"/.m2/repository/org/apache/kie/ +# tar xf /tmp/artifacts/kie-tools-maven-base-maven-repo.tar -C "${KOGITO_HOME}"/.m2/repository/org/kie/ -find "${KOGITO_HOME}"/.m2/repository -name _remote.repositories | xargs rm +# find "${KOGITO_HOME}"/.m2/repository -name _remote.repositories | xargs rm + +echo "ok" diff --git a/packages/sonataflow-devmode-image/resources/modules/sonataflow/devmode/build-config/module.yaml b/packages/sonataflow-devmode-image/resources/modules/sonataflow/devmode/build-config/module.yaml index 2150cf0300b..cf41f03bfdf 100644 --- a/packages/sonataflow-devmode-image/resources/modules/sonataflow/devmode/build-config/module.yaml +++ b/packages/sonataflow-devmode-image/resources/modules/sonataflow/devmode/build-config/module.yaml @@ -18,7 +18,7 @@ # schema_version: 1 name: org.kie.sonataflow.devmode.build-config -version: "0.0.0" +version: "main" description: "Kogito Serverless Workflow devmode image build configuration" envs: @@ -29,11 +29,11 @@ envs: # Follow up issue to remove KOGITO_VERSION: https://issues.redhat.com/browse/KOGITO-9270 value: org.apache.kie.sonataflow:sonataflow-quarkus:${KOGITO_VERSION},org.kie:kie-addons-quarkus-knative-eventing:${KOGITO_VERSION},smallrye-health,org.apache.kie.sonataflow:sonataflow-quarkus-devui:${SONATAFLOW_QUARKUS_DEVUI_VERSION},org.kie:kie-addons-quarkus-source-files:${KOGITO_VERSION},org.kie:kie-addons-quarkus-process-management:${KOGITO_VERSION},org.kie:kogito-addons-quarkus-jobs-service-embedded:${KOGITO_VERSION},org.kie:kogito-addons-quarkus-data-index-inmemory:${KOGITO_VERSION},org.kie:kogito-addons-quarkus-microprofile-config-service-catalog:${KOGITO_VERSION},org.kie:kie-addons-quarkus-kubernetes:${KOGITO_VERSION},org.kie:kogito-addons-quarkus-knative-serving:${KOGITO_VERSION} -artifacts: - - name: sonataflow-quarkus-devui-maven-repo.tar - path: ./sonataflow-quarkus-devui-maven-repo.tar - - name: kie-tools-maven-base-maven-repo.tar - path: ./kie-tools-maven-base-maven-repo.tar +# artifacts: +# - name: sonataflow-quarkus-devui-maven-repo.tar +# path: ./sonataflow-quarkus-devui-maven-repo.tar +# - name: kie-tools-maven-base-maven-repo.tar +# path: ./kie-tools-maven-base-maven-repo.tar execute: - script: configure diff --git a/packages/sonataflow-devmode-image/resources/modules/sonataflow/devmode/runtime/common/module.yaml b/packages/sonataflow-devmode-image/resources/modules/sonataflow/devmode/runtime/common/module.yaml index 0cb80d5fd7a..b511ab1e9a5 100644 --- a/packages/sonataflow-devmode-image/resources/modules/sonataflow/devmode/runtime/common/module.yaml +++ b/packages/sonataflow-devmode-image/resources/modules/sonataflow/devmode/runtime/common/module.yaml @@ -18,7 +18,7 @@ # schema_version: 1 name: org.kie.sonataflow.devmode.runtime.common -version: "0.0.0" +version: "main" description: "Kogito Serverless Workflow devmode common module" execute: diff --git a/packages/sonataflow-devmode-image/resources/modules/sonataflow/devmode/runtime/community/configure.sh b/packages/sonataflow-devmode-image/resources/modules/sonataflow/devmode/runtime/community/configure.sh index 7404a5c1e5f..ce0b195d4ec 100644 --- a/packages/sonataflow-devmode-image/resources/modules/sonataflow/devmode/runtime/community/configure.sh +++ b/packages/sonataflow-devmode-image/resources/modules/sonataflow/devmode/runtime/community/configure.sh @@ -32,3 +32,6 @@ tar xf "${SOURCES_DIR}"/kogito-swf-maven-repo.tar -C "${KOGITO_HOME}"/.m2/reposi chown -R 1001:0 "${KOGITO_HOME}" chmod -R ug+rwX "${KOGITO_HOME}" + +# Cleanup Maven M2 Repo Via HTTP Settings XML +rm ${MAVEN_CONTAINER_BUILD_SETTINGS_PATH} \ No newline at end of file diff --git a/packages/sonataflow-devmode-image/resources/modules/sonataflow/devmode/runtime/community/module.yaml b/packages/sonataflow-devmode-image/resources/modules/sonataflow/devmode/runtime/community/module.yaml index db3ac439371..c8cff54bfb0 100644 --- a/packages/sonataflow-devmode-image/resources/modules/sonataflow/devmode/runtime/community/module.yaml +++ b/packages/sonataflow-devmode-image/resources/modules/sonataflow/devmode/runtime/community/module.yaml @@ -18,7 +18,7 @@ # schema_version: 1 name: org.kie.sonataflow.devmode.runtime.community -version: "0.0.0" +version: "main" description: "Kogito Serverless Workflow devmode with required extensions" envs: diff --git a/packages/sonataflow-image-common/.gitignore b/packages/sonataflow-image-common/.gitignore new file mode 100644 index 00000000000..4f8d39e1f12 --- /dev/null +++ b/packages/sonataflow-image-common/.gitignore @@ -0,0 +1,2 @@ +bin/ +bats-home/ \ No newline at end of file diff --git a/packages/sonataflow-image-common/README.md b/packages/sonataflow-image-common/README.md index 71c4aa3c313..d6bf1235a9c 100644 --- a/packages/sonataflow-image-common/README.md +++ b/packages/sonataflow-image-common/README.md @@ -30,7 +30,7 @@ The contents of this package are: - **python3** with the following packages installed: - `behave` `lxml` `docker` `docker-squash` `elementPath` `pyyaml` `ruamel.yaml` `python-dateutil` `Jinja2` `pykwalify` `colorlog` `click` -- **cekit 4.11.0**: [docs.cekit.io](https://docs.cekit.io/en/latest/index.html) +- **cekit 4.12.0**: [docs.cekit.io](https://docs.cekit.io/en/latest/index.html) - **make** - **docker** @@ -38,10 +38,10 @@ The contents of this package are: To build and tests the images the package provides a convenient `Makefile` that will do the hard work for you. It relies in the following Envs (or arguments): -- `SWF_IMAGE_NAME`: (required) Specifies the image name to build. It should match the image descriptor. -- `SWF_IMAGE_REGISTRY`: Image registry to use, defaults to 'docker.io' -- `SWF_IMAGE_REGISTRY_ACCOUNT`: Image registry account to use, defaults to 'apache' -- `SWF_IMAGE_TAG`: Custom tag for the image. If not provided it will use the version in the image descriptor. +- `KOGITO_IMAGE_NAME`: (required) Specifies the image name to build. It should match the image descriptor. +- `KOGITO_IMAGE_REGISTRY`: Image registry to use, defaults to 'docker.io' +- `KOGITO_IMAGE_REGISTRY_ACCOUNT`: Image registry account to use, defaults to 'apache' +- `KOGITO_IMAGE_TAG`: Custom tag for the image. If not provided it will use the version in the image descriptor. - `QUARKUS_PLATFORM_VERSION`: (required) Quarkus platform version to use inside the image. - `KOGITO_VERSION`: (required) Kogito platform version to use inside the image. @@ -50,6 +50,9 @@ To build and tests the images the package provides a convenient `Makefile` that - `BUILD_ENGINE`: (docker/podman) engine used to build the image, defaults to docker - `BUILD_ENGINE_OPTIONS`: extra build options to pass to the build engine +- `KOGITO_APPS_TARGET_BRANCH`: Target branch from where to pull the Kogito Apps code, defaults to `main` +- `KOGITO_APPS_TARGET_URI`: Target repository URI from where to pull the Kogito Apps code, defaults to 'https://github.com/apache/incubator-kie-kogito-apps.git' + ## Building images.. - Copy your image descriptor and modules along with the contents of the `resources` into a separate folder (eg: `/tmp/build`) diff --git a/packages/sonataflow-image-common/env/index.js b/packages/sonataflow-image-common/env/index.js index fd84bd0e7a2..61bc742bd66 100644 --- a/packages/sonataflow-image-common/env/index.js +++ b/packages/sonataflow-image-common/env/index.js @@ -22,10 +22,6 @@ const { varsWithName, composeEnv } = require("@kie-tools-scripts/build-env"); module.exports = composeEnv([require("@kie-tools/root-env/env")], { vars: varsWithName({}), get env() { - return { - sonataflowImageCommon: { - version: require("../package.json").version, - }, - }; + return {}; }, }); diff --git a/packages/sonataflow-image-common/install.js b/packages/sonataflow-image-common/install.js index 66430aad443..6ba30c8d70d 100644 --- a/packages/sonataflow-image-common/install.js +++ b/packages/sonataflow-image-common/install.js @@ -19,7 +19,7 @@ const { execSync } = require("child_process"); -const buildEnv = require("./env"); +const { env } = require("./env"); const path = require("path"); const pythonVenvDir = path.dirname(require.resolve("@kie-tools/python-venv/package.json")); @@ -30,6 +30,11 @@ const activateCmd = execSync( `${activateCmd} && \ - python3 ./resources/scripts/versions_manager.py --bump-to ${buildEnv.env.sonataflowImageCommon.version} --source-folder ./resources`, + python3 ./resources/scripts/versions_manager.py --bump-to ${env.root.streamName} --source-folder ./resources`, { stdio: "inherit" } ); + +// Install bats +if (process.platform !== "win32") { + execSync(`. ./resources/scripts/install_bats.sh`, { stdio: "inherit" }); +} diff --git a/packages/sonataflow-image-common/package.json b/packages/sonataflow-image-common/package.json index 48c6e347535..2a307a83e2d 100644 --- a/packages/sonataflow-image-common/package.json +++ b/packages/sonataflow-image-common/package.json @@ -13,17 +13,24 @@ "url": "https://github.com/apache/incubator-kie-tools/issues" }, "scripts": { - "install": "node install.js" + "build:prod": "pnpm test", + "install": "node install.js", + "test": "run-script-os", + "test:linux:darwin": "run-script-if --ignore-errors \"$(build-env tests.ignoreFailures)\" --bool \"$(build-env tests.run)\" --then \"mkdir -p dist-tests\" \"rm -rf dist-tests/*\" \"make -C ./resources bats\" --finally \"touch dist-tests/report.xml\" \"mv dist-tests/report.xml dist-tests/junit-report.xml\"", + "test:win32": "echo \"Tests are skipped in Windows\"" }, "devDependencies": { "@kie-tools/python-venv": "workspace:*", - "@kie-tools/root-env": "workspace:*" + "@kie-tools/root-env": "workspace:*", + "run-script-os": "^1.1.6" }, "kieTools": { "requiredPreinstalledCliCommands": [ "python3", "pip3", - "make" + "make", + "s2i", + "xmllint" ] } } diff --git a/packages/sonataflow-image-common/resources/Makefile b/packages/sonataflow-image-common/resources/Makefile index 79c1803284a..834de6f6efc 100644 --- a/packages/sonataflow-image-common/resources/Makefile +++ b/packages/sonataflow-image-common/resources/Makefile @@ -19,33 +19,33 @@ # Image build envs CEKIT_BUILD_OPTIONS ?= -CEKIT_CMD := cekit ${CEKIT_BUILD_OPTIONS} +CEKIT_CMD := cekit BUILD_ENGINE ?= docker BUILD_ENGINE_OPTIONS ?= -# Resolving the current image version from the kogito.project.versions module. Cekit will use it to tag the image. -CURRENT_IMAGE_VERSION := $(shell python3 scripts/retrieve_version.py) - # SWF Image creation envs -SWF_IMAGE_NAME ?= # Image name -SWF_IMAGE_REGISTRY ?= 'docker.io' -SWF_IMAGE_REGISTRY_ACCOUNT ?= 'apache' -SWF_IMAGE_TAG ?= $(CURRENT_IMAGE_VERSION) # Setting a default value if SWF_IMAGE_TAG env is not present -SWF_FULL_IMAGE_NAME := $(SWF_IMAGE_REGISTRY)/$(SWF_IMAGE_REGISTRY_ACCOUNT)/$(SWF_IMAGE_NAME) -SWF_IMAGE_FILENAME := ${SWF_IMAGE_NAME}-image.yaml +KOGITO_IMAGE_NAME ?= # Image name +KOGITO_IMAGE_REGISTRY ?= 'docker.io' +KOGITO_IMAGE_REGISTRY_ACCOUNT ?= 'apache' +KOGITO_IMAGE_TAG ?= $(shell pnpm build-env root.streamName) # Setting a default value if KOGITO_IMAGE_TAG env is not present +KOGITO_FULL_IMAGE_NAME := $(KOGITO_IMAGE_REGISTRY)/$(KOGITO_IMAGE_REGISTRY_ACCOUNT)/$(KOGITO_IMAGE_NAME) +KOGITO_IMAGE_FILENAME := ${KOGITO_IMAGE_NAME}-image.yaml + +# Services Applications Image Build +KOGITO_APPS_TARGET_URI ?= 'https://github.com/apache/incubator-kie-kogito-apps.git' -_check_swf_image_name: -ifndef SWF_IMAGE_NAME - $(error Cannot build image, please provide a valid image name using the SWF_IMAGE_NAME env) +_check_kogito_image_name: +ifndef KOGITO_IMAGE_NAME + $(error Cannot build image, please provide a valid image name using the KOGITO_IMAGE_NAME env) endif # Check if there are Quarkus and Kogito version envs _check_versions: ifndef QUARKUS_PLATFORM_VERSION - $(error Cannot build image, please provide a valid Quarkus version using the QUARKUS_PLATFORM_VERSION env) + $(error Cannot build image, please provide a valid Quarkus version using the QUARKUS_PLATFORM_VERSION env) endif ifndef KOGITO_VERSION - $(error Cannot build image, please provide a valid Kogito version using the KOGITO_VERSION env) + $(error Cannot build image, please provide a valid Kogito version using the KOGITO_VERSION env) endif # Upgrade Quarkus & Kogito versions in the images and modules @@ -60,28 +60,26 @@ _fix_platform_versions: _check_versions _run_version_manager # Building the SWF image with Cekit _cekit_build: - ${CEKIT_CMD} --descriptor ${SWF_IMAGE_FILENAME} build ${CEKIT_BUILD_OPTIONS} ${BUILD_ENGINE} ${BUILD_ENGINE_OPTIONS} --tag ${SWF_FULL_IMAGE_NAME}:${CURRENT_IMAGE_VERSION} --tag ${SWF_FULL_IMAGE_NAME}:${SWF_IMAGE_TAG} --tag ${SWF_FULL_IMAGE_NAME}:latest - -# Tagging the generated image if SWF_IMAGE_TAG doesn't match the CURRENT_IMAGE_VERSION -# Currently unused, as cekit will tag the image for us -_tag_image: -ifneq ($(SWF_IMAGE_TAG), $(CURRENT_IMAGE_VERSION)) - ${BUILD_ENGINE} tag ${SWF_FULL_IMAGE_NAME}:${CURRENT_IMAGE_VERSION} ${SWF_FULL_IMAGE_NAME}:${SWF_IMAGE_TAG} -endif + ${CEKIT_CMD} --descriptor ${KOGITO_IMAGE_FILENAME} build ${CEKIT_BUILD_OPTIONS} ${BUILD_ENGINE} ${BUILD_ENGINE_OPTIONS} --tag ${KOGITO_FULL_IMAGE_NAME}:${KOGITO_IMAGE_TAG} _create_e2e_dir: rm -rf ../dist-tests-e2e mkdir ../dist-tests-e2e +# Pull kogito-apps repo and build the target kogito-apps depending on the `KOGITO_IMAGE_NAME`s +# Required for kogito-apps images only +.PHONY build-kogito-app: _build_kogito_app +_build_kogito_app: + scripts/build-kogito-apps-components.sh ${KOGITO_IMAGE_NAME} ${KOGITO_VERSION} ${KOGITO_APPS_TARGET_URI}; + # Trigger the image tests -.PHONY test-image: _create_e2e_dir _check_swf_image_name bats _test_image +.PHONY test-image: _create_e2e_dir _check_kogito_image_name _test_image _test_image: - ${CEKIT_CMD} --descriptor ${SWF_IMAGE_FILENAME} test behave - tests/shell/run.sh ${SWF_IMAGE_NAME} ${SWF_FULL_IMAGE_NAME}:${SWF_IMAGE_TAG} + tests/shell/run.sh ${KOGITO_IMAGE_NAME} ${KOGITO_FULL_IMAGE_NAME}:${KOGITO_IMAGE_TAG} + ${CEKIT_CMD} --descriptor ${KOGITO_IMAGE_FILENAME} test behave -.PHONY build: _check_swf_image_name _fix_platform_versions _cekit_build +.PHONY build: _check_kogito_image_name _fix_platform_versions _cekit_build # run bat tests locally -.PHONY: bats bats: - ./scripts/run-bats.sh \ No newline at end of file + @./scripts/run-bats.sh diff --git a/packages/sonataflow-image-common/resources/modules/kogito-custom-truststore/README.md b/packages/sonataflow-image-common/resources/modules/kogito-custom-truststore/README.md new file mode 100644 index 00000000000..0e314ba075d --- /dev/null +++ b/packages/sonataflow-image-common/resources/modules/kogito-custom-truststore/README.md @@ -0,0 +1,71 @@ + + +# Kogito Custom TrustStore Module + +This module adds the possibility to override the default Java TrustStore in the JVM process for any Kogito Service. + +## How to Use + +1. Add the self-signed certificates or your in-house certificates to the default JKS `cacerts` (or you can start a new one from scratch). + [Keystore Explorer](https://keystore-explorer.org/) is a great tool to manipulate JKS + +2. Mount your file anywhere in your system using `docker volume`: + +```shell +$ docker volume inspect truststores +[ + { + "CreatedAt": "2021-03-23T12:53:18-03:00", + "Driver": "local", + "Labels": null, + "Mountpoint": "/var/lib/docker/volumes/truststores/_data", + "Name": "truststores", + "Options": null, + "Scope": "local" + } +] +``` + +Make sure to move the `cacerts` file to `/var/lib/docker/volumes/truststores/_data` directory. + +3. Mount this volume when running your Kogito service: + +```shell +$ docker run --rm -it \ + -e CUSTOM_TRUSTSTORE=cacerts \ + -e CUSTOM_TRUSTSTORE_PASSWORD=changeit \ + -p 8080:8080 \ + --mount source=truststores,target=/home/kogito/certs \ + custom-truststore +``` + +You should see the following message in the console if everything went fine: + +```log +INFO ---> Configuring custom Java Truststore 'cacerts' in the path /home/kogito/certs/custom-truststore +``` + +## Key Takeaways + +1. Make sure that the path is `/home/kogito/certs/custom-truststore`. The image **WON'T** read the certificate from anywhere else + +2. The environment variable `CUSTOM_TRUSTSTORE` will tell the image the name of the desired file to read + +3. `CUSTOM_TRUSTSTORE_PASSWORD` is an optional parameter, but it's a good practice to always have it set. The default password for `cacerts` store is `changeit` diff --git a/packages/sonataflow-image-common/resources/modules/kogito-custom-truststore/added/configure-custom-truststore.sh b/packages/sonataflow-image-common/resources/modules/kogito-custom-truststore/added/configure-custom-truststore.sh new file mode 100755 index 00000000000..3438a0d4e5d --- /dev/null +++ b/packages/sonataflow-image-common/resources/modules/kogito-custom-truststore/added/configure-custom-truststore.sh @@ -0,0 +1,54 @@ +#!/bin/bash +# +# 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. +# +set -e + +# imports +# shellcheck source=/dev/null +source "${KOGITO_HOME}"/launch/logging.sh + +function prepareEnv() { + # keep it on alphabetical order + unset CUSTOM_TRUSTSTORE + unset CUSTOM_TRUSTSTORE_PASSWORD +} + +function configure() { + configure_custom_truststore +} + +# Exit codes +# 1 - General error +function configure_custom_truststore() { + local defaultCustomTruststorePath="${KOGITO_HOME}/certs/custom-truststore" + + if [ ! -z "${CUSTOM_TRUSTSTORE}" ]; then + CUSTOM_TRUSTSTORE_PATH="${defaultCustomTruststorePath}/${CUSTOM_TRUSTSTORE}" + log_info "---> Configuring custom Java Truststore '${CUSTOM_TRUSTSTORE}' in the path ${defaultCustomTruststorePath}" + if [ ! -f "${CUSTOM_TRUSTSTORE_PATH}" ]; then + log_error "---> A custom truststore was specified ('${CUSTOM_TRUSTSTORE}'), but wasn't found in the path ${defaultCustomTruststorePath}. \ +Make sure that the path is mounted and accessible in your container" + exit 1 + fi + CUSTOM_TRUSTSTORE_ARGS="-Djavax.net.ssl.trustStore=${CUSTOM_TRUSTSTORE_PATH}" + if [ ! -z "${CUSTOM_TRUSTSTORE_PASSWORD}" ]; then + CUSTOM_TRUSTSTORE_ARGS="${CUSTOM_TRUSTSTORE_ARGS} -Djavax.net.ssl.trustStorePassword=${CUSTOM_TRUSTSTORE_PASSWORD}" + fi + fi +} diff --git a/packages/sonataflow-image-common/resources/modules/kogito-custom-truststore/configure b/packages/sonataflow-image-common/resources/modules/kogito-custom-truststore/configure new file mode 100644 index 00000000000..ddd815e3ec2 --- /dev/null +++ b/packages/sonataflow-image-common/resources/modules/kogito-custom-truststore/configure @@ -0,0 +1,25 @@ +#!/bin/sh +# +# 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. +# +SCRIPT_DIR=$(dirname "${0}") + +# custom truststore configuration +mkdir -p "${KOGITO_HOME}"/launch/ +cp -v "${SCRIPT_DIR}"/added/* "${KOGITO_HOME}"/launch/ +chmod +x-w "${KOGITO_HOME}"/launch/configure-custom-truststore.sh \ No newline at end of file diff --git a/packages/sonataflow-image-common/resources/modules/kogito-custom-truststore/module.yaml b/packages/sonataflow-image-common/resources/modules/kogito-custom-truststore/module.yaml new file mode 100644 index 00000000000..a608b6bf988 --- /dev/null +++ b/packages/sonataflow-image-common/resources/modules/kogito-custom-truststore/module.yaml @@ -0,0 +1,33 @@ +# +# 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. +# +schema_version: 1 +name: org.kie.kogito.security.custom.truststores +version: "main" +description: "Adds the capability of configuring a custom Java Truststore to replace the original cacerts" + +envs: + - name: "CUSTOM_TRUSTORE" + description: ^ Custom JVM Truststore certificate (JKS format) that will replace the original cacerts file when executing the JVM process within the image. + example: "my-own-cacerts.jks" + - name: "CUSTOM_TRUSTSTORE_PASSWORD" + description: ^ Password to for the custom JKS Truststore certificate. Ideally defined on containers platforms using Secrets. + example: "changeit" + +execute: + - script: configure diff --git a/packages/sonataflow-image-common/resources/modules/kogito-custom-truststore/tests/bats/kogito-custom-truststore.bats b/packages/sonataflow-image-common/resources/modules/kogito-custom-truststore/tests/bats/kogito-custom-truststore.bats new file mode 100644 index 00000000000..8ed0c4ac7a2 --- /dev/null +++ b/packages/sonataflow-image-common/resources/modules/kogito-custom-truststore/tests/bats/kogito-custom-truststore.bats @@ -0,0 +1,75 @@ +#!/usr/bin/env bats +# +# 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. +# + + +export KOGITO_HOME=/tmp/kogito +export HOME="${KOGITO_HOME}" +mkdir -p "${KOGITO_HOME}"/launch +cp $BATS_TEST_DIRNAME/../../../kogito-logging/added/logging.sh "${KOGITO_HOME}"/launch/ + +load $BATS_TEST_DIRNAME/../../added/configure-custom-truststore.sh + +teardown() { + rm -rf "${KOGITO_HOME}" +} + +@test "fail case when the custom certificate is not present in the expected path" { + prepareEnv + + local expected=1 + export CUSTOM_TRUSTSTORE=my-cert.jks + + run configure + + echo "Result is [$status] and expected is [${expected}]" >&2 + [ "$status" = "${expected}" ] + echo "Output is: ${lines[@]}" + [[ "${lines[1]}" == *"ERROR ---> A custom truststore was specified"* ]] +} + +@test "success case when the custom certificate is present in the expected path" { + prepareEnv + + local expected=0 + local pathExpected="${KOGITO_HOME}/certs/custom-truststore/my-cert.jks" + + mkdir -p ${KOGITO_HOME}/certs/custom-truststore + touch ${KOGITO_HOME}/certs/custom-truststore/my-cert.jks + CUSTOM_TRUSTSTORE=my-cert.jks + + run configure + + echo "Result is [$status] and expected is [${expected}]" >&2 + [ "$status" = "${expected}" ] + echo "Output is: ${lines[@]}" + [ "${lines[0]}" = "INFO ---> Configuring custom Java Truststore 'my-cert.jks' in the path /tmp/kogito/certs/custom-truststore" ] +} + +@test "success case when no custom certificate is given" { + local expected=0 + + prepareEnv + run configure + + echo "Result is [$status] and expected is [${expected}]" >&2 + [ "$status" = "${expected}" ] + echo "Truststore Args should be empty, but was ${CUSTOM_TRUSTSTORE_ARGS}" >&2 + [ "${CUSTOM_TRUSTSTORE_ARGS}" = "" ] +} diff --git a/packages/sonataflow-image-common/resources/modules/kogito-data-index-common/added/kogito-data-index-common.sh b/packages/sonataflow-image-common/resources/modules/kogito-data-index-common/added/kogito-data-index-common.sh new file mode 100644 index 00000000000..273aa713abb --- /dev/null +++ b/packages/sonataflow-image-common/resources/modules/kogito-data-index-common/added/kogito-data-index-common.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +# +# 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. +# + + +source "${KOGITO_HOME}"/launch/logging.sh + +function prepareEnv() { + # keep it on alphabetical order + unset KOGITO_DATA_INDEX_QUARKUS_PROFILE +} + +function configure() { + configure_data_index_quarkus_profile +} + +function configure_data_index_quarkus_profile() { + local quarkusProfile=${KOGITO_DATA_INDEX_QUARKUS_PROFILE} + KOGITO_DATA_INDEX_PROPS="${KOGITO_DATA_INDEX_PROPS} -Dquarkus.profile=${quarkusProfile}" +} \ No newline at end of file diff --git a/packages/sonataflow-image-common/resources/modules/kogito-data-index-common/configure b/packages/sonataflow-image-common/resources/modules/kogito-data-index-common/configure new file mode 100644 index 00000000000..fc3e5005588 --- /dev/null +++ b/packages/sonataflow-image-common/resources/modules/kogito-data-index-common/configure @@ -0,0 +1,29 @@ +#!/bin/sh +# +# 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. +# +set -e + +SCRIPT_DIR=$(dirname "${0}") +ADDED_DIR="${SCRIPT_DIR}"/added +mkdir -p "${KOGITO_HOME}"/launch + +mkdir -p "${KOGITO_HOME}"/data/protobufs/ + +cp -v "${ADDED_DIR}"/kogito-data-index-common.sh "${KOGITO_HOME}"/launch +chmod +x-w "${KOGITO_HOME}"/launch/kogito-data-index-common.sh \ No newline at end of file diff --git a/packages/sonataflow-image-common/resources/modules/kogito-data-index-common/module.yaml b/packages/sonataflow-image-common/resources/modules/kogito-data-index-common/module.yaml new file mode 100644 index 00000000000..c820da3bd1a --- /dev/null +++ b/packages/sonataflow-image-common/resources/modules/kogito-data-index-common/module.yaml @@ -0,0 +1,30 @@ +# +# 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. +# +schema_version: 1 +name: org.kie.kogito.dataindex.common +version: "main" +description: "Common modules for data-index persistence provider images, any addition that is common must be added in this module" + +envs: + - name: "KOGITO_DATA_INDEX_QUARKUS_PROFILE" + value: "kafka-events-support" + description: "Allows to change the event connection type. The possible values are :`kafka-events-support`(default) or `http-events-support`" + +execute: + - script: configure diff --git a/packages/sonataflow-image-common/resources/modules/kogito-data-index-common/tests/bats/kogito-data-index-common.bats b/packages/sonataflow-image-common/resources/modules/kogito-data-index-common/tests/bats/kogito-data-index-common.bats new file mode 100644 index 00000000000..e660056d9df --- /dev/null +++ b/packages/sonataflow-image-common/resources/modules/kogito-data-index-common/tests/bats/kogito-data-index-common.bats @@ -0,0 +1,55 @@ +#!/usr/bin/env bats +# +# 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. +# + + +export KOGITO_HOME=/tmp/kogito +export HOME="${KOGITO_HOME}" +mkdir -p "${KOGITO_HOME}"/launch +cp $BATS_TEST_DIRNAME/../../../kogito-logging/added/logging.sh "${KOGITO_HOME}"/launch/ + +# imports +load $BATS_TEST_DIRNAME/../../added/kogito-data-index-common.sh + + +teardown() { + rm -rf "${KOGITO_HOME}" +} + +@test "check if the default quarkus profile is correctly set on data index" { + local expected=" -Dquarkus.profile=" + + prepareEnv + + configure_data_index_quarkus_profile + echo "Result is [${KOGITO_DATA_INDEX_PROPS}] and expected is [${expected}]" + [ "${expected}" = "${KOGITO_DATA_INDEX_PROPS}" ] +} + +@test "check if a provided data index quarkus profile is correctly set on data index" { + local expected=" -Dquarkus.profile=http-events-support" + + prepareEnv + export KOGITO_DATA_INDEX_QUARKUS_PROFILE="http-events-support" + + configure_data_index_quarkus_profile + echo "Result is [${KOGITO_DATA_INDEX_PROPS}] and expected is [${expected}]" + [ "${expected}" = "${KOGITO_DATA_INDEX_PROPS}" ] +} + diff --git a/packages/sonataflow-image-common/resources/modules/kogito-dynamic-resources/module.yaml b/packages/sonataflow-image-common/resources/modules/kogito-dynamic-resources/module.yaml index 8761f126a4f..c4d5726d4ec 100644 --- a/packages/sonataflow-image-common/resources/modules/kogito-dynamic-resources/module.yaml +++ b/packages/sonataflow-image-common/resources/modules/kogito-dynamic-resources/module.yaml @@ -18,7 +18,7 @@ # schema_version: 1 name: org.kie.kogito.dynamic.resources -version: "0.0.0" +version: "main" description: -| Module retrieved from https://github.com/jboss-openshift/cct_module/blob/master/jboss/container/java/jvm/bash However it contains a few customizations to fit Kogito needs. diff --git a/packages/sonataflow-image-common/test-resources/modules/sonataflow/common/scripts/tests/bats/sonataflow-builder-jvm-settings.bats b/packages/sonataflow-image-common/resources/modules/kogito-dynamic-resources/tests/bats/sonataflow-builder-jvm-settings.bats similarity index 88% rename from packages/sonataflow-image-common/test-resources/modules/sonataflow/common/scripts/tests/bats/sonataflow-builder-jvm-settings.bats rename to packages/sonataflow-image-common/resources/modules/kogito-dynamic-resources/tests/bats/sonataflow-builder-jvm-settings.bats index a0487e8d477..2ba04247421 100644 --- a/packages/sonataflow-image-common/test-resources/modules/sonataflow/common/scripts/tests/bats/sonataflow-builder-jvm-settings.bats +++ b/packages/sonataflow-image-common/resources/modules/kogito-dynamic-resources/tests/bats/sonataflow-builder-jvm-settings.bats @@ -24,10 +24,10 @@ export HOME="${KOGITO_HOME}" export JBOSS_CONTAINER_JAVA_JVM_MODULE=/tmp/container/java/jvm mkdir -p "${KOGITO_HOME}"/launch mkdir -p "${JBOSS_CONTAINER_JAVA_JVM_MODULE}" -cp $BATS_TEST_DIRNAME/../../../../../kogito-logging/added/logging.sh "${KOGITO_HOME}"/launch/ -cp -r $BATS_TEST_DIRNAME/../../../../../kogito-dynamic-resources/added/* "${JBOSS_CONTAINER_JAVA_JVM_MODULE}"/ +cp $BATS_TEST_DIRNAME/../../../kogito-logging/added/logging.sh "${KOGITO_HOME}"/launch/ +cp -R $BATS_TEST_DIRNAME/../../added/* "${JBOSS_CONTAINER_JAVA_JVM_MODULE}"/ chmod -R +x "${JBOSS_CONTAINER_JAVA_JVM_MODULE}" -cp $BATS_TEST_DIRNAME/../../added/jvm-settings.sh "${KOGITO_HOME}"/launch/ +cp $BATS_TEST_DIRNAME/../../../sonataflow/common/scripts/added/jvm-settings.sh "${KOGITO_HOME}"/launch/ teardown() { rm -rf "${KOGITO_HOME}" diff --git a/packages/sonataflow-image-common/resources/modules/kogito-jobs-service-common/added/launch/kogito-jobs-service-common.sh b/packages/sonataflow-image-common/resources/modules/kogito-jobs-service-common/added/launch/kogito-jobs-service-common.sh new file mode 100644 index 00000000000..b5c8c61315c --- /dev/null +++ b/packages/sonataflow-image-common/resources/modules/kogito-jobs-service-common/added/launch/kogito-jobs-service-common.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash +# +# 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. +# + + +source "${KOGITO_HOME}"/launch/logging.sh + +function prepareEnv() { + # keep it on alphabetical order + unset ENABLE_EVENTS +} + +function configure() { + configure_jobs_service_events +} + +function configure_jobs_service_events() { + if [ "${ENABLE_EVENTS^^}" == "TRUE" ]; then + KOGITO_JOBS_PROPS="${KOGITO_JOBS_PROPS} -Dquarkus.profile=events-support" + fi +} \ No newline at end of file diff --git a/packages/sonataflow-image-common/resources/modules/kogito-jobs-service-common/configure b/packages/sonataflow-image-common/resources/modules/kogito-jobs-service-common/configure new file mode 100644 index 00000000000..34732d31e86 --- /dev/null +++ b/packages/sonataflow-image-common/resources/modules/kogito-jobs-service-common/configure @@ -0,0 +1,29 @@ +#!/bin/sh +# +# 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. +# +set -e + +SOURCES_DIR=/tmp/artifacts +SCRIPT_DIR=$(dirname "${0}") +ADDED_DIR="${SCRIPT_DIR}"/added + +cp -Rv "${ADDED_DIR}"/launch/* "${KOGITO_HOME}"/launch/ + +chown -R 1001:0 "${KOGITO_HOME}" +chmod -R ug+rwX "${KOGITO_HOME}" diff --git a/packages/sonataflow-image-common/resources/modules/kogito-jobs-service-common/module.yaml b/packages/sonataflow-image-common/resources/modules/kogito-jobs-service-common/module.yaml new file mode 100644 index 00000000000..9ea6355e8cd --- /dev/null +++ b/packages/sonataflow-image-common/resources/modules/kogito-jobs-service-common/module.yaml @@ -0,0 +1,25 @@ +# +# 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. +# +schema_version: 1 +name: org.kie.kogito.jobs.service.common +version: "main" +description: "This module needs to be run last, if adding it, add in the last position." + +execute: + - script: configure diff --git a/packages/sonataflow-image-common/resources/modules/kogito-jobs-service-common/tests/bats/kogito-jobs-service-common.bats b/packages/sonataflow-image-common/resources/modules/kogito-jobs-service-common/tests/bats/kogito-jobs-service-common.bats new file mode 100644 index 00000000000..f6ab9514e9a --- /dev/null +++ b/packages/sonataflow-image-common/resources/modules/kogito-jobs-service-common/tests/bats/kogito-jobs-service-common.bats @@ -0,0 +1,46 @@ +#!/usr/bin/env bats +# +# 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. +# + + +export KOGITO_HOME=/tmp/kogito +export HOME="${KOGITO_HOME}" +mkdir -p "${KOGITO_HOME}"/launch +cp $BATS_TEST_DIRNAME/../../../kogito-logging/added/logging.sh "${KOGITO_HOME}"/launch/ + +# imports +load $BATS_TEST_DIRNAME/../../added/launch/kogito-jobs-service-common.sh + + +teardown() { + rm -rf "${KOGITO_HOME}" +} + +@test "check if the event is correctly set on jobs service" { + export ENABLE_EVENTS="true" + configure_jobs_service_events + + result="${KOGITO_JOBS_PROPS}" + expected=" -Dquarkus.profile=events-support" + + echo "Result is ${result} and expected is ${expected}" + [ "${result}" = "${expected}" ] +} + + diff --git a/packages/sonataflow-image-common/resources/modules/kogito-launch-scripts/module.yaml b/packages/sonataflow-image-common/resources/modules/kogito-launch-scripts/module.yaml index 801c65cb8f1..e875cf36849 100644 --- a/packages/sonataflow-image-common/resources/modules/kogito-launch-scripts/module.yaml +++ b/packages/sonataflow-image-common/resources/modules/kogito-launch-scripts/module.yaml @@ -18,7 +18,7 @@ # schema_version: 1 name: org.kie.kogito.launch.scripts -version: "0.0.0" +version: "main" execute: - script: configure diff --git a/packages/sonataflow-image-common/resources/modules/kogito-logging/module.yaml b/packages/sonataflow-image-common/resources/modules/kogito-logging/module.yaml index 238ed43465f..85c04ff8703 100644 --- a/packages/sonataflow-image-common/resources/modules/kogito-logging/module.yaml +++ b/packages/sonataflow-image-common/resources/modules/kogito-logging/module.yaml @@ -18,7 +18,7 @@ # schema_version: 1 name: org.kie.kogito.logging -version: "0.0.0" +version: "main" execute: - script: configure diff --git a/packages/sonataflow-image-common/resources/modules/kogito-maven/common/maven/maven-m2-repo-via-http-settings.xml.envsubst b/packages/sonataflow-image-common/resources/modules/kogito-maven/common/maven/maven-m2-repo-via-http-settings.xml.envsubst new file mode 100644 index 00000000000..e85c5fc1703 --- /dev/null +++ b/packages/sonataflow-image-common/resources/modules/kogito-maven/common/maven/maven-m2-repo-via-http-settings.xml.envsubst @@ -0,0 +1,107 @@ + + + + kie-tools--maven-m2-repo-via-http-allowed + kie-tools--maven-m2-repo-via-http + Mirror to override default blocking mirror that blocks http. + http://$M2_REPO_VIA_HTTP_URL_WITHOUT_PROTOCOL + + + + + + + + + + + + kie-tools--maven-m2-repo-via-http-allowed-profile + + true + + + + kie-tools--maven-m2-repo-via-http + KIE Tools :: Maven M2 Repo via HTTP + http://$M2_REPO_VIA_HTTP_URL_WITHOUT_PROTOCOL/ + default + + true + never + + + true + never + + + + + + + kie-tools--maven-m2-repo-via-http + KIE Tools :: Maven M2 Repo via HTTP + http://$M2_REPO_VIA_HTTP_URL_WITHOUT_PROTOCOL/ + default + + true + never + + + true + never + + + + + + + kogito-images + + + apache-public-repository-group + Apache Public Repository Group + https://repository.apache.org/content/groups/public/ + default + + true + never + + + true + never + + + + + + + + apache-public-repository-group + Apache Public Repository Group + https://repository.apache.org/content/groups/public/ + default + + true + never + + + true + never + + + + + + + + + kogito-images + kie-tools--maven-m2-repo-via-http-allowed-profile + + diff --git a/packages/sonataflow-image-common/resources/modules/kogito-maven/common/module.yaml b/packages/sonataflow-image-common/resources/modules/kogito-maven/common/module.yaml index bf616eaa8dc..56f154e3156 100644 --- a/packages/sonataflow-image-common/resources/modules/kogito-maven/common/module.yaml +++ b/packages/sonataflow-image-common/resources/modules/kogito-maven/common/module.yaml @@ -18,7 +18,7 @@ # schema_version: 1 name: org.kie.kogito.maven.common -version: "0.0.0" +version: "main" envs: - name: "MAVEN_VERSION" @@ -28,6 +28,9 @@ envs: - name: "MAVEN_SETTINGS_PATH" description: "The location of the settings.xml file" value: "${KOGITO_HOME}/.m2/settings.xml" + - name: "MAVEN_CONTAINER_BUILD_SETTINGS_PATH" + description: "The location of the settings.xml file during container image build" + value: "${KOGITO_HOME}/.m2/maven-m2-repo-via-http-settings.xml" - name: "HTTP_PROXY" description: "The location of the http proxy, will be used for both Maven builds and Java runtime." example: "http://127.0.0.1:8080" diff --git a/packages/sonataflow-image-common/resources/modules/kogito-maven/tests/bats/maven-settings.bats b/packages/sonataflow-image-common/resources/modules/kogito-maven/tests/bats/maven-settings.bats index 8a7e85067c7..66fb2363532 100644 --- a/packages/sonataflow-image-common/resources/modules/kogito-maven/tests/bats/maven-settings.bats +++ b/packages/sonataflow-image-common/resources/modules/kogito-maven/tests/bats/maven-settings.bats @@ -24,14 +24,14 @@ source $BATS_TEST_DIRNAME/../../common/added/configure-maven.sh setup() { - export HOME=$BATS_TMPDIR/maven - mkdir -p ${HOME}/.m2/ - cp $BATS_TEST_DIRNAME/../../common/maven/settings.xml ${HOME}/.m2/ - export MAVEN_SETTINGS_PATH="${HOME}/.m2/settings.xml" + export KOGITO_HOME=$BATS_TMPDIR/maven + mkdir -p ${KOGITO_HOME}/.m2/ + cp $BATS_TEST_DIRNAME/../../common/maven/settings.xml ${KOGITO_HOME}/.m2/ + export MAVEN_SETTINGS_PATH="${KOGITO_HOME}/.m2/settings.xml" } teardown() { - rm -rf ${HOME} + rm -rf ${KOGITO_HOME} } # override this function, cat /dec/urandon makes the test hangs on GH actions @@ -45,7 +45,7 @@ function _generate_random_id() { MAVEN_MIRROR_URL="http://localhost:8081/nexus/custom/repo/public" run configure_mirrors expected=" mirror.default http://localhost:8081/nexus/custom/repo/public external:* " - result=$(xmllint --xpath "//*[local-name()='mirrors']//*[local-name()='mirror']" ${HOME}/.m2/settings.xml) + result=$(xmllint --xpath "//*[local-name()='mirrors']//*[local-name()='mirror']" ${KOGITO_HOME}/.m2/settings.xml) echo "expected=${expected}" echo "expected=${result}" [ "${expected}" = "${result}" ] @@ -56,7 +56,7 @@ function _generate_random_id() { HTTPS_PROXY="https://10.10.10.10:8443" run configure_proxy expected=" genproxy true https https://10.10.10.10 8443 " - result=$(xmllint --xpath "//*[local-name()='proxies']//*[local-name()='proxy']" ${HOME}/.m2/settings.xml) + result=$(xmllint --xpath "//*[local-name()='proxies']//*[local-name()='proxy']" ${KOGITO_HOME}/.m2/settings.xml) echo "expected=${expected}" echo "result=${result}" [ "${expected}" = "${result}" ] @@ -67,7 +67,7 @@ function _generate_random_id() { HTTPS_PROXY="https://10.10.10.10:" run configure_proxy expected=" genproxy true https https://10.10.10.10 443 " - result=$(xmllint --xpath "//*[local-name()='proxies']//*[local-name()='proxy']" ${HOME}/.m2/settings.xml) + result=$(xmllint --xpath "//*[local-name()='proxies']//*[local-name()='proxy']" ${KOGITO_HOME}/.m2/settings.xml) echo "expected=${expected}" echo "result=${result}" [ "${expected}" = "${result}" ] @@ -80,7 +80,7 @@ function _generate_random_id() { PROXY_PASSWORD="impossible2guess" run configure_proxy expected=" genproxy true https https://10.10.10.10 8443 hello impossible2guess " - result=$(xmllint --xpath "//*[local-name()='proxies']//*[local-name()='proxy']" ${HOME}/.m2/settings.xml) + result=$(xmllint --xpath "//*[local-name()='proxies']//*[local-name()='proxy']" ${KOGITO_HOME}/.m2/settings.xml) echo "expected=${expected}" echo "result=${result}" [ "${expected}" = "${result}" ] @@ -91,7 +91,7 @@ function _generate_random_id() { HTTP_PROXY="http://10.10.10.20:8003" run configure_proxy expected=" genproxy true http http://10.10.10.20 8003 " - result=$(xmllint --xpath "//*[local-name()='proxies']//*[local-name()='proxy']" ${HOME}/.m2/settings.xml) + result=$(xmllint --xpath "//*[local-name()='proxies']//*[local-name()='proxy']" ${KOGITO_HOME}/.m2/settings.xml) echo "expected=${expected}" echo "result=${result}" [ "${expected}" = "${result}" ] @@ -104,7 +104,7 @@ function _generate_random_id() { PROXY_PASSWORD="impossible2guess" run configure_proxy expected=" genproxy true http http://10.10.10.20 80 hello impossible2guess " - result=$(xmllint --xpath "//*[local-name()='proxies']//*[local-name()='proxy']" ${HOME}/.m2/settings.xml) + result=$(xmllint --xpath "//*[local-name()='proxies']//*[local-name()='proxy']" ${KOGITO_HOME}/.m2/settings.xml) echo "expected=${expected}" echo "result=${result}" [ "${expected}" = "${result}" ] @@ -115,7 +115,7 @@ function _generate_random_id() { HTTP_PROXY="http://10.10.10.20:8003" run configure_proxy expected=" genproxy true http http://10.10.10.20 8003 " - result=$(xmllint --xpath "//*[local-name()='proxies']//*[local-name()='proxy']" ${HOME}/.m2/settings.xml) + result=$(xmllint --xpath "//*[local-name()='proxies']//*[local-name()='proxy']" ${KOGITO_HOME}/.m2/settings.xml) echo "expected=${expected}" echo "result=${result}" [ "${expected}" = "${result}" ] @@ -130,7 +130,7 @@ function _generate_random_id() { HTTP_PROXY_NONPROXYHOSTS="127.0.0.1|10.1.1.1" run configure_proxy expected=" genproxy true http 10.10.10.20 8080 beleza_pura impossible2guess 127.0.0.1|10.1.1.1 " - result=$(xmllint --xpath "//*[local-name()='proxies']//*[local-name()='proxy']" ${HOME}/.m2/settings.xml) + result=$(xmllint --xpath "//*[local-name()='proxies']//*[local-name()='proxy']" ${KOGITO_HOME}/.m2/settings.xml) echo "expected=${expected}" echo "result=${result}" [ "${expected}" = "${result}" ] @@ -142,7 +142,7 @@ function _generate_random_id() { HTTP_PROXY_NONPROXYHOSTS="127.0.0.1|10.1.1.1" run configure_proxy expected=" genproxy true http 10.10.10.20 80 127.0.0.1|10.1.1.1 " - result=$(xmllint --xpath "//*[local-name()='proxies']//*[local-name()='proxy']" ${HOME}/.m2/settings.xml) + result=$(xmllint --xpath "//*[local-name()='proxies']//*[local-name()='proxy']" ${KOGITO_HOME}/.m2/settings.xml) echo "expected=${expected}" echo "result=${result}" [ "${expected}" = "${result}" ] @@ -157,7 +157,7 @@ function _generate_random_id() { HTTP_PROXY_NONPROXYHOSTS="127.0.0.1|10.1.1.1" run configure_proxy expected=" genproxy true https https://10.10.10.20 8443 beleza_pura impossible2guess 127.0.0.1|10.1.1.1 " - result=$(xmllint --xpath "//*[local-name()='proxies']//*[local-name()='proxy']" ${HOME}/.m2/settings.xml) + result=$(xmllint --xpath "//*[local-name()='proxies']//*[local-name()='proxy']" ${KOGITO_HOME}/.m2/settings.xml) echo "expected=${expected}" echo "result=${result}" [ "${expected}" = "${result}" ] @@ -235,7 +235,7 @@ function _generate_random_id() { test " - repository_result=$(xmllint --xpath "(//*[local-name()='profiles']//*[local-name()='profile']//*[local-name()='repositories']//*[local-name()='repository'])[last()]" ${HOME}/.m2/settings.xml) + repository_result=$(xmllint --xpath "(//*[local-name()='profiles']//*[local-name()='profile']//*[local-name()='repositories']//*[local-name()='repository'])[last()]" ${KOGITO_HOME}/.m2/settings.xml) echo "repository_expected=${repository_expected}" echo "repository_result =${repository_result}" [ "${repository_expected}" = "${repository_result}" ] @@ -256,7 +256,7 @@ function _generate_random_id() { test " - plugin_repository_result=$(xmllint --xpath "(//*[local-name()='profiles']//*[local-name()='profile']//*[local-name()='pluginRepositories']//*[local-name()='pluginRepository'])[last()]" ${HOME}/.m2/settings.xml) + plugin_repository_result=$(xmllint --xpath "(//*[local-name()='profiles']//*[local-name()='profile']//*[local-name()='pluginRepositories']//*[local-name()='pluginRepository'])[last()]" ${KOGITO_HOME}/.m2/settings.xml) echo "plugin_repository_expected=${plugin_repository_expected}" echo "plugin_repository_result =${plugin_repository_result}" [ "${plugin_repository_expected}" = "${plugin_repository_result}" ] @@ -269,7 +269,7 @@ function _generate_random_id() { run add_maven_repo repository_url_expected="http://my.cool.mvn.repo.severinolabs.com/group/public" - repository_url_result=$(xmllint --xpath "(//*[local-name()='profiles']//*[local-name()='profile']//*[local-name()='repositories']//*[local-name()='repository']//*[local-name()='url'])[last()]" ${HOME}/.m2/settings.xml) + repository_url_result=$(xmllint --xpath "(//*[local-name()='profiles']//*[local-name()='profile']//*[local-name()='repositories']//*[local-name()='repository']//*[local-name()='url'])[last()]" ${KOGITO_HOME}/.m2/settings.xml) echo "repository_url_expected=${repository_url_expected}" echo "repository_url_result =${repository_url_result}" [ "${repository_url_expected}" = "${repository_url_result}" ] @@ -279,7 +279,7 @@ function _generate_random_id() { always warn " - repository_releases_result=$(xmllint --xpath "(//*[local-name()='profiles']//*[local-name()='profile']//*[local-name()='repositories']//*[local-name()='repository']//*[local-name()='releases'])[last()]" ${HOME}/.m2/settings.xml) + repository_releases_result=$(xmllint --xpath "(//*[local-name()='profiles']//*[local-name()='profile']//*[local-name()='repositories']//*[local-name()='repository']//*[local-name()='releases'])[last()]" ${KOGITO_HOME}/.m2/settings.xml) echo "repository_releases_expected=${repository_releases_expected}" echo "repository_releases_result =${repository_releases_result}" [ "${repository_releases_expected}" = "${repository_releases_result}" ] @@ -289,14 +289,14 @@ function _generate_random_id() { always warn " - repository_snapshots_result=$(xmllint --xpath "(//*[local-name()='profiles']//*[local-name()='profile']//*[local-name()='repositories']//*[local-name()='repository']//*[local-name()='snapshots'])[last()]" ${HOME}/.m2/settings.xml) + repository_snapshots_result=$(xmllint --xpath "(//*[local-name()='profiles']//*[local-name()='profile']//*[local-name()='repositories']//*[local-name()='repository']//*[local-name()='snapshots'])[last()]" ${KOGITO_HOME}/.m2/settings.xml) echo "repository_snapshots_expected=${repository_snapshots_expected}" echo "repository_snapshots_result =${repository_snapshots_result}" [ "${repository_snapshots_expected}" = "${repository_snapshots_result}" ] plugin_repository_url_expected="http://my.cool.mvn.repo.severinolabs.com/group/public" - plugin_repository_url_result=$(xmllint --xpath "(//*[local-name()='profiles']//*[local-name()='profile']//*[local-name()='pluginRepositories']//*[local-name()='pluginRepository']//*[local-name()='url'])[last()]" ${HOME}/.m2/settings.xml) + plugin_repository_url_result=$(xmllint --xpath "(//*[local-name()='profiles']//*[local-name()='profile']//*[local-name()='pluginRepositories']//*[local-name()='pluginRepository']//*[local-name()='url'])[last()]" ${KOGITO_HOME}/.m2/settings.xml) echo "plugin_repository_url_expected=${plugin_repository_url_expected}" echo "plugin_repository_url_result =${plugin_repository_url_result}" [ "${plugin_repository_url_expected}" = "${plugin_repository_url_result}" ] @@ -306,7 +306,7 @@ function _generate_random_id() { always warn " - plugin_repository_releases_result=$(xmllint --xpath "(//*[local-name()='profiles']//*[local-name()='profile']//*[local-name()='pluginRepositories']//*[local-name()='pluginRepository']//*[local-name()='releases'])[last()]" ${HOME}/.m2/settings.xml) + plugin_repository_releases_result=$(xmllint --xpath "(//*[local-name()='profiles']//*[local-name()='profile']//*[local-name()='pluginRepositories']//*[local-name()='pluginRepository']//*[local-name()='releases'])[last()]" ${KOGITO_HOME}/.m2/settings.xml) echo "plugin_repository_releases_expected=${plugin_repository_releases_expected}" echo "plugin_repository_releases_result =${plugin_repository_releases_result}" [ "${plugin_repository_releases_expected}" = "${plugin_repository_releases_result}" ] @@ -316,7 +316,7 @@ function _generate_random_id() { always warn " - plugin_repository_snapshots_result=$(xmllint --xpath "(//*[local-name()='profiles']//*[local-name()='profile']//*[local-name()='pluginRepositories']//*[local-name()='pluginRepository']//*[local-name()='snapshots'])[last()]" ${HOME}/.m2/settings.xml) + plugin_repository_snapshots_result=$(xmllint --xpath "(//*[local-name()='profiles']//*[local-name()='profile']//*[local-name()='pluginRepositories']//*[local-name()='pluginRepository']//*[local-name()='snapshots'])[last()]" ${KOGITO_HOME}/.m2/settings.xml) echo "plugin_repository_snapshots_expected=${plugin_repository_snapshots_expected}" echo "plugin_repository_snapshots_result =${plugin_repository_snapshots_result}" [ "${plugin_repository_snapshots_expected}" = "${plugin_repository_snapshots_result}" ] @@ -363,7 +363,7 @@ function _generate_random_id() { test " - central_repository_result=$(xmllint --xpath "(//*[local-name()='profiles']//*[local-name()='profile']//*[local-name()='repositories']//*[local-name()='repository'])[last()-1]" ${HOME}/.m2/settings.xml) + central_repository_result=$(xmllint --xpath "(//*[local-name()='profiles']//*[local-name()='profile']//*[local-name()='repositories']//*[local-name()='repository'])[last()-1]" ${KOGITO_HOME}/.m2/settings.xml) echo "central_repository_expected=${central_repository_expected}" echo "central_repository_result =${central_repository_result}" [ "${central_repository_expected}" = "${central_repository_result}" ] @@ -384,7 +384,7 @@ function _generate_random_id() { another-test " - company_repository_result=$(xmllint --xpath "(//*[local-name()='profiles']//*[local-name()='profile']//*[local-name()='repositories']//*[local-name()='repository'])[last()]" ${HOME}/.m2/settings.xml) + company_repository_result=$(xmllint --xpath "(//*[local-name()='profiles']//*[local-name()='profile']//*[local-name()='repositories']//*[local-name()='repository'])[last()]" ${KOGITO_HOME}/.m2/settings.xml) echo "company_repository_expected=${company_repository_expected}" echo "company_repository_result =${company_repository_result}" [ "${company_repository_expected}" = "${company_repository_result}" ] @@ -406,7 +406,7 @@ function _generate_random_id() { test " - central_plugin_repository_result=$(xmllint --xpath "(//*[local-name()='profiles']//*[local-name()='profile']//*[local-name()='pluginRepositories']//*[local-name()='pluginRepository'])[last()-1]" ${HOME}/.m2/settings.xml) + central_plugin_repository_result=$(xmllint --xpath "(//*[local-name()='profiles']//*[local-name()='profile']//*[local-name()='pluginRepositories']//*[local-name()='pluginRepository'])[last()-1]" ${KOGITO_HOME}/.m2/settings.xml) echo "central_plugin_repository_expected=${central_plugin_repository_expected}" echo "central_plugin_repository_result =${central_plugin_repository_result}" [ "${central_plugin_repository_expected}" = "${central_plugin_repository_result}" ] @@ -427,7 +427,7 @@ function _generate_random_id() { another-test " - company_plugin_repository_result=$(xmllint --xpath "(//*[local-name()='profiles']//*[local-name()='profile']//*[local-name()='pluginRepositories']//*[local-name()='pluginRepository'])[last()]" ${HOME}/.m2/settings.xml) + company_plugin_repository_result=$(xmllint --xpath "(//*[local-name()='profiles']//*[local-name()='profile']//*[local-name()='pluginRepositories']//*[local-name()='pluginRepository'])[last()]" ${KOGITO_HOME}/.m2/settings.xml) echo "company_plugin_repository_expected=${company_plugin_repository_expected}" echo "company_plugin_repository_result =${company_plugin_repository_result}" [ "${company_plugin_repository_expected}" = "${company_plugin_repository_result}" ] diff --git a/packages/sonataflow-image-common/resources/modules/kogito-project-versions/module.yaml b/packages/sonataflow-image-common/resources/modules/kogito-project-versions/module.yaml index fb5dc14fc35..b710330fb63 100644 --- a/packages/sonataflow-image-common/resources/modules/kogito-project-versions/module.yaml +++ b/packages/sonataflow-image-common/resources/modules/kogito-project-versions/module.yaml @@ -18,7 +18,7 @@ # schema_version: 1 name: org.kie.kogito.project.versions -version: "0.0.0" +version: "main" description: "Kogito Project versions information" envs: diff --git a/packages/sonataflow-image-common/resources/modules/kogito-system-user/add-user b/packages/sonataflow-image-common/resources/modules/kogito-system-user/add-user index f90e5b6178f..b6a932f1319 100644 --- a/packages/sonataflow-image-common/resources/modules/kogito-system-user/add-user +++ b/packages/sonataflow-image-common/resources/modules/kogito-system-user/add-user @@ -17,7 +17,6 @@ # specific language governing permissions and limitations # under the License. # - # Check if group 1001 exists, if not, create it if ! getent group kogito >/dev/null; then groupadd -r kogito -g ${USER_ID} diff --git a/packages/sonataflow-image-common/resources/modules/kogito-system-user/module.yaml b/packages/sonataflow-image-common/resources/modules/kogito-system-user/module.yaml index efa064bc637..2ddbe3f6948 100644 --- a/packages/sonataflow-image-common/resources/modules/kogito-system-user/module.yaml +++ b/packages/sonataflow-image-common/resources/modules/kogito-system-user/module.yaml @@ -18,7 +18,7 @@ # schema_version: 1 name: org.kie.kogito.system.user -version: "0.0.0" +version: "main" execute: - script: add-user diff --git a/packages/sonataflow-image-common/resources/modules/sonataflow/common/build/configure.sh b/packages/sonataflow-image-common/resources/modules/sonataflow/common/build/configure.sh index 50897c656b1..fb47d792dc7 100644 --- a/packages/sonataflow-image-common/resources/modules/sonataflow/common/build/configure.sh +++ b/packages/sonataflow-image-common/resources/modules/sonataflow/common/build/configure.sh @@ -33,11 +33,11 @@ chmod -R ug+rwX "${KOGITO_HOME}" cd "${KOGITO_HOME}" -# Create app -"${LAUNCH_DIR}"/create-app.sh +# Create app (settings.xml path is replaced only for these commands and automatically restored when they end) +env MAVEN_SETTINGS_PATH=${MAVEN_CONTAINER_BUILD_SETTINGS_PATH} "${LAUNCH_DIR}"/create-app.sh -"${BUILD_DIR}"/cleanup_project.sh -"${BUILD_DIR}"/zip_files.sh +env MAVEN_SETTINGS_PATH=${MAVEN_CONTAINER_BUILD_SETTINGS_PATH} "${BUILD_DIR}"/cleanup_project.sh +env MAVEN_SETTINGS_PATH=${MAVEN_CONTAINER_BUILD_SETTINGS_PATH} "${BUILD_DIR}"/zip_files.sh chown -R 1001:0 "${KOGITO_HOME}" chmod -R ug+rwX "${KOGITO_HOME}" \ No newline at end of file diff --git a/packages/sonataflow-image-common/resources/modules/sonataflow/common/build/module.yaml b/packages/sonataflow-image-common/resources/modules/sonataflow/common/build/module.yaml index 0325c599ae4..c9be6d46703 100644 --- a/packages/sonataflow-image-common/resources/modules/sonataflow/common/build/module.yaml +++ b/packages/sonataflow-image-common/resources/modules/sonataflow/common/build/module.yaml @@ -18,7 +18,7 @@ # schema_version: 1 name: org.kie.sonataflow.common.build -version: "0.0.0" +version: "main" description: "Kogito Serverless Workflow image build process" execute: diff --git a/packages/sonataflow-image-common/resources/modules/sonataflow/common/scripts/added/add-extension.sh b/packages/sonataflow-image-common/resources/modules/sonataflow/common/scripts/added/add-extension.sh index 6dc158d2a08..fcce1f5ae26 100755 --- a/packages/sonataflow-image-common/resources/modules/sonataflow/common/scripts/added/add-extension.sh +++ b/packages/sonataflow-image-common/resources/modules/sonataflow/common/scripts/added/add-extension.sh @@ -42,6 +42,7 @@ fi "${MAVEN_HOME}"/bin/mvn -B ${MAVEN_ARGS_APPEND} \ -nsu \ + -ntp \ -s "${MAVEN_SETTINGS_PATH}" \ -DplatformVersion="${QUARKUS_PLATFORM_VERSION}" \ -Dextensions="${extensions}" \ diff --git a/packages/sonataflow-image-common/resources/modules/sonataflow/common/scripts/added/build-app.sh b/packages/sonataflow-image-common/resources/modules/sonataflow/common/scripts/added/build-app.sh index 671d6e09b1e..0cd6311d6fc 100755 --- a/packages/sonataflow-image-common/resources/modules/sonataflow/common/scripts/added/build-app.sh +++ b/packages/sonataflow-image-common/resources/modules/sonataflow/common/scripts/added/build-app.sh @@ -59,6 +59,7 @@ cd ${KOGITO_HOME}/serverless-workflow-project "${MAVEN_HOME}"/bin/mvn -B ${MAVEN_ARGS_APPEND} \ -nsu \ + -ntp \ -s "${MAVEN_SETTINGS_PATH}" \ -DskipTests \ -Dquarkus.container-image.build=false \ diff --git a/packages/sonataflow-image-common/resources/modules/sonataflow/common/scripts/added/create-app.sh b/packages/sonataflow-image-common/resources/modules/sonataflow/common/scripts/added/create-app.sh index 9d99b521704..3534ca868cf 100755 --- a/packages/sonataflow-image-common/resources/modules/sonataflow/common/scripts/added/create-app.sh +++ b/packages/sonataflow-image-common/resources/modules/sonataflow/common/scripts/added/create-app.sh @@ -36,6 +36,7 @@ source "${script_dir_path}"/configure-jvm-mvn.sh "${MAVEN_HOME}"/bin/mvn -B ${MAVEN_ARGS_APPEND} \ -nsu \ + -ntp \ -s "${MAVEN_SETTINGS_PATH}" \ io.quarkus.platform:quarkus-maven-plugin:"${QUARKUS_PLATFORM_VERSION}":create ${QUARKUS_CREATE_ARGS} \ -DprojectGroupId="${PROJECT_GROUP_ID}" \ @@ -124,15 +125,13 @@ if [ "${SCRIPT_DEBUG^^}" = "TRUE" ]; then cat pom.xml fi -ls -la "${KOGITO_HOME}"/.m2/repository/org/apache/kie/ -ls -la "${KOGITO_HOME}"/.m2/repository/org/kie/ - # we force the dependencies download beforehand, so we won't have problems when running or building our apps in offline mode # see: # https://quarkus.io/guides/maven-tooling#downloading-maven-artifact-dependencies-for-offline-development-and-testing # https://maven.apache.org/plugins/maven-dependency-plugin/go-offline-mojo.html "${MAVEN_HOME}"/bin/mvn -B ${MAVEN_ARGS_APPEND} \ -nsu \ + -ntp \ -s "${MAVEN_SETTINGS_PATH}" \ -DskipTests=true \ -Dmaven.javadoc.skip=true \ @@ -141,5 +140,6 @@ ls -la "${KOGITO_HOME}"/.m2/repository/org/kie/ # clean up "${MAVEN_HOME}"/bin/mvn -B ${MAVEN_ARGS_APPEND} \ -nsu \ + -ntp \ -s "${MAVEN_SETTINGS_PATH}" \ clean diff --git a/packages/sonataflow-image-common/resources/modules/sonataflow/common/scripts/module.yaml b/packages/sonataflow-image-common/resources/modules/sonataflow/common/scripts/module.yaml index 38c498eac45..0278c6fc05b 100644 --- a/packages/sonataflow-image-common/resources/modules/sonataflow/common/scripts/module.yaml +++ b/packages/sonataflow-image-common/resources/modules/sonataflow/common/scripts/module.yaml @@ -18,7 +18,7 @@ # schema_version: 1 name: org.kie.sonataflow.common.scripts -version: "0.0.0" +version: "main" description: "Kogito Serverless Workflow image common scripts" envs: diff --git a/packages/sonataflow-image-common/resources/scripts/README.md b/packages/sonataflow-image-common/resources/scripts/README.md index a4989b53d4e..34a4fcd0c85 100644 --- a/packages/sonataflow-image-common/resources/scripts/README.md +++ b/packages/sonataflow-image-common/resources/scripts/README.md @@ -62,3 +62,11 @@ Usage: Args: - `--quarkus-version`: Sets the Quarkus version - `--kogito-version`: Sets the Kogito version + +## Build Kogito Apps Components + +The [build-kogito-apps-components.sh](build-kogito-apps-components.sh) script pulls and build the target Kogito Apps application, e.g., Data Index. Required to build Kogito Services images in any flavour. + +## Setup Maven + +The [setup-maven.sh](setup-maven.sh) script configures the internal image Maven repository such as adding new repositories, setup other profiles and so on. diff --git a/packages/sonataflow-image-common/resources/scripts/build-kogito-apps-components.sh b/packages/sonataflow-image-common/resources/scripts/build-kogito-apps-components.sh new file mode 100755 index 00000000000..12a2f50f03c --- /dev/null +++ b/packages/sonataflow-image-common/resources/scripts/build-kogito-apps-components.sh @@ -0,0 +1,124 @@ +#!/usr/bin/env bash +# +# 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. +# + +# Parameters: +# 1 - image name - can't be empty. +# 2 - git target branch - defaults to main +# 3 - git target uri - defaults to https://github.com/apache/incubator-kie-kogito-apps.git + +# fast fail +set -e +set -o pipefail + +KOGITO_APPS_REPO_NAME="incubator-kie-kogito-apps" +KOGITO_APPS_FOLDER_NAME="kogito-apps" + +# Read entries before sourcing +imageName="${1}" +gitBranch="${2}" +if [ -z "${gitBranch}" ]; then + echo "The gitBranch argument is required" + exit 1 +fi +gitBranch=${gitBranch//-[sS][nN][aA][pP][sS][hH][oO][tT]/} +gitUri="${3:-https://github.com/apache/${KOGITO_APPS_REPO_NAME}.git}" +contextDir="" +shift $# + +script_dir_path=$(cd `dirname "${BASH_SOURCE[0]}"`; pwd -P) + +export NODE_OPTIONS="${NODE_OPTIONS} --max_old_space_size=4096" +APPS_MAVEN_OPTIONS="-Dquarkus.package.type=fast-jar -Dquarkus.build.image=false -B" +# used for all-in-one image +extended_context="" + +# Fix taken from https://github.com/apache/incubator-kie-kogito-apps/pull/1762 +if [ ! -z "${CYPRESS_BINARY_URL}" ]; then + export CYPRESS_INSTALL_BINARY="${CYPRESS_BINARY_URL}/cypress-9.7.0.zip" + echo "Setting 'CYPRESS_INSTALL_BINARY' variable to ${CYPRESS_INSTALL_BINARY}" +fi + +case ${imageName} in + "incubator-kie-kogito-data-index-ephemeral") + contextDir="data-index/data-index-service/data-index-service-inmemory" + ;; + "incubator-kie-kogito-data-index-postgresql") + contextDir="data-index/data-index-service/data-index-service-postgresql" + ;; + "incubator-kie-kogito-jobs-service-ephemeral") + contextDir="jobs-service/jobs-service-inmemory" + ;; + "incubator-kie-kogito-jobs-service-postgresql") + contextDir="jobs-service/jobs-service-postgresql" + ;; + "incubator-kie-kogito-jobs-service-allinone") + extended_context="-all-in-one" + contextDir="jobs-service/jobs-service-inmemory" + contextDir="${contextDir} jobs-service/jobs-service-postgresql" + ;; + "incubator-kie-kogito-jit-runner") + contextDir="jitexecutor/jitexecutor-runner" + ;; + *) + echo "${imageName} is not a supporting service image or can't be built from sources, exiting..." + exit 0 + ;; +esac + +# FIXME: Instead of pulling the repo we might pull from Apache Maven repository instead (either staging on release, or snapshot on daily basis) +# FIXME: The kogito-apps must publish the Quarkus App we build here in order for this to work. + +for ctx in ${contextDir}; do + target_tmp_dir="/tmp/build/$(basename ${ctx})${extended_context}" + build_target_dir="/tmp/$(basename ${ctx})${extended_context}" + mvn_local_repo="/tmp/temp_maven/$(basename ${ctx})${extended_context}" + + rm -rf ${target_tmp_dir} && mkdir -p ${target_tmp_dir} + rm -rf ${build_target_dir} && mkdir -p ${build_target_dir} + mkdir -p ${mvn_local_repo} + + . ${script_dir_path}/setup-maven.sh "${build_target_dir}"/settings.xml + MAVEN_OPTIONS="${MAVEN_OPTIONS} ${APPS_MAVEN_OPTIONS}" + + if stat ${HOME}/.m2/repository/ &> /dev/null; then + echo "Copy current maven repo to maven context local repo ${mvn_local_repo}" + cp -R ${HOME}/.m2/repository/* "${mvn_local_repo}" + fi + + cd ${build_target_dir} + echo "Using branch/tag ${gitBranch}, checking out. Temporary build dir is ${build_target_dir} and target dist is ${target_tmp_dir}" + + KOGITO_APPS_DIR=${build_target_dir}/${KOGITO_APPS_FOLDER_NAME} + if [ ! -d "${KOGITO_APPS_DIR}" ]; then + git_command="git clone --single-branch --branch ${gitBranch} --depth 1 ${gitUri} ${KOGITO_APPS_DIR}" + echo "cloning ${KOGITO_APPS_REPO_NAME} with the following git command: ${git_command}" + eval ${git_command} + fi + cd ${KOGITO_APPS_DIR} && echo "working dir `pwd`" + echo "Got MAVEN_OPTIONS = ${MAVEN_OPTIONS}" + mvn_command="mvn -am -pl ${ctx} package ${MAVEN_OPTIONS} -Dmaven.repo.local=${mvn_local_repo} -Dquarkus.container-image.build=false" + echo "Building component(s) ${contextDir} with the following maven command [${mvn_command}]" + export YARN_CACHE_FOLDER=/tmp/cache/yarn/${ctx} # Fix for building yarn apps in parallel + export CYPRESS_CACHE_FOLDER=/tmp/cache/cypress/${ctx} # https://docs.cypress.io/guides/getting-started/installing-cypress#Advanced + eval ${mvn_command} + cd ${ctx}/target + cp -vr quarkus-app ${target_tmp_dir}/ + cd - +done diff --git a/packages/sonataflow-image-common/resources/scripts/install_bats.sh b/packages/sonataflow-image-common/resources/scripts/install_bats.sh new file mode 100755 index 00000000000..652a11f757a --- /dev/null +++ b/packages/sonataflow-image-common/resources/scripts/install_bats.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +# +# 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. +# + + +set -e + +if [[ $(command -v ./bats-home/bin/bats) ]]; then #skip if bats already installed else will install the bats + echo "---> bats already available running tests" +else + git clone https://github.com/bats-core/bats-core.git + ./bats-core/install.sh bats-home + rm -rf bats-core +fi diff --git a/packages/sonataflow-image-common/resources/scripts/run-bats.sh b/packages/sonataflow-image-common/resources/scripts/run-bats.sh index af64c14d850..c44be7ae477 100755 --- a/packages/sonataflow-image-common/resources/scripts/run-bats.sh +++ b/packages/sonataflow-image-common/resources/scripts/run-bats.sh @@ -23,15 +23,7 @@ set -e script_dir_path="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -if [[ $(command -v ./bats/bin/bats) ]]; then #skip if bats already installed else will install the bats - echo "---> bats already available running tests" -else - git clone https://github.com/bats-core/bats-core.git - ./bats-core/install.sh bats - rm -rf bats-core -fi - -tests_output_path="${script_dir_path}/../../dist-tests-e2e" +tests_output_path="${script_dir_path}/../../dist-tests" echo "----> running bats" -./bats/bin/bats modules/sonataflow/common/scripts/tests/bats --formatter junit --report-formatter junit --output "${tests_output_path}" +./../bats-home/bin/bats -r modules --formatter junit --report-formatter junit --output "${tests_output_path}" diff --git a/packages/sonataflow-image-common/resources/scripts/setup-maven.sh b/packages/sonataflow-image-common/resources/scripts/setup-maven.sh new file mode 100755 index 00000000000..78be682dfe7 --- /dev/null +++ b/packages/sonataflow-image-common/resources/scripts/setup-maven.sh @@ -0,0 +1,77 @@ +#!/usr/bin/env bash +# +# 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. +# + +# Holds common maven configuration for CI; +# Usage: . setup-maven.sh + +MVN_MODULE="$(dirname "${BASH_SOURCE[0]}")/../modules/kogito-maven/common" +export MAVEN_OPTIONS="${BUILD_MVN_OPTS} -DskipTests" +# Do not remove below, this can be updated by the python scripts +MAVEN_IGNORE_SELF_SIGNED_CERTIFICATE=true + +maven_settings_path=$1 +if [ -z "${maven_settings_path}" ]; then + maven_settings_path="${HOME}"/.m2/settings.xml + echo "Maven settings path argument is empty, using ${maven_settings_path}" +fi + +LOGGING_MODULE="$(dirname "${BASH_SOURCE[0]}")/../modules/kogito-logging/" +source "${LOGGING_MODULE}"/added/logging.sh + +echo "Updating settings file ${maven_settings_path}" + +# setup maven env +# Do not remove below, this can be updated by the python scripts +export DEFAULT_MAVEN_REPO_URL="https://repository.apache.org/content/groups/public/" +# export MAVEN_REPO_URL= +cp "${MVN_MODULE}"/maven/settings.xml "${maven_settings_path}" +export MAVEN_SETTINGS_PATH="${maven_settings_path}" +source "${MVN_MODULE}"/added/configure-maven.sh +configure + +export MAVEN_OPTIONS="${MAVEN_OPTIONS} -s ${maven_settings_path}" + +# Add NPM registry if needed +if [ ! -z "${NPM_REGISTRY_URL}" ]; then + echo "enabling npm repository: ${NPM_REGISTRY_URL}" + npm_profile="\ +\ +internal-npm-registry\ +\ +${NPM_REGISTRY_URL}\ +http://download.devel.redhat.com/rcm-guest/staging/rhba/dist/yarn/\ +http://download.devel.redhat.com/rcm-guest/staging/rhba/dist/node/\ +http://download.devel.redhat.com/rcm-guest/staging/rhba/dist/npm/\ +http://download.devel.redhat.com/rcm-guest/staging/rhba/dist/pnpm/\ +\ +\ +" + sed -i.bak -E "s|()|\1\n${npm_profile}|" "${MAVEN_SETTINGS_PATH}" + sed -i.bak -E "s|()|\1\ninternal-npm-registry|" "${MAVEN_SETTINGS_PATH}" + + rm -rf "${MAVEN_SETTINGS_PATH}/*.bak" +fi + +cat "${maven_settings_path}" + +if [ "${MAVEN_IGNORE_SELF_SIGNED_CERTIFICATE}" = "true" ]; then + export MAVEN_OPTIONS="${MAVEN_OPTIONS} -Denforcer.skip" +fi + diff --git a/packages/sonataflow-management-console-image/package.json b/packages/sonataflow-management-console-image/package.json index e0ba9122584..65bbfe88e66 100644 --- a/packages/sonataflow-management-console-image/package.json +++ b/packages/sonataflow-management-console-image/package.json @@ -28,7 +28,7 @@ "image:cekit:build:linux": "pnpm image:cekit:copy && pnpm image:cekit:setup:env make -C ./dist-dev build", "image:cekit:build:win32:darwin": "echo \"Build skipped on macOS and Windows\"", "image:cekit:copy": "cp -R ./node_modules/@kie-tools/sonataflow-image-common/resources/* ./dist-dev/ && cp -R resources/* ./dist-dev/", - "image:cekit:setup:env": ". ./node_modules/@kie-tools/python-venv/venv/bin/activate && cross-env SWF_IMAGE_REGISTRY=$(build-env sonataflowManagementConsoleImageEnv.registry) SWF_IMAGE_REGISTRY_ACCOUNT=$(build-env sonataflowManagementConsoleImageEnv.account) SWF_IMAGE_NAME=$(build-env sonataflowManagementConsoleImageEnv.name) SWF_IMAGE_TAG=$(build-env sonataflowManagementConsoleImageEnv.buildTag) QUARKUS_PLATFORM_VERSION=$(build-env quarkusPlatform.version) KOGITO_VERSION=$(build-env kogitoRuntime.version) SONATAFLOW_MANAGEMENT_CONSOLE_PORT=$(build-env sonataflowManagementConsoleImageEnv.port)" + "image:cekit:setup:env": ". ./node_modules/@kie-tools/python-venv/venv/bin/activate && cross-env KOGITO_IMAGE_REGISTRY=$(build-env sonataflowManagementConsoleImageEnv.registry) KOGITO_IMAGE_REGISTRY_ACCOUNT=$(build-env sonataflowManagementConsoleImageEnv.account) KOGITO_IMAGE_NAME=$(build-env sonataflowManagementConsoleImageEnv.name) KOGITO_IMAGE_TAG=$(build-env sonataflowManagementConsoleImageEnv.buildTag) QUARKUS_PLATFORM_VERSION=$(build-env quarkusPlatform.version) KOGITO_VERSION=$(build-env kogitoRuntime.version) SONATAFLOW_MANAGEMENT_CONSOLE_PORT=$(build-env sonataflowManagementConsoleImageEnv.port)" }, "devDependencies": { "@kie-tools/image-env-to-json": "workspace:*", diff --git a/packages/sonataflow-management-console-webapp/build/defaultEnvJson.ts b/packages/sonataflow-management-console-webapp/build/defaultEnvJson.ts index ac51ebae736..f3d602ea355 100644 --- a/packages/sonataflow-management-console-webapp/build/defaultEnvJson.ts +++ b/packages/sonataflow-management-console-webapp/build/defaultEnvJson.ts @@ -22,7 +22,6 @@ import { EnvJson } from "../src/env/EnvJson"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore import { env } from "../env"; - const buildEnv: any = env; // build-env is not typed const version = require("../package.json").version; diff --git a/packages/sonataflow-management-console-webapp/webpack.config.ts b/packages/sonataflow-management-console-webapp/webpack.config.ts index 915d98d9708..92fa753a8f8 100644 --- a/packages/sonataflow-management-console-webapp/webpack.config.ts +++ b/packages/sonataflow-management-console-webapp/webpack.config.ts @@ -35,10 +35,10 @@ import { env } from "./env"; const BG_IMAGES_DIRNAME = "bgimages"; const buildEnv: any = env; // build-env is not typed -export default async (env: any, argv: any) => { +export default async (webpackEnv: any, webpackArgv: any) => { return [ { - ...merge(common(env), { + ...merge(common(webpackEnv), { entry: { index: path.resolve(__dirname, "src", "index.tsx"), "serverless-workflow-combined-editor-envelope": diff --git a/packages/sonataflow-operator/env/index.js b/packages/sonataflow-operator/env/index.js index bb7dff616d4..fdb5568d930 100644 --- a/packages/sonataflow-operator/env/index.js +++ b/packages/sonataflow-operator/env/index.js @@ -42,11 +42,11 @@ module.exports = composeEnv([rootEnv, sonataflowBuilderImageEnv, sonataflowDevMo description: "Tag version of this image. E.g., `main` or `10.0.x` or `10.0.0", }, SONATAFLOW_OPERATOR__sonataflowBuilderImage: { - default: `${sonataflowBuilderImageEnv.env.sonataflowBuilderImage.registry}/${sonataflowBuilderImageEnv.env.sonataflowBuilderImage.account}/${sonataflowBuilderImageEnv.env.sonataflowBuilderImage.name}:${sonataflowBuilderImageEnv.env.sonataflowBuilderImage.tag}`, + default: `${sonataflowBuilderImageEnv.env.sonataflowBuilderImage.registry}/${sonataflowBuilderImageEnv.env.sonataflowBuilderImage.account}/${sonataflowBuilderImageEnv.env.sonataflowBuilderImage.name}:${sonataflowBuilderImageEnv.env.sonataflowBuilderImage.buildTag}`, description: "Sonataflow Builder image", }, SONATAFLOW_OPERATOR__sonataflowDevModeImage: { - default: `${sonataflowDevModeImageEnv.env.sonataflowDevModeImage.registry}/${sonataflowDevModeImageEnv.env.sonataflowDevModeImage.account}/${sonataflowDevModeImageEnv.env.sonataflowDevModeImage.name}:${sonataflowDevModeImageEnv.env.sonataflowDevModeImage.tag}`, + default: `${sonataflowDevModeImageEnv.env.sonataflowDevModeImage.registry}/${sonataflowDevModeImageEnv.env.sonataflowDevModeImage.account}/${sonataflowDevModeImageEnv.env.sonataflowDevModeImage.name}:${sonataflowDevModeImageEnv.env.sonataflowDevModeImage.buildTag}`, description: "Sonataflow DevMode image", }, }), @@ -56,7 +56,7 @@ module.exports = composeEnv([rootEnv, sonataflowBuilderImageEnv, sonataflowDevMo registry: getOrDefault(this.vars.SONATAFLOW_OPERATOR__registry), account: getOrDefault(this.vars.SONATAFLOW_OPERATOR__account), name: getOrDefault(this.vars.SONATAFLOW_OPERATOR__name), - tag: getOrDefault(this.vars.SONATAFLOW_OPERATOR__buildTag), + buildTag: getOrDefault(this.vars.SONATAFLOW_OPERATOR__buildTag), version: require("../package.json").version, sonataflowBuilderImage: getOrDefault(this.vars.SONATAFLOW_OPERATOR__sonataflowBuilderImage), sonataflowDevModeImage: getOrDefault(this.vars.SONATAFLOW_OPERATOR__sonataflowDevModeImage), diff --git a/packages/sonataflow-operator/hack/bump-version.sh b/packages/sonataflow-operator/hack/bump-version.sh index e2b131e7b35..1db411598a8 100755 --- a/packages/sonataflow-operator/hack/bump-version.sh +++ b/packages/sonataflow-operator/hack/bump-version.sh @@ -24,7 +24,7 @@ script_dir_path=$(dirname "${BASH_SOURCE[0]}") source "${script_dir_path}"/env.sh imageName=$(pnpm build-env sontaflowOperator.registry)/$(pnpm build-env sontaflowOperator.account)/$(pnpm build-env sontaflowOperator.name) -imageTag=$(pnpm build-env sontaflowOperator.tag) +imageTag=$(pnpm build-env sontaflowOperator.buildTag) version=$(pnpm build-env sontaflowOperator.version) targetSonataflowBuilderImage=$(pnpm build-env sontaflowOperator.sonataflowBuilderImage) @@ -60,6 +60,7 @@ node -p "require('replace-in-file').sync({ from: /sonataflow-operator-system\/so node -p "require('replace-in-file').sync({ from: /\bOperatorVersion = .*/g, to: 'OperatorVersion = \"${version}\"', files: ['version/version.go'] });" node -p "require('replace-in-file').sync({ from: /\btagVersion = .*/g, to: 'tagVersion = \"${imageTag}\"', files: ['version/version.go'] });" +node -p "require('replace-in-file').sync({ from: /\bkogitoImagesTagVersion = .*/g, to: 'kogitoImagesTagVersion = \"${imageTag}\"', files: ['version/version.go'] });" node -p "require('replace-in-file').sync({ from: /\bcontainerImage:.*\b/g, to: 'containerImage: ${targetSonataflowOperatorImage}', files: ['$(getCsvFile)'] });" make generate-all diff --git a/packages/sonataflow-operator/images/requirements.txt b/packages/sonataflow-operator/images/requirements.txt index 87a0ef5117c..c0ed2e16a76 100644 --- a/packages/sonataflow-operator/images/requirements.txt +++ b/packages/sonataflow-operator/images/requirements.txt @@ -1,4 +1,4 @@ -# Requirements for cekit 4.11.0 build +# Requirements for cekit 4.12.0 build # see: https://pip.pypa.io/en/stable/reference/requirements-file-format/ docker-squash odcs diff --git a/packages/sonataflow-operator/install.js b/packages/sonataflow-operator/install.js index 2a1d0bb8733..07419fde7ef 100644 --- a/packages/sonataflow-operator/install.js +++ b/packages/sonataflow-operator/install.js @@ -19,13 +19,14 @@ const fs = require("fs"); const path = require("path"); -const buildEnv = require("./env"); +const { env } = require("./env"); const sonataflowPlatformFiles = fs .readdirSync(path.resolve(__dirname, "test/testdata"), { recursive: true, }) .filter((fileName) => fileName.endsWith("02-sonataflow_platform.yaml")); + sonataflowPlatformFiles.forEach((filePath) => { const fullFilePath = path.resolve(__dirname, path.join("test/testdata"), filePath); fs.writeFileSync( @@ -34,11 +35,11 @@ sonataflowPlatformFiles.forEach((filePath) => { .readFileSync(fullFilePath, "utf-8") .replace( /org\.kie:kie-addons-quarkus-persistence-jdbc:[^,\n]*/, - `org.kie:kie-addons-quarkus-persistence-jdbc:${buildEnv.env.kogitoRuntime.version}` + `org.kie:kie-addons-quarkus-persistence-jdbc:${env.kogitoRuntime.version}` ) .replace( /org\.kie\.kogito:kogito-addons-quarkus-jobs-knative-eventing:[^,\n]*/, - `org.kie.kogito:kogito-addons-quarkus-jobs-knative-eventing:${buildEnv.env.kogitoRuntime.version}` + `org.kie.kogito:kogito-addons-quarkus-jobs-knative-eventing:${env.kogitoRuntime.version}` ) ); }); diff --git a/packages/sonataflow-operator/package.json b/packages/sonataflow-operator/package.json index 25cdd5e4a5d..846d641b45a 100644 --- a/packages/sonataflow-operator/package.json +++ b/packages/sonataflow-operator/package.json @@ -40,6 +40,10 @@ "@kie-tools/root-env": "workspace:*", "@kie-tools/sonataflow-builder-image": "workspace:*", "@kie-tools/sonataflow-devmode-image": "workspace:*", + "@kie/kogito-data-index-ephemeral-image": "workspace:*", + "@kie/kogito-data-index-postgresql-image": "workspace:*", + "@kie/kogito-jobs-service-ephemeral-image": "workspace:*", + "@kie/kogito-jobs-service-postgresql-image": "workspace:*", "replace-in-file": "^7.1.0", "rimraf": "^3.0.2", "run-script-os": "^1.1.6" diff --git a/packages/sonataflow-operator/version/version.go b/packages/sonataflow-operator/version/version.go index e028d4226d7..5cfd5fae728 100644 --- a/packages/sonataflow-operator/version/version.go +++ b/packages/sonataflow-operator/version/version.go @@ -32,7 +32,7 @@ const ( // For example, docker.io/apache/incubator-kie-sonataflow-operator:main -> 10.0 tagVersion = "main" // Kogito images tag version. Used for data-index and jobs-service images. - kogitoImagesTagVersion = "main-20240905" + kogitoImagesTagVersion = "main" // OpenJDK image tag version openJDKImageTagVersion = "1.20" ) diff --git a/packages/sonataflow-quarkus-devui/install.js b/packages/sonataflow-quarkus-devui/install.js deleted file mode 100644 index 99bfadb8cf8..00000000000 --- a/packages/sonataflow-quarkus-devui/install.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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 buildEnv = require("./env"); -const { setup } = require("@kie-tools/maven-config-setup-helper"); - -setup(` - -Drevision=${buildEnv.env.sonataflowQuarkusDevuiExtension.version} -`); diff --git a/packages/sonataflow-quarkus-devui/mvn.bootstrap.js b/packages/sonataflow-quarkus-devui/mvn.bootstrap.js new file mode 100644 index 00000000000..92178cbb293 --- /dev/null +++ b/packages/sonataflow-quarkus-devui/mvn.bootstrap.js @@ -0,0 +1,26 @@ +/* + * 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 { env } = require("./env"); +const { setupMavenConfigFile, buildTailFromPackageJsonDependencies } = require("@kie-tools/maven-base"); + +setupMavenConfigFile(` + -Drevision=${env.sonataflowQuarkusDevuiExtension.version} + -Dmaven.repo.local.tail=${buildTailFromPackageJsonDependencies()} +`); diff --git a/packages/sonataflow-quarkus-devui/package.json b/packages/sonataflow-quarkus-devui/package.json index 0e505282968..74c4f7e5965 100644 --- a/packages/sonataflow-quarkus-devui/package.json +++ b/packages/sonataflow-quarkus-devui/package.json @@ -17,9 +17,9 @@ "build:dev:darwin:linux": "mvn clean install -DskipTests", "build:dev:win32": "pnpm powershell \"mvn clean install -DskipTests \"", "build:prod": "pnpm lint && run-script-os", - "build:prod:darwin:linux": "mvn clean deploy -DdeployAtEnd -DskipTests=$(build-env tests.run --not) -Dmaven.test.failure.ignore=$(build-env tests.ignoreFailures) -Dmaven.deploy.skip=$(build-env maven.deploy.skip) -Dreproducible", - "build:prod:win32": "pnpm powershell \"mvn clean deploy `-DdeployAtEnd `-DskipTests `-Dmaven.test.failure.ignore=$(build-env tests.ignoreFailures) `-Dmaven.deploy.skip=$(build-env maven.deploy.skip) `-Dreproducible\"", - "install": "node install.js", + "build:prod:darwin:linux": "mvn clean deploy -DskipTests=$(build-env tests.run --not) -Dmaven.test.failure.ignore=$(build-env tests.ignoreFailures) -Dmaven.deploy.skip=$(build-env maven.deploy.skip) -Dreproducible", + "build:prod:win32": "pnpm powershell \"mvn clean deploy `-DskipTests `-Dmaven.test.failure.ignore=$(build-env tests.ignoreFailures) `-Dmaven.deploy.skip=$(build-env maven.deploy.skip) `-Dreproducible\"", + "install": "node mvn.bootstrap.js", "lint": "echo 'Linting'", "powershell": "@powershell -NoProfile -ExecutionPolicy Unrestricted -Command", "quarkus:dev": "run-script-os", @@ -30,7 +30,6 @@ "@kie-tools/maven-base": "workspace:*" }, "devDependencies": { - "@kie-tools/maven-config-setup-helper": "workspace:*", "@kie-tools/root-env": "workspace:*", "@kie-tools/serverless-workflow-dev-ui-webapp": "workspace:*", "run-script-os": "^1.1.6" diff --git a/packages/sonataflow-quarkus-devui/pom.xml b/packages/sonataflow-quarkus-devui/pom.xml index bde74599d0a..cac8381adef 100644 --- a/packages/sonataflow-quarkus-devui/pom.xml +++ b/packages/sonataflow-quarkus-devui/pom.xml @@ -33,6 +33,7 @@ org.apache.kie.sonataflow sonataflow-quarkus-devui-parent + ${revision} KIE Tools :: SonataFlow Quarkus Dev UI Extension diff --git a/packages/sonataflow-quarkus-devui/sonataflow-quarkus-devui-deployment/pom.xml b/packages/sonataflow-quarkus-devui/sonataflow-quarkus-devui-deployment/pom.xml index b9d9eaa5486..644c1093286 100644 --- a/packages/sonataflow-quarkus-devui/sonataflow-quarkus-devui-deployment/pom.xml +++ b/packages/sonataflow-quarkus-devui/sonataflow-quarkus-devui-deployment/pom.xml @@ -116,7 +116,6 @@ maven-compiler-plugin - ${compiler-plugin.version} @@ -129,7 +128,6 @@ maven-resources-plugin - ${version.resources.plugin} copy-webapp diff --git a/packages/sonataflow-quarkus-devui/sonataflow-quarkus-devui/pom.xml b/packages/sonataflow-quarkus-devui/sonataflow-quarkus-devui/pom.xml index d2af94d419f..00917e62ed4 100644 --- a/packages/sonataflow-quarkus-devui/sonataflow-quarkus-devui/pom.xml +++ b/packages/sonataflow-quarkus-devui/sonataflow-quarkus-devui/pom.xml @@ -145,7 +145,6 @@ maven-compiler-plugin - ${compiler-plugin.version} diff --git a/packages/stunner-editors-dmn-loader/webpack.config.js b/packages/stunner-editors-dmn-loader/webpack.config.js index 007ded04be1..d7c69102038 100644 --- a/packages/stunner-editors-dmn-loader/webpack.config.js +++ b/packages/stunner-editors-dmn-loader/webpack.config.js @@ -22,13 +22,12 @@ const { merge } = require("webpack-merge"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const patternflyBase = require("@kie-tools-core/patternfly-base"); const { env } = require("./env"); -const buildEnv = env; -module.exports = (env) => { - const outputPath = buildEnv.stunnerEditors.dmnLoader.outputPath; +module.exports = (webpackEnv) => { + const outputPath = env.stunnerEditors.dmnLoader.outputPath; console.info(`Stunner Editors :: DMN Loader :: Output path: '${outputPath}'`); - return merge(common(env), { + return merge(common(webpackEnv), { entry: "./src/index.tsx", target: "web", diff --git a/packages/stunner-editors/mvn.bootstrap.js b/packages/stunner-editors/mvn.bootstrap.js new file mode 100644 index 00000000000..58312e31843 --- /dev/null +++ b/packages/stunner-editors/mvn.bootstrap.js @@ -0,0 +1,32 @@ +/* + * 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 { env } = require("./env"); +const { setupMavenConfigFile, buildTailFromPackageJsonDependencies } = require("@kie-tools/maven-base"); + +setupMavenConfigFile( + ` + --batch-mode + -Dstyle.color=always + -Drevision=${env.stunnerEditors.version} + -Dversion.org.kie.kogito=${env.kogitoRuntime.version} + -Dmaven.repo.local.tail=${buildTailFromPackageJsonDependencies()} +`, + { ignoreDefault: true } // Default configuration doesn't work for this module. Since this module is not going to last long, we rely on this workaround for a while. +); diff --git a/packages/stunner-editors/package.json b/packages/stunner-editors/package.json index b18d4273885..5aac7a67f50 100644 --- a/packages/stunner-editors/package.json +++ b/packages/stunner-editors/package.json @@ -28,12 +28,12 @@ "dist:bpmn": "symlink-dir kie-wb-common-stunner/kie-wb-common-stunner-sets/kie-wb-common-stunner-bpmn/kie-wb-common-stunner-bpmn-kogito-runtime/target/kie-wb-common-stunner-bpmn-kogito-runtime ./dist/bpmn", "dist:dmn": "symlink-dir kie-wb-common-dmn/kie-wb-common-dmn-webapp-kogito-runtime/target/kie-wb-common-dmn-webapp-kogito-runtime ./dist/dmn", "dist:scesim": "symlink-dir drools-wb-screens/drools-wb-scenario-simulation-editor/drools-wb-scenario-simulation-editor-kogito-runtime/target/drools-wb-scenario-simulation-editor-kogito-runtime ./dist/scesim", - "install": "node install.js", + "install": "node mvn.bootstrap.js", "lint": "echo 'Linting'", "powershell": "@powershell -NoProfile -ExecutionPolicy Unrestricted -Command" }, "devDependencies": { - "@kie-tools/maven-config-setup-helper": "workspace:*", + "@kie-tools/maven-base": "workspace:*", "@kie-tools/root-env": "workspace:*", "@kie-tools/stunner-editors-dmn-loader": "workspace:*", "rimraf": "^3.0.2", diff --git a/packages/stunner-editors/pom.xml b/packages/stunner-editors/pom.xml index bcf725aad35..71d959e544b 100644 --- a/packages/stunner-editors/pom.xml +++ b/packages/stunner-editors/pom.xml @@ -2103,5 +2103,30 @@ ${env.ghprbTargetBranch} + + + + + use-maven-repo-local-tail + + + kieTools.do-not-use-this-property.ignoreMavenRepoLocalTail + !true + + + + + + + org.apache.maven.plugins + maven-install-plugin + + true + + + + + + diff --git a/packages/uniforms-bootstrap4-codegen/webpack.config.js b/packages/uniforms-bootstrap4-codegen/webpack.config.js index 5064b497e5b..0faa9a9c8d8 100644 --- a/packages/uniforms-bootstrap4-codegen/webpack.config.js +++ b/packages/uniforms-bootstrap4-codegen/webpack.config.js @@ -23,8 +23,8 @@ const nodeExternals = require("webpack-node-externals"); const CopyPlugin = require("copy-webpack-plugin"); const path = require("path"); -module.exports = (env, args) => [ - merge(common(env, args), { +module.exports = (webpackEnv, webpackArgv) => [ + merge(common(webpackEnv, webpackArgv), { entry: { index: "./src/index.ts", }, diff --git a/packages/uniforms-patternfly-codegen/webpack.config.js b/packages/uniforms-patternfly-codegen/webpack.config.js index e443c933a6d..2971e12cfb1 100644 --- a/packages/uniforms-patternfly-codegen/webpack.config.js +++ b/packages/uniforms-patternfly-codegen/webpack.config.js @@ -22,8 +22,8 @@ const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const nodeExternals = require("webpack-node-externals"); const CopyPlugin = require("copy-webpack-plugin"); -module.exports = (env) => [ - merge(common(env), { +module.exports = (webpackEnv) => [ + merge(common(webpackEnv), { entry: { index: "./src/index.ts", }, diff --git a/packages/vscode-extension-dashbuilder-editor/webpack.config.js b/packages/vscode-extension-dashbuilder-editor/webpack.config.js index 8b23d8cf429..9c4419e03fd 100644 --- a/packages/vscode-extension-dashbuilder-editor/webpack.config.js +++ b/packages/vscode-extension-dashbuilder-editor/webpack.config.js @@ -24,8 +24,8 @@ const dashbuilderClient = require("@kie-tools/dashbuilder-client"); const { merge } = require("webpack-merge"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); -const commonConfig = (env) => - merge(common(env), { +const commonConfig = (webpackEnv) => + merge(common(webpackEnv), { output: { library: "DashbuilderEditor", libraryTarget: "umd", @@ -37,15 +37,15 @@ const commonConfig = (env) => }, }); -module.exports = async (env) => [ - merge(commonConfig(env), { +module.exports = async (webpackEnv) => [ + merge(commonConfig(webpackEnv), { target: "node", entry: { "extension/extension": "./src/extension/extension.ts", }, plugins: [], }), - merge(commonConfig(env), { + merge(commonConfig(webpackEnv), { target: "webworker", entry: { "browser/extension": "./src/browser/extension.ts", @@ -57,7 +57,7 @@ module.exports = async (env) => [ }), ], }), - merge(commonConfig(env), { + merge(commonConfig(webpackEnv), { target: "web", entry: { "webview/DashbuilderEditorEnvelopeApp": "./src/webview/DashbuilderEditorEnvelopeApp.ts", diff --git a/packages/vscode-extension-kie-ba-bundle/webpack.config.js b/packages/vscode-extension-kie-ba-bundle/webpack.config.js index cfe2975d743..50a126aeb13 100644 --- a/packages/vscode-extension-kie-ba-bundle/webpack.config.js +++ b/packages/vscode-extension-kie-ba-bundle/webpack.config.js @@ -20,8 +20,8 @@ const { merge } = require("webpack-merge"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); -module.exports = async (env) => [ - merge(common(env), { +module.exports = async (webpackEnv) => [ + merge(common(webpackEnv), { output: { library: "VsCodeExtensionKieBaBundle", libraryTarget: "umd", diff --git a/packages/vscode-extension-kogito-bundle/webpack.config.js b/packages/vscode-extension-kogito-bundle/webpack.config.js index 5d5fe06b019..fa82d0700d2 100644 --- a/packages/vscode-extension-kogito-bundle/webpack.config.js +++ b/packages/vscode-extension-kogito-bundle/webpack.config.js @@ -20,8 +20,8 @@ const { merge } = require("webpack-merge"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); -module.exports = async (env) => [ - merge(common(env), { +module.exports = async (webpackEnv) => [ + merge(common(webpackEnv), { output: { library: "KogitoBundle", libraryTarget: "umd", diff --git a/packages/vscode-java-code-completion-extension-plugin/install.js b/packages/vscode-java-code-completion-extension-plugin/mvn.bootstrap.js similarity index 79% rename from packages/vscode-java-code-completion-extension-plugin/install.js rename to packages/vscode-java-code-completion-extension-plugin/mvn.bootstrap.js index 3fcd2b81a0f..c599d90c1a6 100644 --- a/packages/vscode-java-code-completion-extension-plugin/install.js +++ b/packages/vscode-java-code-completion-extension-plugin/mvn.bootstrap.js @@ -17,20 +17,25 @@ * under the License. */ -const buildEnv = require("./env"); -const { setup } = require("@kie-tools/maven-config-setup-helper"); +const { env } = require("./env"); +const { setupMavenConfigFile, installMvnw, buildTailFromPackageJsonDependencies } = require("@kie-tools/maven-base"); + +const version = env.vscodeJavaCodeCompletionExtensionPlugin.version; + +setupMavenConfigFile(` + -Drevision=${version} + -Dmaven.repo.local.tail=${buildTailFromPackageJsonDependencies()} +`); + +installMvnw(); + +// Manifest file + const fs = require("fs"); const path = require("path"); const MANIFEST_FILE = path.resolve("vscode-java-code-completion-extension-plugin-core/META-INF/MANIFEST.MF"); -console.info("[vscode-java-code-completion-extension-plugin-install] Updating '.mvn/maven.config'..."); -const version = buildEnv.env.vscodeJavaCodeCompletionExtensionPlugin.version; - -setup(` - -Drevision=${version} -`); - console.info("[vscode-java-code-completion-extension-plugin-install] Updating manifest file..."); const manifestFile = fs.readFileSync(MANIFEST_FILE, "utf-8"); diff --git a/packages/vscode-java-code-completion-extension-plugin/package.json b/packages/vscode-java-code-completion-extension-plugin/package.json index 1a16d3f4065..b15e95b71d9 100644 --- a/packages/vscode-java-code-completion-extension-plugin/package.json +++ b/packages/vscode-java-code-completion-extension-plugin/package.json @@ -24,8 +24,7 @@ "build:prod": "pnpm lint && run-script-os", "build:prod:darwin:linux": "mvn clean install -DskipTests=$(build-env tests.run --not) -Dmaven.test.failure.ignore=$(build-env tests.ignoreFailures) -Dreproducible", "build:prod:win32": "pnpm powershell \"mvn clean install `-DskipTests=$(build-env tests.run --not) `-Dmaven.test.failure.ignore=$(build-env tests.ignoreFailures) `-Dreproducible\"", - "install": "node install.js && pnpm install:mvnw", - "install:mvnw": "mvn -e org.apache.maven.plugins:maven-wrapper-plugin:3.3.0:wrapper -f ./", + "install": "node mvn.bootstrap.js", "lint": "echo 'Linting'", "powershell": "@powershell -NoProfile -ExecutionPolicy Unrestricted -Command" }, @@ -33,7 +32,6 @@ "@kie-tools/maven-base": "workspace:*" }, "devDependencies": { - "@kie-tools/maven-config-setup-helper": "workspace:*", "@kie-tools/root-env": "workspace:*", "run-script-os": "^1.1.6" }, diff --git a/packages/vscode-java-code-completion-extension-plugin/pom.xml b/packages/vscode-java-code-completion-extension-plugin/pom.xml index 556e46a65cf..ae69b9f4599 100644 --- a/packages/vscode-java-code-completion-extension-plugin/pom.xml +++ b/packages/vscode-java-code-completion-extension-plugin/pom.xml @@ -112,7 +112,6 @@ org.codehaus.mojo flatten-maven-plugin - ${version.flatten.plugin} true resolveCiFriendliesOnly diff --git a/packages/webpack-base/webpack.common.config.d.ts b/packages/webpack-base/webpack.common.config.d.ts index c246cd27f3e..2425777a0be 100644 --- a/packages/webpack-base/webpack.common.config.d.ts +++ b/packages/webpack-base/webpack.common.config.d.ts @@ -19,4 +19,4 @@ import * as webpack from "webpack"; -export default function common(env: any): webpack.Configuration; +export default function common(webpackEnv: any): webpack.Configuration; diff --git a/packages/webpack-base/webpack.common.config.js b/packages/webpack-base/webpack.common.config.js index 73d9e5a509d..a10f0c908fe 100644 --- a/packages/webpack-base/webpack.common.config.js +++ b/packages/webpack-base/webpack.common.config.js @@ -20,14 +20,12 @@ const path = require("path"); const webpackBaseEnv = require("./env"); -module.exports = (env) => { - const webpackEnv = env.dev ? webpackBaseEnv.env.webpack.dev : webpackBaseEnv.env.webpack.prod; +module.exports = (webpackEnv) => { + const { transpileOnly, minimize, sourceMaps, mode } = webpackEnv.dev + ? webpackBaseEnv.env.webpack.dev + : webpackBaseEnv.env.webpack.prod; - const transpileOnly = webpackEnv.transpileOnly; - const minimize = webpackEnv.minimize; - const sourceMaps = webpackEnv.sourceMaps; - const mode = webpackEnv.mode; - const live = env.live; + const live = webpackEnv.live; console.info(`Webpack :: ts-loader :: transpileOnly: ${transpileOnly}`); console.info(`Webpack :: minimize: ${minimize}`); diff --git a/packages/yard-editor/dev-webapp/webpack.config.js b/packages/yard-editor/dev-webapp/webpack.config.js index bf2cc9a10ce..46b25cc0a01 100644 --- a/packages/yard-editor/dev-webapp/webpack.config.js +++ b/packages/yard-editor/dev-webapp/webpack.config.js @@ -24,10 +24,9 @@ const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const patternflyBase = require("@kie-tools-core/patternfly-base"); const MonacoWebpackPlugin = require("monaco-editor-webpack-plugin"); const { env } = require("../env"); -const buildEnv = env; -module.exports = (env) => - merge(common(env), { +module.exports = (webpackEnv) => + merge(common(webpackEnv), { mode: "development", entry: { index: path.resolve(__dirname, "./index.tsx"), @@ -74,6 +73,6 @@ module.exports = (env) => historyApiFallback: true, static: [{ directory: path.join(__dirname) }], compress: true, - port: buildEnv.yardEditor.dev.port, + port: env.yardEditor.dev.port, }, }); diff --git a/packages/yard-model/install.js b/packages/yard-model/install.js deleted file mode 100644 index aa46eae8f39..00000000000 --- a/packages/yard-model/install.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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 buildEnv = require("./env"); -const { setup } = require("@kie-tools/maven-config-setup-helper"); - -setup(` - -Drevision=${buildEnv.env.yardModel.version} -`); diff --git a/packages/jbpm-quarkus-devui/install.js b/packages/yard-model/mvn.bootstrap.js similarity index 73% rename from packages/jbpm-quarkus-devui/install.js rename to packages/yard-model/mvn.bootstrap.js index fbc73cb1c4c..33bb69a2439 100644 --- a/packages/jbpm-quarkus-devui/install.js +++ b/packages/yard-model/mvn.bootstrap.js @@ -17,9 +17,12 @@ * under the License. */ -const buildEnv = require("./env"); -const { setup } = require("@kie-tools/maven-config-setup-helper"); +const { env } = require("./env"); +const { setupMavenConfigFile, installMvnw, buildTailFromPackageJsonDependencies } = require("@kie-tools/maven-base"); -setup(` - -Drevision=${buildEnv.env.jbpmQuarkusDevuiExtension.version} +setupMavenConfigFile(` + -Drevision=${env.yardModel.version} + -Dmaven.repo.local.tail=${buildTailFromPackageJsonDependencies()} `); + +installMvnw(); diff --git a/packages/yard-model/package.json b/packages/yard-model/package.json index 2d2dda942f5..80072dc7ed2 100644 --- a/packages/yard-model/package.json +++ b/packages/yard-model/package.json @@ -20,10 +20,7 @@ "build:prod": "pnpm lint && run-script-os", "build:prod:darwin:linux": "mvn clean install -DskipTests=$(build-env tests.run --not) -Dmaven.test.failure.ignore=$(build-env tests.ignoreFailures) -Dreproducible", "build:prod:win32": "pnpm powershell \"mvn clean install `-DskipTests=$(build-env tests.run --not) `-Dmaven.test.failure.ignore=$(build-env tests.ignoreFailures) `-Dreproducible\"", - "install": "node install.js && pnpm install:mvnw", - "install:mvnw": "run-script-os", - "install:mvnw:darwin:linux": "mvn -e org.apache.maven.plugins:maven-wrapper-plugin:3.3.0:wrapper", - "install:mvnw:win32": "pnpm powershell \"mvn -e org.apache.maven.plugins:maven-wrapper-plugin:3.3.0:wrapper\"", + "install": "node mvn.bootstrap.js", "lint": "echo 'Linting'", "powershell": "@powershell -NoProfile -ExecutionPolicy Unrestricted -Command" }, @@ -31,7 +28,6 @@ "@kie-tools/maven-base": "workspace:*" }, "devDependencies": { - "@kie-tools/maven-config-setup-helper": "workspace:*", "@kie-tools/root-env": "workspace:*", "copy-webpack-plugin": "^11.0.0", "rimraf": "^3.0.2", diff --git a/packages/yard-validator-worker/install.js b/packages/yard-validator-worker/install.js deleted file mode 100644 index 4247286a3fc..00000000000 --- a/packages/yard-validator-worker/install.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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 buildEnv = require("./env"); -const { setup } = require("@kie-tools/maven-config-setup-helper"); - -setup(` - -Drevision=${buildEnv.env.yardValidator.version} -`); diff --git a/packages/yard-validator-worker/mvn.bootstrap.js b/packages/yard-validator-worker/mvn.bootstrap.js new file mode 100644 index 00000000000..5699ac5486b --- /dev/null +++ b/packages/yard-validator-worker/mvn.bootstrap.js @@ -0,0 +1,33 @@ +/* + * 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 { env } = require("./env"); +const { + setupMavenConfigFile, + installMvnw, + buildTailFromPackageJsonDependencies, + DEFAULT_LOCAL_REPO, +} = require("@kie-tools/maven-base"); + +setupMavenConfigFile(` + -Drevision=${env.yardValidator.version} + -Dmaven.repo.local.tail=${buildTailFromPackageJsonDependencies()},${DEFAULT_LOCAL_REPO} +`); // For some reason, j2cl-maven-plugin needs the DEFAULT_LOCAL_REPO here as the last tail too. + +installMvnw(); diff --git a/packages/yard-validator-worker/package.json b/packages/yard-validator-worker/package.json index 21edd51a301..c3f72a2c48e 100644 --- a/packages/yard-validator-worker/package.json +++ b/packages/yard-validator-worker/package.json @@ -21,20 +21,16 @@ "build:prod:darwin:linux": "mvn clean install -DskipTests=$(build-env tests.run --not) -Dmaven.test.failure.ignore=$(build-env tests.ignoreFailures) -Dreproducible", "build:prod:win32": "pnpm powershell \"mvn clean install `-DskipTests=$(build-env tests.run --not) `-Dmaven.test.failure.ignore=$(build-env tests.ignoreFailures) `-Dreproducible\"", "copy:webworker": "copyfiles -f target/worker/yard-validator-worker/yard-validator-worker.js dist", - "install": "node install.js && pnpm install:mvnw", - "install:mvnw": "run-script-os", - "install:mvnw:darwin:linux": "mvn -e org.apache.maven.plugins:maven-wrapper-plugin:3.3.0:wrapper", - "install:mvnw:win32": "pnpm powershell \"mvn -e org.apache.maven.plugins:maven-wrapper-plugin:3.3.0:wrapper\"", + "install": "node mvn.bootstrap.js", "lint": "echo 'Linting'", "powershell": "@powershell -NoProfile -ExecutionPolicy Unrestricted -Command" }, "dependencies": { - "@kie-tools/maven-base": "workspace:*" + "@kie-tools/maven-base": "workspace:*", + "@kie-tools/yard-model": "workspace:*" }, "devDependencies": { - "@kie-tools/maven-config-setup-helper": "workspace:*", "@kie-tools/root-env": "workspace:*", - "@kie-tools/yard-model": "workspace:*", "copyfiles": "^2.4.1", "rimraf": "^3.0.2", "run-script-os": "^1.1.6" diff --git a/packages/yard-validator-worker/pom.xml b/packages/yard-validator-worker/pom.xml index 3b48a8bd075..4d2b3f7d498 100644 --- a/packages/yard-validator-worker/pom.xml +++ b/packages/yard-validator-worker/pom.xml @@ -45,7 +45,6 @@ 2024-01-12T00:00:00Z 0.4 2.0.10 - 3.13.0 11 11 0.23.0 @@ -58,18 +57,6 @@ 0.4 - - org.kie.kogito - yard-model - ${project.version} - - - org.kie.kogito - yard-model - ${project.version} - sources - - junit junit @@ -78,6 +65,31 @@ + + + include-1st-party-dependencies + + + kieTools.do-not-use-this-property.ignore1stPartyDependencies + !true + + + + + org.kie.kogito + yard-model + ${project.version} + + + org.kie.kogito + yard-model + ${project.version} + sources + + + + + diff --git a/packages/yard-vscode-extension/webpack.config.js b/packages/yard-vscode-extension/webpack.config.js index 572356d3c1a..3b0adefe944 100644 --- a/packages/yard-vscode-extension/webpack.config.js +++ b/packages/yard-vscode-extension/webpack.config.js @@ -23,8 +23,8 @@ const common = require("@kie-tools-core/webpack-base/webpack.common.config"); const MonacoWebpackPlugin = require("monaco-editor-webpack-plugin"); const { ProvidePlugin } = require("webpack"); -const commonConfig = (env) => - merge(common(env), { +const commonConfig = (webpackEnv) => + merge(common(webpackEnv), { output: { library: "YardEditor", libraryTarget: "umd", @@ -36,14 +36,14 @@ const commonConfig = (env) => }, }); -module.exports = async (env) => [ - merge(commonConfig(env), { +module.exports = async (webpackEnv) => [ + merge(commonConfig(webpackEnv), { target: "node", entry: { "extension/extension": "./src/extension/extension.ts", }, }), - merge(commonConfig(env), { + merge(commonConfig(webpackEnv), { target: "webworker", entry: { "extension/extensionWeb": "./src/extension/extension.ts", @@ -55,7 +55,7 @@ module.exports = async (env) => [ }), ], }), - merge(commonConfig(env), { + merge(commonConfig(webpackEnv), { target: "web", entry: { "webview/YardEditorEnvelopeApp": "./src/webview/YardEditorEnvelopeApp.ts", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7a7854836e8..8a29f8301e5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -306,9 +306,6 @@ importers: specifier: workspace:* version: link:../../packages/maven-base devDependencies: - '@kie-tools/maven-config-setup-helper': - specifier: workspace:* - version: link:../../packages/maven-config-setup-helper '@kie-tools/root-env': specifier: workspace:* version: link:../../packages/root-env @@ -331,9 +328,6 @@ importers: '@kie-tools/kogito-task-console': specifier: workspace:* version: link:../../packages/kogito-task-console - '@kie-tools/maven-config-setup-helper': - specifier: workspace:* - version: link:../../packages/maven-config-setup-helper '@kie-tools/root-env': specifier: workspace:* version: link:../../packages/root-env @@ -485,9 +479,6 @@ importers: specifier: workspace:* version: link:../../packages/sonataflow-quarkus-devui devDependencies: - '@kie-tools/maven-config-setup-helper': - specifier: workspace:* - version: link:../../packages/maven-config-setup-helper '@kie-tools/root-env': specifier: workspace:* version: link:../../packages/root-env @@ -861,13 +852,13 @@ importers: version: 1.67.0 jest: specifier: ^29.7.0 - version: 29.7.0(@types/node@22.5.2)(node-notifier@8.0.2)(ts-node@10.9.2(@types/node@22.5.2)(typescript@5.5.3)) + version: 29.7.0(@types/node@20.14.2)(node-notifier@8.0.2)(ts-node@10.9.2(@types/node@20.14.2)(typescript@5.5.3)) jest-junit: specifier: ^16.0.0 version: 16.0.0 jest-when: specifier: ^3.6.0 - version: 3.6.0(jest@29.7.0(@types/node@22.5.2)(node-notifier@8.0.2)(ts-node@10.9.2(@types/node@22.5.2)(typescript@5.5.3))) + version: 3.6.0(jest@29.7.0(@types/node@20.14.2)(node-notifier@8.0.2)(ts-node@10.9.2(@types/node@20.14.2)(typescript@5.5.3))) rimraf: specifier: ^3.0.2 version: 3.0.2 @@ -876,7 +867,7 @@ importers: version: 0.0.2 ts-jest: specifier: ^29.1.5 - version: 29.1.5(@babel/core@7.16.12)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.16.12))(jest@29.7.0(@types/node@22.5.2)(node-notifier@8.0.2)(ts-node@10.9.2(@types/node@22.5.2)(typescript@5.5.3)))(typescript@5.5.3) + version: 29.1.5(@babel/core@7.16.12)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.16.12))(jest@29.7.0(@types/node@20.14.2)(node-notifier@8.0.2)(ts-node@10.9.2(@types/node@20.14.2)(typescript@5.5.3)))(typescript@5.5.3) typescript: specifier: ^5.5.3 version: 5.5.3 @@ -1688,9 +1679,6 @@ importers: '@kie-tools/dashbuilder-component-assembler': specifier: workspace:* version: link:../dashbuilder-component-assembler - '@kie-tools/maven-config-setup-helper': - specifier: workspace:* - version: link:../maven-config-setup-helper '@kie-tools/root-env': specifier: workspace:* version: link:../root-env @@ -2994,9 +2982,6 @@ importers: '@kie-tools/image-builder': specifier: workspace:* version: link:../image-builder - '@kie-tools/maven-config-setup-helper': - specifier: workspace:* - version: link:../maven-config-setup-helper '@kie-tools/root-env': specifier: workspace:* version: link:../root-env @@ -3193,10 +3178,14 @@ importers: version: 1.1.2 packages/dev-deployment-kogito-quarkus-blank-app: - devDependencies: - '@kie-tools/maven-config-setup-helper': + dependencies: + '@kie-tools/jbpm-quarkus-devui': + specifier: workspace:* + version: link:../jbpm-quarkus-devui + '@kie-tools/maven-base': specifier: workspace:* - version: link:../maven-config-setup-helper + version: link:../maven-base + devDependencies: '@kie-tools/root-env': specifier: workspace:* version: link:../root-env @@ -3216,9 +3205,9 @@ importers: '@kie-tools/image-builder': specifier: workspace:* version: link:../image-builder - '@kie-tools/maven-config-setup-helper': + '@kie-tools/maven-base': specifier: workspace:* - version: link:../maven-config-setup-helper + version: link:../maven-base '@kie-tools/maven-m2-repo-via-http-image': specifier: workspace:* version: link:../maven-m2-repo-via-http-image @@ -4028,9 +4017,6 @@ importers: specifier: workspace:* version: link:../maven-base devDependencies: - '@kie-tools/maven-config-setup-helper': - specifier: workspace:* - version: link:../maven-config-setup-helper '@kie-tools/root-env': specifier: workspace:* version: link:../root-env @@ -4194,7 +4180,7 @@ importers: version: link:../tsconfig '@testing-library/jest-dom': specifier: ^6.4.6 - version: 6.4.6(@jest/globals@29.7.0)(@types/jest@29.5.12)(jest@29.7.0(@types/node@20.14.2)(node-notifier@8.0.2)(ts-node@10.9.2(@types/node@20.14.2)(typescript@5.5.3))) + version: 6.4.6(@jest/globals@29.7.0)(@types/jest@29.5.12)(jest@29.7.0(@types/node@22.5.2)(node-notifier@8.0.2)(ts-node@10.9.2(@types/node@22.5.2)(typescript@5.5.3))) '@testing-library/react': specifier: ^12.1.5 version: 12.1.5(react-dom@17.0.2(react@17.0.2))(react@17.0.2) @@ -4221,7 +4207,7 @@ importers: version: 2.4.1 jest: specifier: ^29.7.0 - version: 29.7.0(@types/node@20.14.2)(node-notifier@8.0.2)(ts-node@10.9.2(@types/node@20.14.2)(typescript@5.5.3)) + version: 29.7.0(@types/node@22.5.2)(node-notifier@8.0.2)(ts-node@10.9.2(@types/node@22.5.2)(typescript@5.5.3)) jest-environment-jsdom: specifier: ^29.7.0 version: 29.7.0 @@ -4230,13 +4216,13 @@ importers: version: 16.0.0 jest-when: specifier: ^3.6.0 - version: 3.6.0(jest@29.7.0(@types/node@20.14.2)(node-notifier@8.0.2)(ts-node@10.9.2(@types/node@20.14.2)(typescript@5.5.3))) + version: 3.6.0(jest@29.7.0(@types/node@22.5.2)(node-notifier@8.0.2)(ts-node@10.9.2(@types/node@22.5.2)(typescript@5.5.3))) rimraf: specifier: ^3.0.2 version: 3.0.2 ts-jest: specifier: ^29.1.5 - version: 29.1.5(@babel/core@7.16.12)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.16.12))(jest@29.7.0(@types/node@20.14.2)(node-notifier@8.0.2)(ts-node@10.9.2(@types/node@20.14.2)(typescript@5.5.3)))(typescript@5.5.3) + version: 29.1.5(@babel/core@7.16.12)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.16.12))(jest@29.7.0(@types/node@22.5.2)(node-notifier@8.0.2)(ts-node@10.9.2(@types/node@22.5.2)(typescript@5.5.3)))(typescript@5.5.3) typescript: specifier: ^5.5.3 version: 5.5.3 @@ -4424,9 +4410,6 @@ importers: specifier: workspace:* version: link:../maven-base devDependencies: - '@kie-tools/maven-config-setup-helper': - specifier: workspace:* - version: link:../maven-config-setup-helper '@kie-tools/root-env': specifier: workspace:* version: link:../root-env @@ -5251,9 +5234,6 @@ importers: specifier: workspace:* version: link:../maven-base devDependencies: - '@kie-tools/maven-config-setup-helper': - specifier: workspace:* - version: link:../maven-config-setup-helper '@kie-tools/root-env': specifier: workspace:* version: link:../root-env @@ -6094,6 +6074,13 @@ importers: version: 1.1.2 packages/kn-plugin-workflow: + dependencies: + '@kie-tools/maven-base': + specifier: workspace:* + version: link:../maven-base + '@kie-tools/sonataflow-quarkus-devui': + specifier: workspace:* + version: link:../sonataflow-quarkus-devui devDependencies: '@kie-tools/root-env': specifier: workspace:* @@ -6114,6 +6101,174 @@ importers: specifier: ^1.1.6 version: 1.1.6 + packages/kogito-base-builder-image: + devDependencies: + '@kie-tools/python-venv': + specifier: workspace:* + version: link:../python-venv + '@kie-tools/root-env': + specifier: workspace:* + version: link:../root-env + '@kie-tools/sonataflow-image-common': + specifier: workspace:* + version: link:../sonataflow-image-common + cross-env: + specifier: ^7.0.3 + version: 7.0.3 + replace-in-file: + specifier: ^7.1.0 + version: 7.1.0 + rimraf: + specifier: ^3.0.2 + version: 3.0.2 + run-script-os: + specifier: ^1.1.6 + version: 1.1.6 + + packages/kogito-data-index-ephemeral-image: + devDependencies: + '@kie-tools/python-venv': + specifier: workspace:* + version: link:../python-venv + '@kie-tools/root-env': + specifier: workspace:* + version: link:../root-env + '@kie-tools/sonataflow-image-common': + specifier: workspace:* + version: link:../sonataflow-image-common + cross-env: + specifier: ^7.0.3 + version: 7.0.3 + replace-in-file: + specifier: ^7.1.0 + version: 7.1.0 + rimraf: + specifier: ^3.0.2 + version: 3.0.2 + run-script-os: + specifier: ^1.1.6 + version: 1.1.6 + + packages/kogito-data-index-postgresql-image: + devDependencies: + '@kie-tools/python-venv': + specifier: workspace:* + version: link:../python-venv + '@kie-tools/root-env': + specifier: workspace:* + version: link:../root-env + '@kie-tools/sonataflow-image-common': + specifier: workspace:* + version: link:../sonataflow-image-common + cross-env: + specifier: ^7.0.3 + version: 7.0.3 + replace-in-file: + specifier: ^7.1.0 + version: 7.1.0 + rimraf: + specifier: ^3.0.2 + version: 3.0.2 + run-script-os: + specifier: ^1.1.6 + version: 1.1.6 + + packages/kogito-jit-runner-image: + devDependencies: + '@kie-tools/python-venv': + specifier: workspace:* + version: link:../python-venv + '@kie-tools/root-env': + specifier: workspace:* + version: link:../root-env + '@kie-tools/sonataflow-image-common': + specifier: workspace:* + version: link:../sonataflow-image-common + cross-env: + specifier: ^7.0.3 + version: 7.0.3 + replace-in-file: + specifier: ^7.1.0 + version: 7.1.0 + rimraf: + specifier: ^3.0.2 + version: 3.0.2 + run-script-os: + specifier: ^1.1.6 + version: 1.1.6 + + packages/kogito-jobs-service-allinone-image: + devDependencies: + '@kie-tools/python-venv': + specifier: workspace:* + version: link:../python-venv + '@kie-tools/root-env': + specifier: workspace:* + version: link:../root-env + '@kie-tools/sonataflow-image-common': + specifier: workspace:* + version: link:../sonataflow-image-common + cross-env: + specifier: ^7.0.3 + version: 7.0.3 + replace-in-file: + specifier: ^7.1.0 + version: 7.1.0 + rimraf: + specifier: ^3.0.2 + version: 3.0.2 + run-script-os: + specifier: ^1.1.6 + version: 1.1.6 + + packages/kogito-jobs-service-ephemeral-image: + devDependencies: + '@kie-tools/python-venv': + specifier: workspace:* + version: link:../python-venv + '@kie-tools/root-env': + specifier: workspace:* + version: link:../root-env + '@kie-tools/sonataflow-image-common': + specifier: workspace:* + version: link:../sonataflow-image-common + cross-env: + specifier: ^7.0.3 + version: 7.0.3 + replace-in-file: + specifier: ^7.1.0 + version: 7.1.0 + rimraf: + specifier: ^3.0.2 + version: 3.0.2 + run-script-os: + specifier: ^1.1.6 + version: 1.1.6 + + packages/kogito-jobs-service-postgresql-image: + devDependencies: + '@kie-tools/python-venv': + specifier: workspace:* + version: link:../python-venv + '@kie-tools/root-env': + specifier: workspace:* + version: link:../root-env + '@kie-tools/sonataflow-image-common': + specifier: workspace:* + version: link:../sonataflow-image-common + cross-env: + specifier: ^7.0.3 + version: 7.0.3 + replace-in-file: + specifier: ^7.1.0 + version: 7.1.0 + rimraf: + specifier: ^3.0.2 + version: 3.0.2 + run-script-os: + specifier: ^1.1.6 + version: 1.1.6 + packages/kogito-management-console: devDependencies: '@kie-tools/image-builder': @@ -6207,9 +6362,6 @@ importers: packages/maven-base: devDependencies: - '@kie-tools/maven-config-setup-helper': - specifier: workspace:* - version: link:../maven-config-setup-helper '@kie-tools/root-env': specifier: workspace:* version: link:../root-env @@ -7808,7 +7960,7 @@ importers: version: 2.3.0(react@17.0.2) react-json-view: specifier: ^1.21.3 - version: 1.21.3(@types/react@17.0.21)(encoding@0.1.13)(react-dom@17.0.2(react@17.0.2))(react@17.0.2) + version: 1.21.3(@types/react@17.0.21)(react-dom@17.0.2(react@17.0.2))(react@17.0.2) react-moment: specifier: 0.9.7 version: 0.9.7(moment@2.29.4)(prop-types@15.8.1)(react@17.0.2) @@ -8123,7 +8275,7 @@ importers: version: 2.3.0(react@17.0.2) react-json-view: specifier: ^1.21.3 - version: 1.21.3(@types/react@17.0.21)(encoding@0.1.13)(react-dom@17.0.2(react@17.0.2))(react@17.0.2) + version: 1.21.3(@types/react@17.0.21)(react-dom@17.0.2(react@17.0.2))(react@17.0.2) react-moment: specifier: 0.9.7 version: 0.9.7(moment@2.29.4)(prop-types@15.8.1)(react@17.0.2) @@ -9438,6 +9590,9 @@ importers: '@kie-tools/serverless-logic-web-tools-base-builder-image-env': specifier: workspace:* version: link:../serverless-logic-web-tools-base-builder-image-env + '@kie/kogito-base-builder-image': + specifier: workspace:* + version: link:../kogito-base-builder-image rimraf: specifier: ^3.0.2 version: 3.0.2 @@ -9480,13 +9635,13 @@ importers: packages/serverless-logic-web-tools-swf-deployment-quarkus-app: dependencies: + '@kie-tools/maven-base': + specifier: workspace:* + version: link:../maven-base '@kie-tools/sonataflow-quarkus-devui': specifier: workspace:* version: link:../sonataflow-quarkus-devui devDependencies: - '@kie-tools/maven-config-setup-helper': - specifier: workspace:* - version: link:../maven-config-setup-helper '@kie-tools/root-env': specifier: workspace:* version: link:../root-env @@ -9499,9 +9654,9 @@ importers: '@kie-tools/image-builder': specifier: workspace:* version: link:../image-builder - '@kie-tools/maven-config-setup-helper': + '@kie-tools/maven-base': specifier: workspace:* - version: link:../maven-config-setup-helper + version: link:../maven-base '@kie-tools/maven-m2-repo-via-http-image': specifier: workspace:* version: link:../maven-m2-repo-via-http-image @@ -9517,6 +9672,9 @@ importers: '@kie-tools/serverless-logic-web-tools-swf-dev-mode-image-env': specifier: workspace:* version: link:../serverless-logic-web-tools-swf-dev-mode-image-env + '@kie/kogito-base-builder-image': + specifier: workspace:* + version: link:../kogito-base-builder-image rimraf: specifier: ^3.0.2 version: 3.0.2 @@ -9904,9 +10062,9 @@ importers: packages/serverless-workflow-diagram-editor: devDependencies: - '@kie-tools/maven-config-setup-helper': + '@kie-tools/maven-base': specifier: workspace:* - version: link:../maven-config-setup-helper + version: link:../maven-base '@kie-tools/root-env': specifier: workspace:* version: link:../root-env @@ -10684,6 +10842,15 @@ importers: packages/sonataflow-builder-image: devDependencies: + '@kie-tools/image-builder': + specifier: workspace:* + version: link:../image-builder + '@kie-tools/maven-base': + specifier: workspace:* + version: link:../maven-base + '@kie-tools/maven-m2-repo-via-http-image': + specifier: workspace:* + version: link:../maven-m2-repo-via-http-image '@kie-tools/python-venv': specifier: workspace:* version: link:../python-venv @@ -10928,6 +11095,15 @@ importers: packages/sonataflow-devmode-image: devDependencies: + '@kie-tools/image-builder': + specifier: workspace:* + version: link:../image-builder + '@kie-tools/maven-base': + specifier: workspace:* + version: link:../maven-base + '@kie-tools/maven-m2-repo-via-http-image': + specifier: workspace:* + version: link:../maven-m2-repo-via-http-image '@kie-tools/python-venv': specifier: workspace:* version: link:../python-venv @@ -10961,6 +11137,9 @@ importers: '@kie-tools/root-env': specifier: workspace:* version: link:../root-env + run-script-os: + specifier: ^1.1.6 + version: 1.1.6 packages/sonataflow-management-console-image: devDependencies: @@ -11292,6 +11471,18 @@ importers: '@kie-tools/sonataflow-devmode-image': specifier: workspace:* version: link:../sonataflow-devmode-image + '@kie/kogito-data-index-ephemeral-image': + specifier: workspace:* + version: link:../kogito-data-index-ephemeral-image + '@kie/kogito-data-index-postgresql-image': + specifier: workspace:* + version: link:../kogito-data-index-postgresql-image + '@kie/kogito-jobs-service-ephemeral-image': + specifier: workspace:* + version: link:../kogito-jobs-service-ephemeral-image + '@kie/kogito-jobs-service-postgresql-image': + specifier: workspace:* + version: link:../kogito-jobs-service-postgresql-image replace-in-file: specifier: ^7.1.0 version: 7.1.0 @@ -11308,9 +11499,6 @@ importers: specifier: workspace:* version: link:../maven-base devDependencies: - '@kie-tools/maven-config-setup-helper': - specifier: workspace:* - version: link:../maven-config-setup-helper '@kie-tools/root-env': specifier: workspace:* version: link:../root-env @@ -11398,9 +11586,9 @@ importers: packages/stunner-editors: devDependencies: - '@kie-tools/maven-config-setup-helper': + '@kie-tools/maven-base': specifier: workspace:* - version: link:../maven-config-setup-helper + version: link:../maven-base '@kie-tools/root-env': specifier: workspace:* version: link:../root-env @@ -12542,9 +12730,6 @@ importers: specifier: workspace:* version: link:../maven-base devDependencies: - '@kie-tools/maven-config-setup-helper': - specifier: workspace:* - version: link:../maven-config-setup-helper '@kie-tools/root-env': specifier: workspace:* version: link:../root-env @@ -13086,9 +13271,6 @@ importers: specifier: workspace:* version: link:../maven-base devDependencies: - '@kie-tools/maven-config-setup-helper': - specifier: workspace:* - version: link:../maven-config-setup-helper '@kie-tools/root-env': specifier: workspace:* version: link:../root-env @@ -13141,16 +13323,13 @@ importers: '@kie-tools/maven-base': specifier: workspace:* version: link:../maven-base - devDependencies: - '@kie-tools/maven-config-setup-helper': + '@kie-tools/yard-model': specifier: workspace:* - version: link:../maven-config-setup-helper + version: link:../yard-model + devDependencies: '@kie-tools/root-env': specifier: workspace:* version: link:../root-env - '@kie-tools/yard-model': - specifier: workspace:* - version: link:../yard-model copyfiles: specifier: ^2.4.1 version: 2.4.1 @@ -22698,10 +22877,6 @@ packages: resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} engines: {node: '>=6'} - escalade@3.1.2: - resolution: {integrity: sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==} - engines: {node: '>=6'} - escalade@3.2.0: resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==} engines: {node: '>=6'} @@ -28586,10 +28761,6 @@ packages: resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} engines: {node: '>=8'} - strip-ansi@7.0.1: - resolution: {integrity: sha512-cXNxvT8dFNRVfhVME3JAe98mkXDYN2O1l7jmcwMnOslDeESg1rF/OZMtK0nRAhiari1unG5cD4jG3rapUAkLbw==} - engines: {node: '>=12'} - strip-ansi@7.1.0: resolution: {integrity: sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==} engines: {node: '>=12'} @@ -37862,7 +38033,7 @@ snapshots: dependencies: string-width: 5.1.2 string-width-cjs: string-width@4.2.3 - strip-ansi: 7.0.1 + strip-ansi: 7.1.0 strip-ansi-cjs: strip-ansi@6.0.1 wrap-ansi: 8.1.0 wrap-ansi-cjs: wrap-ansi@7.0.0 @@ -42372,21 +42543,6 @@ snapshots: lz-string: 1.5.0 pretty-format: 27.5.1 - '@testing-library/jest-dom@6.4.6(@jest/globals@29.7.0)(@types/jest@29.5.12)(jest@29.7.0(@types/node@20.14.2)(node-notifier@8.0.2)(ts-node@10.9.2(@types/node@20.14.2)(typescript@5.5.3)))': - dependencies: - '@adobe/css-tools': 4.4.0 - '@babel/runtime': 7.23.6 - aria-query: 5.1.3 - chalk: 3.0.0 - css.escape: 1.5.1 - dom-accessibility-api: 0.6.3 - lodash: 4.17.21 - redent: 3.0.0 - optionalDependencies: - '@jest/globals': 29.7.0 - '@types/jest': 29.5.12 - jest: 29.7.0(@types/node@20.14.2)(node-notifier@8.0.2)(ts-node@10.9.2(@types/node@20.14.2)(typescript@5.5.3)) - '@testing-library/jest-dom@6.4.6(@jest/globals@29.7.0)(@types/jest@29.5.12)(jest@29.7.0(@types/node@22.5.2)(node-notifier@8.0.2)(ts-node@10.9.2(@swc/core@1.3.92)(@types/node@22.5.2)(typescript@5.5.3)))': dependencies: '@adobe/css-tools': 4.4.0 @@ -43511,9 +43667,9 @@ snapshots: webpack: 5.94.0(webpack-cli@4.10.0) webpack-cli: 4.10.0(webpack-bundle-analyzer@4.10.2)(webpack-dev-server@4.15.1)(webpack@5.94.0) - '@webpack-cli/configtest@1.2.0(webpack-cli@4.10.0(webpack-dev-server@4.15.1)(webpack@5.94.0))(webpack@5.94.0(@swc/core@1.3.92)(webpack-cli@4.10.0))': + '@webpack-cli/configtest@1.2.0(webpack-cli@4.10.0(webpack-dev-server@4.15.1)(webpack@5.94.0))(webpack@5.94.0(webpack-cli@4.10.0))': dependencies: - webpack: 5.94.0(@swc/core@1.3.92)(webpack-cli@4.10.0) + webpack: 5.94.0(webpack-cli@4.10.0) webpack-cli: 4.10.0(webpack-dev-server@4.15.1)(webpack@5.94.0) '@webpack-cli/configtest@1.2.0(webpack-cli@4.10.0(webpack@5.94.0))(webpack@5.94.0(webpack-cli@4.10.0))': @@ -47988,8 +48144,6 @@ snapshots: escalade@3.1.1: {} - escalade@3.1.2: {} - escalade@3.2.0: {} escape-html@1.0.3: {} @@ -48496,12 +48650,6 @@ snapshots: transitivePeerDependencies: - encoding - fbemitter@3.0.0(encoding@0.1.13): - dependencies: - fbjs: 3.0.2(encoding@0.1.13) - transitivePeerDependencies: - - encoding - fbjs-css-vars@1.0.2: {} fbjs@3.0.2: @@ -48747,14 +48895,6 @@ snapshots: flow-parser@0.218.0: {} - flux@4.0.3(encoding@0.1.13)(react@17.0.2): - dependencies: - fbemitter: 3.0.0(encoding@0.1.13) - fbjs: 3.0.2(encoding@0.1.13) - react: 17.0.2 - transitivePeerDependencies: - - encoding - flux@4.0.3(react@17.0.2): dependencies: fbemitter: 3.0.0 @@ -54407,18 +54547,6 @@ snapshots: react-is@18.1.0: {} - react-json-view@1.21.3(@types/react@17.0.21)(encoding@0.1.13)(react-dom@17.0.2(react@17.0.2))(react@17.0.2): - dependencies: - flux: 4.0.3(encoding@0.1.13)(react@17.0.2) - react: 17.0.2 - react-base16-styling: 0.6.0 - react-dom: 17.0.2(react@17.0.2) - react-lifecycles-compat: 3.0.4 - react-textarea-autosize: 8.3.3(@types/react@17.0.21)(react@17.0.2) - transitivePeerDependencies: - - '@types/react' - - encoding - react-json-view@1.21.3(@types/react@17.0.21)(react-dom@17.0.2(react@17.0.2))(react@17.0.2): dependencies: flux: 4.0.3(react@17.0.2) @@ -55971,7 +56099,7 @@ snapshots: dependencies: eastasianwidth: 0.2.0 emoji-regex: 9.2.2 - strip-ansi: 7.0.1 + strip-ansi: 7.1.0 string-width@7.2.0: dependencies: @@ -56049,10 +56177,6 @@ snapshots: dependencies: ansi-regex: 5.0.1 - strip-ansi@7.0.1: - dependencies: - ansi-regex: 6.0.1 - strip-ansi@7.1.0: dependencies: ansi-regex: 6.0.1 @@ -57395,7 +57519,7 @@ snapshots: update-browserslist-db@1.0.13(browserslist@4.23.0): dependencies: browserslist: 4.23.0 - escalade: 3.1.1 + escalade: 3.2.0 picocolors: 1.0.1 update-browserslist-db@1.1.0(browserslist@4.23.2): @@ -57964,7 +58088,7 @@ snapshots: webpack-cli@4.10.0(webpack-dev-server@4.15.1)(webpack@5.94.0): dependencies: '@discoveryjs/json-ext': 0.5.7 - '@webpack-cli/configtest': 1.2.0(webpack-cli@4.10.0(webpack-dev-server@4.15.1)(webpack@5.94.0))(webpack@5.94.0(@swc/core@1.3.92)(webpack-cli@4.10.0)) + '@webpack-cli/configtest': 1.2.0(webpack-cli@4.10.0(webpack-dev-server@4.15.1)(webpack@5.94.0))(webpack@5.94.0(webpack-cli@4.10.0)) '@webpack-cli/info': 1.5.0(webpack-cli@4.10.0(webpack-dev-server@4.15.1)(webpack@5.94.0)) '@webpack-cli/serve': 1.7.0(webpack-cli@4.10.0(webpack-dev-server@4.15.1)(webpack@5.94.0))(webpack-dev-server@4.15.1(webpack-cli@4.10.0)(webpack@5.94.0)) colorette: 2.0.16 @@ -57974,7 +58098,7 @@ snapshots: import-local: 3.0.2 interpret: 2.2.0 rechoir: 0.7.0 - webpack: 5.94.0(@swc/core@1.3.92)(webpack-cli@4.10.0) + webpack: 5.94.0(webpack-cli@4.10.0) webpack-merge: 5.9.0 optionalDependencies: webpack-dev-server: 4.15.1(webpack-cli@4.10.0)(webpack@5.94.0) @@ -57995,14 +58119,14 @@ snapshots: webpack: 5.94.0(webpack-cli@4.10.0) webpack-merge: 5.9.0 - webpack-dev-middleware@5.3.3(webpack@5.94.0(@swc/core@1.3.92)(webpack-cli@4.10.0)): + webpack-dev-middleware@5.3.3(webpack@5.94.0(webpack-cli@4.10.0)): dependencies: colorette: 2.0.20 memfs: 3.5.1 mime-types: 2.1.34 range-parser: 1.2.1 schema-utils: 4.2.0 - webpack: 5.94.0(@swc/core@1.3.92)(webpack-cli@4.10.0) + webpack: 5.94.0(webpack-cli@4.10.0) webpack-dev-middleware@5.3.3(webpack@5.94.0): dependencies: @@ -58094,10 +58218,10 @@ snapshots: serve-index: 1.9.1 sockjs: 0.3.24 spdy: 4.0.2 - webpack-dev-middleware: 5.3.3(webpack@5.94.0(@swc/core@1.3.92)(webpack-cli@4.10.0)) + webpack-dev-middleware: 5.3.3(webpack@5.94.0(webpack-cli@4.10.0)) ws: 8.18.0 optionalDependencies: - webpack: 5.94.0(@swc/core@1.3.92)(webpack-cli@4.10.0) + webpack: 5.94.0(webpack-cli@4.10.0) webpack-cli: 4.10.0(webpack-dev-server@4.15.1)(webpack@5.94.0) transitivePeerDependencies: - bufferutil @@ -58615,7 +58739,7 @@ snapshots: dependencies: ansi-styles: 6.2.1 string-width: 5.1.2 - strip-ansi: 7.0.1 + strip-ansi: 7.1.0 wrap-ansi@9.0.0: dependencies: @@ -58795,7 +58919,7 @@ snapshots: yargs@17.7.2: dependencies: cliui: 8.0.1 - escalade: 3.1.2 + escalade: 3.2.0 get-caller-file: 2.0.5 require-directory: 2.1.1 string-width: 4.2.3 diff --git a/repo/graph.dot b/repo/graph.dot index bfb388a4272..a232c0414e7 100644 --- a/repo/graph.dot +++ b/repo/graph.dot @@ -96,7 +96,6 @@ digraph G { "@kie-tools/dev-deployment-dmn-form-webapp-image" [ color = "black", fontcolor = "black", style = "dashed, rounded" ]; "@kie-tools/image-env-to-json" [ color = "black", fontcolor = "black", style = "dashed, rounded" ]; "@kie-tools/dev-deployment-kogito-quarkus-blank-app" [ color = "black", fontcolor = "black", style = "dashed, rounded" ]; - "@kie-tools/maven-config-setup-helper" [ color = "black", fontcolor = "black", style = "dashed, rounded" ]; "@kie-tools/dev-deployment-kogito-quarkus-blank-app-image" [ color = "black", fontcolor = "black", style = "dashed, rounded" ]; "@kie-tools/maven-m2-repo-via-http-image" [ color = "black", fontcolor = "black", style = "dashed, rounded" ]; "@kie-tools/dmn-editor" [ color = "blue", fontcolor = "blue", style = "rounded" ]; @@ -140,6 +139,14 @@ digraph G { "@kie-tools/online-editor" [ color = "black", fontcolor = "black", style = "dashed, rounded" ]; "@kie-tools/kn-plugin-workflow" [ color = "black", fontcolor = "black", style = "dashed, rounded" ]; "@kie-tools/sonataflow-operator" [ color = "black", fontcolor = "black", style = "dashed, rounded" ]; + "@kie/kogito-base-builder-image" [ color = "black", fontcolor = "black", style = "dashed, rounded" ]; + "@kie-tools/sonataflow-image-common" [ color = "black", fontcolor = "black", style = "dashed, rounded" ]; + "@kie/kogito-data-index-ephemeral-image" [ color = "black", fontcolor = "black", style = "dashed, rounded" ]; + "@kie/kogito-data-index-postgresql-image" [ color = "black", fontcolor = "black", style = "dashed, rounded" ]; + "@kie/kogito-jit-runner-image" [ color = "black", fontcolor = "black", style = "dashed, rounded" ]; + "@kie/kogito-jobs-service-allinone-image" [ color = "black", fontcolor = "black", style = "dashed, rounded" ]; + "@kie/kogito-jobs-service-ephemeral-image" [ color = "black", fontcolor = "black", style = "dashed, rounded" ]; + "@kie/kogito-jobs-service-postgresql-image" [ color = "black", fontcolor = "black", style = "dashed, rounded" ]; "@kie-tools/runtime-tools-management-console-webapp" [ color = "blue", fontcolor = "blue", style = "rounded" ]; "@kie-tools/runtime-tools-task-console-webapp" [ color = "blue", fontcolor = "blue", style = "rounded" ]; "@kie-tools-core/kubernetes-bridge" [ color = "purple", fontcolor = "purple", style = "rounded" ]; @@ -183,7 +190,6 @@ digraph G { "@kie-tools/serverless-workflow-service-catalog" [ color = "blue", fontcolor = "blue", style = "rounded" ]; "@kie-tools/serverless-workflow-language-service" [ color = "blue", fontcolor = "blue", style = "rounded" ]; "swf-vscode-extension" [ color = "blue", fontcolor = "blue", style = "rounded" ]; - "@kie-tools/sonataflow-image-common" [ color = "black", fontcolor = "black", style = "dashed, rounded" ]; "@kie-tools/sonataflow-devmode-image" [ color = "black", fontcolor = "black", style = "dashed, rounded" ]; "@kie-tools/sonataflow-management-console-image" [ color = "black", fontcolor = "black", style = "dashed, rounded" ]; "@kie-tools/sonataflow-management-console-image-env" [ color = "black", fontcolor = "black", style = "dashed, rounded" ]; @@ -328,8 +334,7 @@ digraph G { "@kie-tools/dev-deployment-dmn-form-webapp-image" -> "@kie-tools/dev-deployment-dmn-form-webapp" [ style = "solid", color = "black" ]; "@kie-tools/dev-deployment-dmn-form-webapp-image" -> "@kie-tools/image-env-to-json" [ style = "solid", color = "black" ]; "@kie-tools/dev-deployment-dmn-form-webapp-image" -> "@kie-tools/image-builder" [ style = "dashed", color = "black" ]; - "@kie-tools/dev-deployment-kogito-quarkus-blank-app" -> "@kie-tools/maven-config-setup-helper" [ style = "dashed", color = "black" ]; - "@kie-tools/dev-deployment-kogito-quarkus-blank-app" -> "@kie-tools/root-env" [ style = "dashed", color = "black" ]; + "@kie-tools/dev-deployment-kogito-quarkus-blank-app" -> "@kie-tools/jbpm-quarkus-devui" [ style = "solid", color = "black" ]; "@kie-tools/dev-deployment-kogito-quarkus-blank-app-image" -> "@kie-tools/dev-deployment-base-image" [ style = "solid", color = "black" ]; "@kie-tools/dev-deployment-kogito-quarkus-blank-app-image" -> "@kie-tools/dev-deployment-kogito-quarkus-blank-app" [ style = "solid", color = "black" ]; "@kie-tools/dev-deployment-kogito-quarkus-blank-app-image" -> "@kie-tools/maven-m2-repo-via-http-image" [ style = "dashed", color = "black" ]; @@ -431,6 +436,13 @@ digraph G { "@kie-tools/kie-sandbox-webapp-image" -> "@kie-tools/online-editor" [ style = "solid", color = "black" ]; "@kie-tools/kie-sandbox-webapp-image" -> "@kie-tools/image-builder" [ style = "dashed", color = "black" ]; "@kie-tools/kn-plugin-workflow" -> "@kie-tools/sonataflow-operator" [ style = "dashed", color = "black" ]; + "@kie/kogito-base-builder-image" -> "@kie-tools/sonataflow-image-common" [ style = "dashed", color = "black" ]; + "@kie/kogito-data-index-ephemeral-image" -> "@kie-tools/sonataflow-image-common" [ style = "dashed", color = "black" ]; + "@kie/kogito-data-index-postgresql-image" -> "@kie-tools/sonataflow-image-common" [ style = "dashed", color = "black" ]; + "@kie/kogito-jit-runner-image" -> "@kie-tools/sonataflow-image-common" [ style = "dashed", color = "black" ]; + "@kie/kogito-jobs-service-allinone-image" -> "@kie-tools/sonataflow-image-common" [ style = "dashed", color = "black" ]; + "@kie/kogito-jobs-service-ephemeral-image" -> "@kie-tools/sonataflow-image-common" [ style = "dashed", color = "black" ]; + "@kie/kogito-jobs-service-postgresql-image" -> "@kie-tools/sonataflow-image-common" [ style = "dashed", color = "black" ]; "@kie-tools/kogito-management-console" -> "@kie-tools/image-builder" [ style = "dashed", color = "black" ]; "@kie-tools/kogito-management-console" -> "@kie-tools/image-env-to-json" [ style = "dashed", color = "black" ]; "@kie-tools/kogito-management-console" -> "@kie-tools/runtime-tools-management-console-webapp" [ style = "dashed", color = "black" ]; @@ -438,7 +450,6 @@ digraph G { "@kie-tools/kogito-task-console" -> "@kie-tools/image-env-to-json" [ style = "dashed", color = "black" ]; "@kie-tools/kogito-task-console" -> "@kie-tools/runtime-tools-task-console-webapp" [ style = "dashed", color = "black" ]; "@kie-tools-core/kubernetes-bridge" -> "@kie-tools/cors-proxy-api" [ style = "solid", color = "purple" ]; - "@kie-tools/maven-base" -> "@kie-tools/maven-config-setup-helper" [ style = "dashed", color = "black" ]; "@kie-tools/maven-base" -> "@kie-tools/root-env" [ style = "dashed", color = "black" ]; "@kie-tools/maven-m2-repo-via-http-image" -> "@kie-tools/image-builder" [ style = "dashed", color = "black" ]; "@kie-tools/maven-m2-repo-via-http-image" -> "@kie-tools/root-env" [ style = "dashed", color = "black" ]; @@ -524,6 +535,7 @@ digraph G { "@kie-tools/serverless-logic-web-tools" -> "@kie-tools/serverless-logic-web-tools-swf-dev-mode-image-env" [ style = "dashed", color = "black" ]; "@kie-tools/serverless-logic-web-tools" -> "@kie-tools/sonataflow-dev-app" [ style = "dashed", color = "black" ]; "@kie-tools/serverless-logic-web-tools-base-builder-image" -> "@kie-tools/serverless-logic-web-tools-base-builder-image-env" [ style = "dashed", color = "black" ]; + "@kie-tools/serverless-logic-web-tools-base-builder-image" -> "@kie/kogito-base-builder-image" [ style = "dashed", color = "black" ]; "@kie-tools/serverless-logic-web-tools-base-builder-image-env" -> "@kie-tools/root-env" [ style = "dashed", color = "black" ]; "@kie-tools/serverless-logic-web-tools-swf-builder-image" -> "@kie-tools/serverless-logic-web-tools-swf-builder-image-env" [ style = "dashed", color = "black" ]; "@kie-tools/serverless-logic-web-tools-swf-builder-image" -> "@kie-tools/sonataflow-builder-image" [ style = "dashed", color = "black" ]; @@ -531,9 +543,9 @@ digraph G { "@kie-tools/serverless-logic-web-tools-swf-builder-image-env" -> "@kie-tools/root-env" [ style = "dashed", color = "black" ]; "@kie-tools/serverless-logic-web-tools-swf-deployment-quarkus-app" -> "@kie-tools/sonataflow-quarkus-devui" [ style = "solid", color = "black" ]; "@kie-tools/serverless-logic-web-tools-swf-dev-mode-image" -> "@kie-tools/maven-m2-repo-via-http-image" [ style = "dashed", color = "black" ]; - "@kie-tools/serverless-logic-web-tools-swf-dev-mode-image" -> "@kie-tools/python-venv" [ style = "dashed", color = "black" ]; "@kie-tools/serverless-logic-web-tools-swf-dev-mode-image" -> "@kie-tools/serverless-logic-web-tools-swf-deployment-quarkus-app" [ style = "dashed", color = "black" ]; "@kie-tools/serverless-logic-web-tools-swf-dev-mode-image" -> "@kie-tools/serverless-logic-web-tools-swf-dev-mode-image-env" [ style = "dashed", color = "black" ]; + "@kie-tools/serverless-logic-web-tools-swf-dev-mode-image" -> "@kie/kogito-base-builder-image" [ style = "dashed", color = "black" ]; "@kie-tools/serverless-logic-web-tools-swf-dev-mode-image" -> "sonataflow-deployment-webapp" [ style = "dashed", color = "black" ]; "@kie-tools/serverless-logic-web-tools-swf-dev-mode-image-env" -> "@kie-tools/root-env" [ style = "dashed", color = "black" ]; "@kie-tools/serverless-workflow-combined-editor" -> "@kie-tools/serverless-workflow-diagram-editor-assets" [ style = "solid", color = "blue" ]; @@ -543,8 +555,7 @@ digraph G { "@kie-tools/serverless-workflow-dev-ui-webapp" -> "@kie-tools/runtime-tools-swf-webapp-components" [ style = "solid", color = "black" ]; "@kie-tools/serverless-workflow-dev-ui-webapp" -> "@kie-tools/serverless-workflow-dev-ui-monitoring-webapp" [ style = "solid", color = "black" ]; "@kie-tools/serverless-workflow-dev-ui-webapp" -> "@kie-tools/sonataflow-dev-app" [ style = "dashed", color = "black" ]; - "@kie-tools/serverless-workflow-diagram-editor" -> "@kie-tools/maven-config-setup-helper" [ style = "dashed", color = "black" ]; - "@kie-tools/serverless-workflow-diagram-editor" -> "@kie-tools/root-env" [ style = "dashed", color = "black" ]; + "@kie-tools/serverless-workflow-diagram-editor" -> "@kie-tools/maven-base" [ style = "dashed", color = "black" ]; "@kie-tools/serverless-workflow-diagram-editor-assets" -> "@kie-tools/serverless-workflow-diagram-editor" [ style = "dashed", color = "blue" ]; "@kie-tools/serverless-workflow-diagram-editor-assets" -> "@kie-tools/serverless-workflow-diagram-editor-envelope" [ style = "dashed", color = "blue" ]; "@kie-tools/serverless-workflow-diagram-editor-envelope" -> "@kie-tools/kie-bc-editors" [ style = "solid", color = "blue" ]; @@ -561,6 +572,8 @@ digraph G { "swf-vscode-extension" -> "@kie-tools-core/webpack-base" [ style = "dashed", color = "blue" ]; "swf-vscode-extension" -> "@kie-tools/serverless-workflow-diagram-editor-assets" [ style = "dashed", color = "blue" ]; "swf-vscode-extension" -> "@kie-tools/vscode-extension-common-test-helpers" [ style = "dashed", color = "blue" ]; + "@kie-tools/sonataflow-builder-image" -> "@kie-tools/maven-base" [ style = "dashed", color = "black" ]; + "@kie-tools/sonataflow-builder-image" -> "@kie-tools/maven-m2-repo-via-http-image" [ style = "dashed", color = "black" ]; "@kie-tools/sonataflow-builder-image" -> "@kie-tools/sonataflow-image-common" [ style = "dashed", color = "black" ]; "sonataflow-deployment-webapp" -> "@kie-tools-core/react-hooks" [ style = "solid", color = "blue" ]; "sonataflow-deployment-webapp" -> "@kie-tools/runtime-tools-shared-webapp-components" [ style = "solid", color = "blue" ]; @@ -568,6 +581,7 @@ digraph G { "sonataflow-deployment-webapp" -> "@kie-tools/sonataflow-dev-app" [ style = "dashed", color = "blue" ]; "@kie-tools/sonataflow-dev-app" -> "@kie-tools/eslint" [ style = "dashed", color = "black" ]; "@kie-tools/sonataflow-dev-app" -> "@kie-tools/root-env" [ style = "dashed", color = "black" ]; + "@kie-tools/sonataflow-devmode-image" -> "@kie-tools/maven-m2-repo-via-http-image" [ style = "dashed", color = "black" ]; "@kie-tools/sonataflow-devmode-image" -> "@kie-tools/sonataflow-image-common" [ style = "dashed", color = "black" ]; "@kie-tools/sonataflow-devmode-image" -> "@kie-tools/sonataflow-quarkus-devui" [ style = "dashed", color = "black" ]; "@kie-tools/sonataflow-image-common" -> "@kie-tools/python-venv" [ style = "dashed", color = "black" ]; @@ -584,6 +598,10 @@ digraph G { "@kie-tools/sonataflow-management-console-webapp" -> "@kie-tools/sonataflow-dev-app" [ style = "dashed", color = "blue" ]; "@kie-tools/sonataflow-operator" -> "@kie-tools/sonataflow-builder-image" [ style = "dashed", color = "black" ]; "@kie-tools/sonataflow-operator" -> "@kie-tools/sonataflow-devmode-image" [ style = "dashed", color = "black" ]; + "@kie-tools/sonataflow-operator" -> "@kie/kogito-data-index-ephemeral-image" [ style = "dashed", color = "black" ]; + "@kie-tools/sonataflow-operator" -> "@kie/kogito-data-index-postgresql-image" [ style = "dashed", color = "black" ]; + "@kie-tools/sonataflow-operator" -> "@kie/kogito-jobs-service-ephemeral-image" [ style = "dashed", color = "black" ]; + "@kie-tools/sonataflow-operator" -> "@kie/kogito-jobs-service-postgresql-image" [ style = "dashed", color = "black" ]; "@kie-tools/sonataflow-quarkus-devui" -> "@kie-tools/serverless-workflow-dev-ui-webapp" [ style = "dashed", color = "black" ]; "@kie-tools/storybook-base" -> "@kie-tools-core/webpack-base" [ style = "dashed", color = "blue" ]; "@kie-tools/storybook-base" -> "@kie-tools/eslint" [ style = "dashed", color = "blue" ]; @@ -649,7 +667,7 @@ digraph G { "@kie-tools/yard-model" -> "@kie-tools/maven-base" [ style = "solid", color = "black" ]; "@kie-tools/yard-validator" -> "@kie-tools-core/notifications" [ style = "solid", color = "blue" ]; "@kie-tools/yard-validator" -> "@kie-tools/yard-validator-worker" [ style = "dashed", color = "blue" ]; - "@kie-tools/yard-validator-worker" -> "@kie-tools/yard-model" [ style = "dashed", color = "black" ]; + "@kie-tools/yard-validator-worker" -> "@kie-tools/yard-model" [ style = "solid", color = "black" ]; "yard-vscode-extension" -> "@kie-tools-core/vscode-extension" [ style = "solid", color = "blue" ]; "yard-vscode-extension" -> "@kie-tools/yard-editor" [ style = "solid", color = "blue" ]; "yard-vscode-extension" -> "@kie-tools/vscode-extension-common-test-helpers" [ style = "dashed", color = "blue" ]; diff --git a/repo/graph.json b/repo/graph.json index 3e5b4cfb333..846ac6db0cd 100644 --- a/repo/graph.json +++ b/repo/graph.json @@ -86,7 +86,6 @@ { "id": "@kie-tools/cors-proxy-image" }, { "id": "@kie-tools/dashbuilder" }, { "id": "@kie-tools/dashbuilder-component-assembler" }, - { "id": "@kie-tools/maven-config-setup-helper" }, { "id": "@kie-tools/dashbuilder-component-echarts" }, { "id": "@kie-tools/dashbuilder-component-map" }, { "id": "@kie-tools/dashbuilder-component-svg-heatmap" }, @@ -154,9 +153,17 @@ { "id": "@kie-tools/sonataflow-operator" }, { "id": "@kie-tools/sonataflow-builder-image" }, { "id": "@kie-tools/sonataflow-devmode-image" }, + { "id": "@kie/kogito-data-index-ephemeral-image" }, + { "id": "@kie/kogito-data-index-postgresql-image" }, + { "id": "@kie/kogito-jobs-service-ephemeral-image" }, + { "id": "@kie/kogito-jobs-service-postgresql-image" }, + { "id": "@kie/kogito-base-builder-image" }, + { "id": "@kie-tools/sonataflow-image-common" }, + { "id": "@kie-tools/python-venv" }, + { "id": "@kie/kogito-jit-runner-image" }, + { "id": "@kie/kogito-jobs-service-allinone-image" }, { "id": "@kie-tools/unitables" }, { "id": "pmml-vscode-extension" }, - { "id": "@kie-tools/python-venv" }, { "id": "@kie-tools/runtime-tools-components" }, { "id": "@kie-tools/runtime-tools-shared-gateway-api" }, { "id": "@kie-tools/runtime-tools-consoles-helm-chart" }, @@ -180,7 +187,6 @@ { "id": "@kie-tools/serverless-logic-web-tools-base-builder-image" }, { "id": "@kie-tools/serverless-logic-web-tools-swf-builder-image" }, { "id": "sonataflow-deployment-webapp" }, - { "id": "@kie-tools/sonataflow-image-common" }, { "id": "@kie-tools/serverless-logic-web-tools-swf-deployment-quarkus-app" }, @@ -408,11 +414,6 @@ "target": "@kie-tools/runtime-tools-process-dev-ui-webapp", "weight": 1 }, - { - "source": "@kie-tools/maven-base", - "target": "@kie-tools/maven-config-setup-helper", - "weight": 1 - }, { "source": "@kie-tools/maven-base", "target": "@kie-tools/root-env", @@ -1450,12 +1451,7 @@ }, { "source": "@kie-tools/dev-deployment-kogito-quarkus-blank-app", - "target": "@kie-tools/maven-config-setup-helper", - "weight": 1 - }, - { - "source": "@kie-tools/dev-deployment-kogito-quarkus-blank-app", - "target": "@kie-tools/root-env", + "target": "@kie-tools/jbpm-quarkus-devui", "weight": 1 }, { @@ -1913,11 +1909,46 @@ "target": "@kie-tools/sonataflow-devmode-image", "weight": 1 }, + { + "source": "@kie-tools/sonataflow-operator", + "target": "@kie/kogito-data-index-ephemeral-image", + "weight": 1 + }, + { + "source": "@kie-tools/sonataflow-operator", + "target": "@kie/kogito-data-index-postgresql-image", + "weight": 1 + }, + { + "source": "@kie-tools/sonataflow-operator", + "target": "@kie/kogito-jobs-service-ephemeral-image", + "weight": 1 + }, + { + "source": "@kie-tools/sonataflow-operator", + "target": "@kie/kogito-jobs-service-postgresql-image", + "weight": 1 + }, + { + "source": "@kie-tools/sonataflow-builder-image", + "target": "@kie-tools/maven-base", + "weight": 1 + }, + { + "source": "@kie-tools/sonataflow-builder-image", + "target": "@kie-tools/maven-m2-repo-via-http-image", + "weight": 1 + }, { "source": "@kie-tools/sonataflow-builder-image", "target": "@kie-tools/sonataflow-image-common", "weight": 1 }, + { + "source": "@kie-tools/sonataflow-devmode-image", + "target": "@kie-tools/maven-m2-repo-via-http-image", + "weight": 1 + }, { "source": "@kie-tools/sonataflow-devmode-image", "target": "@kie-tools/sonataflow-image-common", @@ -1928,6 +1959,51 @@ "target": "@kie-tools/sonataflow-quarkus-devui", "weight": 1 }, + { + "source": "@kie/kogito-data-index-ephemeral-image", + "target": "@kie-tools/sonataflow-image-common", + "weight": 1 + }, + { + "source": "@kie/kogito-data-index-postgresql-image", + "target": "@kie-tools/sonataflow-image-common", + "weight": 1 + }, + { + "source": "@kie/kogito-jobs-service-ephemeral-image", + "target": "@kie-tools/sonataflow-image-common", + "weight": 1 + }, + { + "source": "@kie/kogito-jobs-service-postgresql-image", + "target": "@kie-tools/sonataflow-image-common", + "weight": 1 + }, + { + "source": "@kie/kogito-base-builder-image", + "target": "@kie-tools/sonataflow-image-common", + "weight": 1 + }, + { + "source": "@kie-tools/sonataflow-image-common", + "target": "@kie-tools/python-venv", + "weight": 1 + }, + { + "source": "@kie-tools/sonataflow-image-common", + "target": "@kie-tools/root-env", + "weight": 1 + }, + { + "source": "@kie/kogito-jit-runner-image", + "target": "@kie-tools/sonataflow-image-common", + "weight": 1 + }, + { + "source": "@kie/kogito-jobs-service-allinone-image", + "target": "@kie-tools/sonataflow-image-common", + "weight": 1 + }, { "source": "@kie-tools/unitables", "target": "@kie-tools/boxed-expression-component", @@ -2218,6 +2294,11 @@ "target": "@kie-tools/serverless-logic-web-tools-base-builder-image-env", "weight": 1 }, + { + "source": "@kie-tools/serverless-logic-web-tools-base-builder-image", + "target": "@kie/kogito-base-builder-image", + "weight": 1 + }, { "source": "@kie-tools/serverless-logic-web-tools-swf-builder-image", "target": "@kie-tools/serverless-logic-web-tools-swf-builder-image-env", @@ -2253,16 +2334,6 @@ "target": "@kie-tools/sonataflow-dev-app", "weight": 1 }, - { - "source": "@kie-tools/sonataflow-image-common", - "target": "@kie-tools/python-venv", - "weight": 1 - }, - { - "source": "@kie-tools/sonataflow-image-common", - "target": "@kie-tools/root-env", - "weight": 1 - }, { "source": "@kie-tools/serverless-logic-web-tools-swf-deployment-quarkus-app", "target": "@kie-tools/sonataflow-quarkus-devui", @@ -2273,11 +2344,6 @@ "target": "@kie-tools/maven-m2-repo-via-http-image", "weight": 1 }, - { - "source": "@kie-tools/serverless-logic-web-tools-swf-dev-mode-image", - "target": "@kie-tools/python-venv", - "weight": 1 - }, { "source": "@kie-tools/serverless-logic-web-tools-swf-dev-mode-image", "target": "@kie-tools/serverless-logic-web-tools-swf-deployment-quarkus-app", @@ -2290,17 +2356,17 @@ }, { "source": "@kie-tools/serverless-logic-web-tools-swf-dev-mode-image", - "target": "sonataflow-deployment-webapp", + "target": "@kie/kogito-base-builder-image", "weight": 1 }, { - "source": "@kie-tools/serverless-workflow-diagram-editor", - "target": "@kie-tools/maven-config-setup-helper", + "source": "@kie-tools/serverless-logic-web-tools-swf-dev-mode-image", + "target": "sonataflow-deployment-webapp", "weight": 1 }, { "source": "@kie-tools/serverless-workflow-diagram-editor", - "target": "@kie-tools/root-env", + "target": "@kie-tools/maven-base", "weight": 1 }, { @@ -2588,11 +2654,17 @@ ["@kie-tools/kie-sandbox-helm-chart", "packages/kie-sandbox-helm-chart"], ["@kie-tools/kie-sandbox-webapp-image", "packages/kie-sandbox-webapp-image"], ["@kie-tools/kn-plugin-workflow", "packages/kn-plugin-workflow"], + ["@kie/kogito-base-builder-image", "packages/kogito-base-builder-image"], + ["@kie/kogito-data-index-ephemeral-image", "packages/kogito-data-index-ephemeral-image"], + ["@kie/kogito-data-index-postgresql-image", "packages/kogito-data-index-postgresql-image"], + ["@kie/kogito-jit-runner-image", "packages/kogito-jit-runner-image"], + ["@kie/kogito-jobs-service-allinone-image", "packages/kogito-jobs-service-allinone-image"], + ["@kie/kogito-jobs-service-ephemeral-image", "packages/kogito-jobs-service-ephemeral-image"], + ["@kie/kogito-jobs-service-postgresql-image", "packages/kogito-jobs-service-postgresql-image"], ["@kie-tools/kogito-management-console", "packages/kogito-management-console"], ["@kie-tools/kogito-task-console", "packages/kogito-task-console"], ["@kie-tools-core/kubernetes-bridge", "packages/kubernetes-bridge"], ["@kie-tools/maven-base", "packages/maven-base"], - ["@kie-tools/maven-config-setup-helper", "packages/maven-config-setup-helper"], ["@kie-tools/maven-m2-repo-via-http-image", "packages/maven-m2-repo-via-http-image"], ["@kie-tools-core/monaco-editor", "packages/monaco-editor"], ["@kie-tools-core/notifications", "packages/notifications"], diff --git a/scripts/bootstrap/check_required_preinstalled_cli_commands.mjs b/scripts/bootstrap/check_required_preinstalled_cli_commands.mjs index 02f725435a8..6930f85d62f 100755 --- a/scripts/bootstrap/check_required_preinstalled_cli_commands.mjs +++ b/scripts/bootstrap/check_required_preinstalled_cli_commands.mjs @@ -34,6 +34,7 @@ const argsByCommand = new Map([ ["python3", ["--version"]], ["pip3", ["--version"]], ["s2i", ["version"]], + ["xmllint", ["-version"]], ]); async function main() { diff --git a/scripts/check-junit-report-results/tests/index.test.js b/scripts/check-junit-report-results/tests/index.test.js index 5838520b957..8052a80fd46 100644 --- a/scripts/check-junit-report-results/tests/index.test.js +++ b/scripts/check-junit-report-results/tests/index.test.js @@ -2,6 +2,16 @@ const parseFile = require("../src/parseFile"); const path = require("path"); describe("Parsing", () => { + test("empty", () => { + const failed = []; + const passed = []; + + parseFile(path.join(__dirname, "./reports/empty.xml"), failed, passed); + + expect(failed.length).toStrictEqual(0); + expect(passed.length).toStrictEqual(0); + }); + test("cypress", () => { const failed = []; const passed = []; diff --git a/scripts/check-junit-report-results/tests/reports/empty.xml b/scripts/check-junit-report-results/tests/reports/empty.xml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/scripts/update-kogito-version/update_kogito_version.js b/scripts/update-kogito-version/update_kogito_version.js index eff803cf607..df2396eb796 100755 --- a/scripts/update-kogito-version/update_kogito_version.js +++ b/scripts/update-kogito-version/update_kogito_version.js @@ -22,16 +22,15 @@ const path = require("path"); const execSync = require("child_process").execSync; const newMavenVersion = process.argv[3]; -const newImagesTag = process.argv[5]; if (!newMavenVersion) { - console.error("Usage 'node update_kogito_version.js --maven [version] --images-tag [tag]'"); + console.error("Usage 'node update_kogito_version.js --maven [version]"); return 1; } -if (process.argv[2] !== "--maven" || process.argv[4] !== "--images-tag") { +if (process.argv[2] !== "--maven") { console.error("Arguments need to be passed in the correct order."); console.error(`Argv: ${process.argv.join(", ")}`); - console.error("Usage 'node update_kogito_version.js --maven [version] --images-tag [tag]'"); + console.error("Usage 'node update_kogito_version.js --maven [version]"); process.exit(1); } @@ -50,56 +49,13 @@ try { ) ); - console.info("[update-kogito-version] Updating 'serverless-logic-web-tools-base-builder-image/env/index.js'..."); - const serverlessLogicWebToolsBaseBuilderImageEnvPath = path.resolve( - __dirname, - "../../packages/serverless-logic-web-tools-base-builder-image/env/index.js" - ); - fs.writeFileSync( - serverlessLogicWebToolsBaseBuilderImageEnvPath, - fs - .readFileSync(serverlessLogicWebToolsBaseBuilderImageEnvPath, "utf-8") - .replace( - /SERVERLESS_LOGIC_WEB_TOOLS__baseBuilderKogitoImageTag:[\s\n]*{[\s\n]*default:[\s\n]*".*"/, - `SERVERLESS_LOGIC_WEB_TOOLS__baseBuilderKogitoImageTag: {\n default: "${newImagesTag}"` - ) - ); - - console.info( - "[update-kogito-version] Updating 'packages/serverless-logic-web-tools-swf-dev-mode-image/env/index.js'..." - ); - const serverlessLogicWebToolsSwfDevModeImageEnvPath = path.resolve( - __dirname, - "../../packages/serverless-logic-web-tools-swf-dev-mode-image/env/index.js" - ); - fs.writeFileSync( - serverlessLogicWebToolsSwfDevModeImageEnvPath, - fs - .readFileSync(serverlessLogicWebToolsSwfDevModeImageEnvPath, "utf-8") - .replace( - /SERVERLESS_LOGIC_WEB_TOOLS_DEVMODE_IMAGE__kogitoBaseBuilderImageTag:[\s\n]*{[\s\n]*default:[\s\n]*".*"/, - `SERVERLESS_LOGIC_WEB_TOOLS_DEVMODE_IMAGE__kogitoBaseBuilderImageTag: {\n default: "${newImagesTag}"` - ) - ); - - console.info("[update-kogito-version] Updating 'packages/sonataflow-operator/version/version.go'..."); - const sonataflowOperatorVersionsGo = path.resolve(__dirname, "../../packages/sonataflow-operator/version/version.go"); - fs.writeFileSync( - sonataflowOperatorVersionsGo, - fs - .readFileSync(sonataflowOperatorVersionsGo, "utf-8") - .replace(/kogitoImagesTagVersion = ".*"/, `kogitoImagesTagVersion = "${newImagesTag}"`) - ); - console.info(`[update-kogito-version] Bootstrapping with updated Kogito version...`); execSync(`pnpm bootstrap`, execOpts); console.info(`[update-kogito-version] Formatting files...`); execSync(`pnpm pretty-quick`, execOpts); - console.info( - `[update-kogito-version] Updated Kogito to '${newMavenVersion}' (Maven) and '${newImagesTag}' (Images tag).` - ); + console.info(`[update-kogito-version] Updated Kogito to '${newMavenVersion}' (Maven)`); console.info(`[update-kogito-version] Done.`); } catch (error) { console.error(error);