-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:apache/incubator-kie-tools into son…
…ataflow-m2-repo-main
- Loading branch information
Showing
157 changed files
with
4,104 additions
and
319 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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), | ||
}, | ||
}; | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}`, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
] | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
packages/kogito-base-builder-image/resources/incubator-kie-kogito-base-builder-image.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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), | ||
}, | ||
}; | ||
}, | ||
}); |
Oops, something went wrong.