forked from apache/incubator-kie-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kie-tools#2751: Remove references to Quarkus and Kogito versions; Aut…
…omatic change of platform images based on env context (apache#2794) Signed-off-by: Ricardo Zanini <[email protected]> Signed-off-by: Ricardo Zanini <[email protected]>
- Loading branch information
1 parent
bc20d5d
commit c690d46
Showing
43 changed files
with
427 additions
and
252 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
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
94 changes: 94 additions & 0 deletions
94
...flow-image-common/resources/modules/sonataflow/common/scripts/added/quarkus-mvn-plugin.sh
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,94 @@ | ||
#!/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. | ||
# | ||
|
||
|
||
# Useful functions for runnning Quarkus Maven Plugin. Moved from bare scripts to facilitate testing. | ||
|
||
set -e | ||
|
||
# Default version variables | ||
quarkus_version="${QUARKUS_PLATFORM_VERSION}" | ||
kogito_version="${KOGITO_VERSION}" | ||
|
||
# shellcheck source=/dev/null | ||
source "${KOGITO_HOME}"/launch/logging.sh | ||
|
||
# Function to append the correct version to the extension if needed | ||
append_version() { | ||
local extension="$1" | ||
local group_id | ||
local artifact_id | ||
local version | ||
|
||
# Split extension into groupId, artifactId, and version | ||
IFS=":" read -r group_id artifact_id version <<< "$extension" | ||
|
||
# If the version is missing, append the default version based on the groupId | ||
if [ -z "$version" ]; then | ||
if [[ "$group_id" == "io.quarkus" ]]; then | ||
extension="${group_id}:${artifact_id}:${quarkus_version}" | ||
elif [[ "$group_id" == *"kie"* || "$group_id" == *"kogito"* || "$artifact_id" == *"kogito"* || "$artifact_id" == *"sonataflow"* ]]; then | ||
extension="${group_id}:${artifact_id}:${kogito_version}" | ||
fi | ||
fi | ||
|
||
echo "$extension" | ||
} | ||
|
||
process_extensions() { | ||
local extensions="$1" | ||
local processed_extensions="" | ||
IFS=',' read -r -a extension_array <<< "$extensions" | ||
for ext in "${extension_array[@]}"; do | ||
processed_extensions+=$(append_version "$ext")"," | ||
done | ||
# Remove the trailing comma | ||
processed_extensions="${processed_extensions%,}" | ||
echo "$processed_extensions" | ||
} | ||
|
||
run_quarkus_mvn_add_extension() { | ||
local extensions="$1" | ||
local ignore_jvm_settings=${2:-false} | ||
|
||
local processed_extensions=$(process_extensions "$extensions") | ||
|
||
if [ "${SCRIPT_DEBUG}" = "true" ]; then | ||
set -x | ||
export MAVEN_ARGS_APPEND="${MAVEN_ARGS_APPEND} -X --batch-mode" | ||
log_info "Script debugging is enabled, allowing bash commands and their arguments to be printed as they are executed" | ||
printenv | ||
fi | ||
|
||
if [ "${ignore_jvm_settings}" != "true" ]; then | ||
source "${KOGITO_HOME}"/launch/configure-jvm-mvn.sh | ||
fi | ||
|
||
log_info "Processed extensions to be added ${processed_extensions}" | ||
|
||
"${MAVEN_HOME}"/bin/mvn -B ${MAVEN_ARGS_APPEND} \ | ||
-nsu \ | ||
-B \ | ||
-s "${MAVEN_SETTINGS_PATH}" \ | ||
-DplatformVersion="${QUARKUS_PLATFORM_VERSION}" \ | ||
-Dextensions="${processed_extensions}" \ | ||
${QUARKUS_ADD_EXTENSION_ARGS} \ | ||
"${QUARKUS_PLATFORM_GROUPID}":quarkus-maven-plugin:"${QUARKUS_PLATFORM_VERSION}":add-extension | ||
} |
83 changes: 83 additions & 0 deletions
83
...age-common/resources/modules/sonataflow/common/scripts/tests/bats/quarkus-mvn-plugin.bats
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,83 @@ | ||
#!/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. | ||
# | ||
set -e | ||
|
||
# Set up some environment variables for testing | ||
setup() { | ||
export QUARKUS_PLATFORM_VERSION="2.0.0" | ||
export KOGITO_VERSION="1.5.0" | ||
export KOGITO_HOME=$BATS_TMPDIR/maven | ||
mkdir -p ${KOGITO_HOME}/"launch" | ||
cp ${BATS_TEST_DIRNAME}/../../../../../kogito-logging/added/logging.sh ${KOGITO_HOME}/launch/logging.sh | ||
|
||
load ${BATS_TEST_DIRNAME}/../../added/quarkus-mvn-plugin.sh | ||
} | ||
|
||
teardown() { | ||
rm -rf ${KOGITO_HOME} | ||
} | ||
|
||
# Test that a full extension with version does not get modified | ||
@test "Extension with version should remain unchanged" { | ||
run process_extensions "io.quarkus:quarkus-resteasy-reactive:2.0.0" | ||
echo "Test Output:" | ||
echo "$output" | ||
[ "$output" == "io.quarkus:quarkus-resteasy-reactive:2.0.0" ] | ||
} | ||
|
||
# Test that an extension without version for io.quarkus gets the default version | ||
@test "io.quarkus extension without version should get the default version" { | ||
run process_extensions "io.quarkus:quarkus-resteasy-reactive" | ||
echo "Test Output:" | ||
echo "$output" | ||
[ "$output" == "io.quarkus:quarkus-resteasy-reactive:2.0.0" ] | ||
} | ||
|
||
# Test that an extension without version for kogito gets the KOGITO version | ||
@test "Kogito extension without version should get the KOGITO version" { | ||
run process_extensions "org.kie:kie-server" | ||
echo "Test Output:" | ||
echo "$output" | ||
[ "$output" == "org.kie:kie-server:1.5.0" ] | ||
} | ||
|
||
# Test that an extension without version for a non-quarkus and non-kogito group gets the default version | ||
@test "Non-quarkus, non-kogito extension without version should get the default version" { | ||
run process_extensions "org.acme:acme-component" | ||
echo "Test Output:" | ||
echo "$output" | ||
[ "$output" == "org.acme:acme-component" ] | ||
} | ||
|
||
# Test that multiple extensions are handled correctly | ||
@test "Multiple extensions should get versions added" { | ||
run process_extensions "io.quarkus:quarkus-resteasy-reactive,org.acme:acme-component,io.quarkus:quarkus-core" | ||
echo "Test Output:" | ||
echo "$output" | ||
[ "$output" == "io.quarkus:quarkus-resteasy-reactive:2.0.0,org.acme:acme-component,io.quarkus:quarkus-core:2.0.0" ] | ||
} | ||
|
||
# Test that the script fails when no extensions are provided | ||
@test "No extensions should cause an error" { | ||
run process_extensions "" | ||
echo "Test Output:" | ||
echo "$output" | ||
[ "$output" == "" ] # Expecting an empty result for no extensions | ||
} |
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 |
---|---|---|
|
@@ -23,5 +23,5 @@ spec: | |
build: | ||
config: | ||
registry: | ||
address: docker.io/apache | ||
address: host/namespace | ||
secret: regcred |
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
Oops, something went wrong.