Skip to content

Commit

Permalink
Merge branch 'main' of github.com:apache/incubator-kie-tools into son…
Browse files Browse the repository at this point in the history
…ataflow-m2-repo-main
  • Loading branch information
thiagoelg committed Sep 27, 2024
2 parents 224ff19 + d2fa9cb commit df059ac
Show file tree
Hide file tree
Showing 157 changed files with 4,104 additions and 319 deletions.
21 changes: 21 additions & 0 deletions .asf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# 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.
github:
enabled_merge_buttons:
squash: true
merge: true
rebase: false
2 changes: 1 addition & 1 deletion .ci/jenkins/release-jobs/Jenkinsfile.kogito-swf-builder
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ pipeline {
steps {
dir('kie-tools') {
script {
defaultSettingsFile = 'packages/sonataflow-image-common/resources/modules/kogito-maven/common/maven/settings.xml'
defaultSettingsFile = 'packages/sonataflow-image-common/resources/modules/kogito-maven/common/maven/maven-m2-repo-via-http-settings.xml.envsubst'
sh """#!/bin/bash -el
rm -rf "${defaultSettingsFile}"
cp "${env.MAVEN_SETTINGS_PATH}" "${defaultSettingsFile}"
Expand Down
2 changes: 1 addition & 1 deletion .ci/jenkins/release-jobs/Jenkinsfile.kogito-swf-devmode
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ pipeline {
steps {
dir('kie-tools') {
script {
defaultSettingsFile = 'packages/sonataflow-image-common/resources/modules/kogito-maven/common/maven/settings.xml'
defaultSettingsFile = 'packages/sonataflow-image-common/resources/modules/kogito-maven/common/maven/maven-m2-repo-via-http-settings.xml.envsubst'
sh """#!/bin/bash -el
rm -rf "${defaultSettingsFile}"
cp "${env.MAVEN_SETTINGS_PATH}" "${defaultSettingsFile}"
Expand Down
2 changes: 1 addition & 1 deletion .ci/jenkins/shared-scripts/buildUtils.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion KOGITO_UPGRADE_PROCESS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
},
}),
Expand Down
2 changes: 1 addition & 1 deletion packages/kn-plugin-workflow/env/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
},
}),
Expand Down
53 changes: 53 additions & 0 deletions packages/kogito-base-builder-image/env/index.js
Original file line number Diff line number Diff line change
@@ -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),
},
};
},
});
64 changes: 64 additions & 0 deletions packages/kogito-base-builder-image/install.js
Original file line number Diff line number Diff line change
@@ -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}`,
});
46 changes: 46 additions & 0 deletions packages/kogito-base-builder-image/package.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
}
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"
- 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
53 changes: 53 additions & 0 deletions packages/kogito-data-index-ephemeral-image/env/index.js
Original file line number Diff line number Diff line change
@@ -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),
},
};
},
});
Loading

0 comments on commit df059ac

Please sign in to comment.