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/.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/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..7087fb761c4 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 @@ -52,7 +52,7 @@ module.exports = composeEnv([rootEnv], { 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}`, + default: `${mavenM2RepoViaHttpImageEnv.registry}/${mavenM2RepoViaHttpImageEnv.account}/${mavenM2RepoViaHttpImageEnv.name}:${mavenM2RepoViaHttpImageEnv.buildTag}`, description: "The image tag for the Maven M2 Repo via HTTP. Used during the build only.", }, }), 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/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..fa67779a3bb --- /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 buildEnv = 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 ${buildEnv.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 = `${buildEnv.env.kogitoBaseBuilderImage.registry}/${buildEnv.env.kogitoBaseBuilderImage.account}/${buildEnv.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, `${buildEnv.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..c650f3bac2a --- /dev/null +++ b/packages/kogito-data-index-ephemeral-image/install.js @@ -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. + */ + +const { execSync } = require("child_process"); +const fs = require("fs"); + +const buildEnv = 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 ${buildEnv.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 = `${buildEnv.env.kogitoDataIndexEphemeralImage.registry}/${buildEnv.env.kogitoDataIndexEphemeralImage.account}/${buildEnv.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, `${buildEnv.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..319a9b8ebd4 --- /dev/null +++ b/packages/kogito-data-index-postgresql-image/install.js @@ -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. + */ + +const { execSync } = require("child_process"); +const fs = require("fs"); + +const buildEnv = 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 ${buildEnv.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 = `${buildEnv.env.kogitoDataIndexPostgresqlImage.registry}/${buildEnv.env.kogitoDataIndexPostgresqlImage.account}/${buildEnv.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, `${buildEnv.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..2d2789e493b --- /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 buildEnv = 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 ${buildEnv.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 = `${buildEnv.env.kogitoJitRunnerImage.registry}/${buildEnv.env.kogitoJitRunnerImage.account}/${buildEnv.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, `${buildEnv.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..8ea16c03076 --- /dev/null +++ b/packages/kogito-jobs-service-allinone-image/install.js @@ -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. + */ + +const { execSync } = require("child_process"); +const fs = require("fs"); + +const buildEnv = 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 ${buildEnv.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 = `${buildEnv.env.kogitoJobsServiceAllInOneImage.registry}/${buildEnv.env.kogitoJobsServiceAllInOneImage.account}/${buildEnv.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, `${buildEnv.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..ac33c6ae754 --- /dev/null +++ b/packages/kogito-jobs-service-ephemeral-image/install.js @@ -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. + */ + +const { execSync } = require("child_process"); +const fs = require("fs"); + +const buildEnv = 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 ${buildEnv.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 = `${buildEnv.env.kogitoJobsServiceEphemeralImage.registry}/${buildEnv.env.kogitoJobsServiceEphemeralImage.account}/${buildEnv.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, `${buildEnv.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..e975ea5c3d7 --- /dev/null +++ b/packages/kogito-jobs-service-postgresql-image/install.js @@ -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. + */ + +const { execSync } = require("child_process"); +const fs = require("fs"); + +const buildEnv = 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 ${buildEnv.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 = `${buildEnv.env.kogitoJobsServicePostgresqlImage.registry}/${buildEnv.env.kogitoJobsServicePostgresqlImage.account}/${buildEnv.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, `${buildEnv.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/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/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-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/env/index.js b/packages/serverless-logic-web-tools-swf-dev-mode-image/env/index.js index 434d3870172..1c29373cc23 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,24 +25,26 @@ 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: "", + SERVERLESS_LOGIC_WEB_TOOLS_DEVMODE_IMAGE__baseImageTag: { + default: `${kogitoBaseBuilderImageEnv.registry}/${kogitoBaseBuilderImageEnv.account}/${kogitoBaseBuilderImageEnv.name}:${kogitoBaseBuilderImageEnv.buildTag}`, + description: "Base image complete tag.", }, - /* end */ SERVERLESS_LOGIC_WEB_TOOLS_DEVMODE_IMAGE__mavenM2RepoViaHttpImage: { - default: `${mavenM2RepoViaHttpImageEnv.registry}/${mavenM2RepoViaHttpImageEnv.account}/${mavenM2RepoViaHttpImageEnv.name}:${mavenM2RepoViaHttpImageEnv.tag}`, + default: `${mavenM2RepoViaHttpImageEnv.registry}/${mavenM2RepoViaHttpImageEnv.account}/${mavenM2RepoViaHttpImageEnv.name}:${mavenM2RepoViaHttpImageEnv.buildTag}`, description: "The image tag for the Maven M2 Repo via HTTP. Used during the build only.", }, }), 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 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..6a812f4a2e6 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 @@ -21,5 +21,5 @@ const buildEnv = require("./env"); const { setup } = require("@kie-tools/maven-config-setup-helper"); setup(` - -Drevision=${buildEnv.env.swfDevModeImage.version} + -Drevision=${buildEnv.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..f395d8d6393 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 @@ -26,11 +26,11 @@ "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: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 slwtDevModeImage.dev.mavenM2RepoViaHttpImage)", "powershell": "@powershell -NoProfile -ExecutionPolicy Unrestricted -Command" }, "devDependencies": { @@ -41,6 +41,7 @@ "@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/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..961ee98cb09 100644 --- a/packages/serverless-logic-web-tools/webpack.config.ts +++ b/packages/serverless-logic-web-tools/webpack.config.ts @@ -220,10 +220,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 +234,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 +248,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/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..36e3cc1181e 100644 --- a/packages/sonataflow-builder-image/env/index.js +++ b/packages/sonataflow-builder-image/env/index.js @@ -46,8 +46,7 @@ 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), - version: require("../package.json").version, + buildTag: getOrDefault(this.vars.SONATAFLOW_BUILDER_IMAGE__buildTag), }, }; }, diff --git a/packages/sonataflow-builder-image/install.js b/packages/sonataflow-builder-image/install.js index a3090a5364a..00f6c3a3bbf 100644 --- a/packages/sonataflow-builder-image/install.js +++ b/packages/sonataflow-builder-image/install.js @@ -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 ${buildEnv.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); diff --git a/packages/sonataflow-builder-image/package.json b/packages/sonataflow-builder-image/package.json index 8819e58502e..3c4463d089e 100644 --- a/packages/sonataflow-builder-image/package.json +++ b/packages/sonataflow-builder-image/package.json @@ -13,21 +13,27 @@ "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:dev": "run-script-if --bool \"$(build-env containerImages.build)\" --then \"pnpm test\" \"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-assets:linux:darwin": "rimraf build && rsync -av --exclude '*.bats' ./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 ./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)" + "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-assets && pnpm copy-test-assets && mkdir -p dist-tests && rm -rf dist-tests/*", + "test:win32": "echo \"Tests are skipped in Windows\"" }, "devDependencies": { "@kie-tools/python-venv": "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/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-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..6b741da955c 100644 --- a/packages/sonataflow-devmode-image/env/index.js +++ b/packages/sonataflow-devmode-image/env/index.js @@ -51,8 +51,7 @@ 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), }, }; diff --git a/packages/sonataflow-devmode-image/install.js b/packages/sonataflow-devmode-image/install.js index 79fee7113bc..f701da5c030 100644 --- a/packages/sonataflow-devmode-image/install.js +++ b/packages/sonataflow-devmode-image/install.js @@ -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 ${buildEnv.env.sonataflowDevModeImage.buildTag} --source-folder ./resources`, { stdio: "inherit" } ); diff --git a/packages/sonataflow-devmode-image/package.json b/packages/sonataflow-devmode-image/package.json index d46b4029e61..4a2843d4a25 100644 --- a/packages/sonataflow-devmode-image/package.json +++ b/packages/sonataflow-devmode-image/package.json @@ -19,16 +19,16 @@ "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-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:test:darwin:win32": "echo \"Tests skipped on macOS and Windows\"", + "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: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 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)" + "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/python-venv": "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/module.yaml b/packages/sonataflow-devmode-image/resources/modules/sonataflow/devmode/build-config/module.yaml index 2150cf0300b..36ea5dcdd06 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: 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/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..d50e66e5a08 100644 --- a/packages/sonataflow-image-common/install.js +++ b/packages/sonataflow-image-common/install.js @@ -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 ${buildEnv.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..fa075f37ab8 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": "run-script-if --bool \"$(build-env tests.run)\" --then \"pnpm test\"", + "install": "node install.js", + "test": "run-script-os", + "test:linux:darwin": "mkdir -p dist-tests && rm -rf dist-tests/* && make -C ./resources bats || $(build-env tests.ignoreFailures) && mv dist-tests/report.xml dist-tests/junit-report.xml || true", + "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..3bf56946c3e 100644 --- a/packages/sonataflow-image-common/resources/Makefile +++ b/packages/sonataflow-image-common/resources/Makefile @@ -23,29 +23,29 @@ CEKIT_CMD := cekit ${CEKIT_BUILD_OPTIONS} 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/module.yaml b/packages/sonataflow-image-common/resources/modules/kogito-maven/common/module.yaml index bf616eaa8dc..0644818dc27 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" 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/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/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..6a96ecb4f8d --- /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" +# 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-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/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/pnpm-lock.yaml b/pnpm-lock.yaml index 7a7854836e8..c32ba9b016c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -861,13 +861,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 +876,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 @@ -4194,7 +4194,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 +4221,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 +4230,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 @@ -6114,6 +6114,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': @@ -7808,7 +7976,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 +8291,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 +9606,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 @@ -9517,6 +9688,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 @@ -10961,6 +11135,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 +11469,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 @@ -22698,10 +22887,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 +28771,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 +38043,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 +42553,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 +43677,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 +48154,6 @@ snapshots: escalade@3.1.1: {} - escalade@3.1.2: {} - escalade@3.2.0: {} escape-html@1.0.3: {} @@ -48496,12 +48660,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 +48905,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 +54557,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 +56109,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 +56187,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 +57529,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 +58098,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 +58108,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 +58129,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 +58228,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 +58749,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 +58929,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..d7c98c77dbc 100644 --- a/repo/graph.dot +++ b/repo/graph.dot @@ -140,6 +140,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 +191,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" ]; @@ -431,6 +438,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" ]; @@ -524,6 +538,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 +546,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" ]; @@ -584,6 +599,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" ]; diff --git a/repo/graph.json b/repo/graph.json index 3e5b4cfb333..d0b1cd4a282 100644 --- a/repo/graph.json +++ b/repo/graph.json @@ -154,9 +154,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 +188,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" }, @@ -1913,6 +1920,26 @@ "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/sonataflow-image-common", @@ -1928,6 +1955,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 +2290,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 +2330,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", @@ -2275,17 +2342,17 @@ }, { "source": "@kie-tools/serverless-logic-web-tools-swf-dev-mode-image", - "target": "@kie-tools/python-venv", + "target": "@kie-tools/serverless-logic-web-tools-swf-deployment-quarkus-app", "weight": 1 }, { "source": "@kie-tools/serverless-logic-web-tools-swf-dev-mode-image", - "target": "@kie-tools/serverless-logic-web-tools-swf-deployment-quarkus-app", + "target": "@kie-tools/serverless-logic-web-tools-swf-dev-mode-image-env", "weight": 1 }, { "source": "@kie-tools/serverless-logic-web-tools-swf-dev-mode-image", - "target": "@kie-tools/serverless-logic-web-tools-swf-dev-mode-image-env", + "target": "@kie/kogito-base-builder-image", "weight": 1 }, { @@ -2588,6 +2655,13 @@ ["@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"], 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/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);