Skip to content

Commit

Permalink
remove jboss repository references
Browse files Browse the repository at this point in the history
  • Loading branch information
jstastny-cz committed Nov 10, 2023
1 parent fee2383 commit 099dbb1
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 58 deletions.
4 changes: 2 additions & 2 deletions modules/kogito-maven/3.8.x-rpm/added/configure-maven.sh
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ function ignore_maven_self_signed_certificates() {
}

function set_kogito_maven_repo() {
local kogito_maven_repo_url="${JBOSS_MAVEN_REPO_URL}"
local kogito_maven_repo_url="${DEFAULT_MAVEN_REPO_URL}"
if [ -n "${kogito_maven_repo_url}" ]; then
sed -i.bak "s|https://repository.jboss.org/nexus/content/groups/public/|${kogito_maven_repo_url}|" "${MAVEN_SETTINGS_PATH}"
sed -i.bak "s|https://repository.apache.org/content/groups/public/|${kogito_maven_repo_url}|" "${MAVEN_SETTINGS_PATH}"
fi
}

Expand Down
15 changes: 6 additions & 9 deletions modules/kogito-maven/3.8.x-rpm/maven/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@

<profile>
<id>kogito-images</id>
<repositories>
<repository>
<id>jboss-public-repository-group</id>
<name>JBoss Public Repository Group</name>
<url>https://repository.jboss.org/nexus/content/groups/public/</url>
<layout>default</layout>
<id>apache-public-repository-group</id>
<name>Apache Public Repository Group</name>
<url>https://repository.apache.org/content/groups/public/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
Expand All @@ -36,10 +34,9 @@

<pluginRepositories>
<pluginRepository>
<id>jboss-public-repository-group</id>
<name>JBoss Public Repository Group</name>
<url>https://repository.jboss.org/nexus/content/groups/public/</url>
<layout>default</layout>
<id>apache-public-repository-group</id>
<name>Apache Public Repository Group</name>
<url>https://repository.apache.org/content/groups/public/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
Expand Down
6 changes: 3 additions & 3 deletions modules/kogito-maven/3.8.x-rpm/module.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ envs:
- name: "MAVEN_DOWNLOAD_OUTPUT"
description: "If set to true will print the transfer logs for downloading/uploading of maven dependencies. Defaults to false"
example: "true"
- name: "JBOSS_MAVEN_REPO_URL"
value: "https://repository.jboss.org/nexus/content/groups/public/"
description: "Defines the Jboss Maven repository for Kogito artifacts."
- name: "DEFAULT_MAVEN_REPO_URL"
value: "https://repository.apache.org/content/groups/public/"
description: "Defines the Default Maven repository for Kogito artifacts."
- name: "MAVEN_REPO_URL"
description: "Defines an extra Maven repository."
example: "https://nexus.test.com/group/public"
Expand Down
4 changes: 2 additions & 2 deletions modules/kogito-maven/3.8.x/added/configure-maven.sh
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ function ignore_maven_self_signed_certificates() {
}

function set_kogito_maven_repo() {
local kogito_maven_repo_url="${JBOSS_MAVEN_REPO_URL}"
local kogito_maven_repo_url="${DEFAULT_MAVEN_REPO_URL}"
if [ -n "${kogito_maven_repo_url}" ]; then
sed -i.bak "s|https://repository.jboss.org/nexus/content/groups/public/|${kogito_maven_repo_url}|" "${MAVEN_SETTINGS_PATH}"
sed -i.bak "s|https://repository.apache.org/content/groups/public/|${kogito_maven_repo_url}|" "${MAVEN_SETTINGS_PATH}"
fi
}

Expand Down
12 changes: 6 additions & 6 deletions modules/kogito-maven/3.8.x/maven/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
<id>kogito-images</id>
<repositories>
<repository>
<id>jboss-public-repository-group</id>
<name>JBoss Public Repository Group</name>
<url>https://repository.jboss.org/nexus/content/groups/public/</url>
<id>apache-public-repository-group</id>
<name>Apache Public Repository Group</name>
<url>https://repository.apache.org/content/groups/public/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
Expand All @@ -36,9 +36,9 @@

<pluginRepositories>
<pluginRepository>
<id>jboss-public-repository-group</id>
<name>JBoss Public Repository Group</name>
<url>https://repository.jboss.org/nexus/content/groups/public/</url>
<id>apache-public-repository-group</id>
<name>Apache Public Repository Group</name>
<url>https://repository.apache.org/content/groups/public/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
Expand Down
6 changes: 3 additions & 3 deletions modules/kogito-maven/3.8.x/module.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ envs:
- name: "MAVEN_DOWNLOAD_OUTPUT"
description: "If set to true will print the transfer logs for downloading/uploading of maven dependencies. Defaults to false"
example: "true"
- name: "JBOSS_MAVEN_REPO_URL"
value: "https://repository.jboss.org/nexus/content/groups/public/"
description: "Defines the Jboss Maven repository for Kogito artifacts."
- name: "DEFAULT_MAVEN_REPO_URL"
value: "https://repository.apache.org/content/groups/public/"
description: "Defines the default Maven repository for Kogito artifacts."
- name: "MAVEN_REPO_URL"
description: "Defines an extra Maven repository."
example: "https://nexus.test.com/group/public"
Expand Down
34 changes: 17 additions & 17 deletions scripts/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,17 +361,17 @@ def update_runtime_image_in_behave_tests(runtime_image_name, image_suffix):
update_in_behave_tests(pattern, replacement)


def update_maven_repo_in_behave_tests(repo_url, replace_jboss_repository):
def update_maven_repo_in_behave_tests(repo_url, replace_default_repository):
"""
Update maven repository into behave tests
:param repo_url: Maven repository url
:param replace_jboss_repository: Set to true if default Jboss repository needs to be overriden
:param replace_default_repository: Set to true if default repository needs to be overriden
"""
print("Set maven repo {} in behave tests".format(repo_url))
pattern = re.compile('\|\s*variable[\s]*\|[\s]*value[\s]*\|')
env_var_key = "MAVEN_REPO_URL"
if replace_jboss_repository:
env_var_key = "JBOSS_MAVEN_REPO_URL"
if replace_default_repository:
env_var_key = "DEFAULT_MAVEN_REPO_URL"
replacement = "| variable | value |\n | {} | {} |".format(env_var_key,
repo_url)
update_in_behave_tests(pattern, replacement)
Expand All @@ -396,16 +396,16 @@ def update_maven_mirror_url_in_quarkus_plugin_behave_tests(mirror_url):
"MAVEN_MIRROR_URL", mirror_url)
update_in_behave_tests(pattern, replacement)

def update_maven_repo_env_value(repo_url, replace_jboss_repository, prod=False):
def update_maven_repo_env_value(repo_url, replace_default_repository, prod=False):
"""
Update the given maven repository value for all images/modules.
:param repo_url: Maven repository url
:param replace_jboss_repository: Set to true if default Jboss repository needs to be ove
:param replace_default_repository: Set to true if default repository needs to be overidden
:param prod: if the module to be updated is prod version.
"""
env_name = "MAVEN_REPO_URL"
if replace_jboss_repository:
env_name = "JBOSS_MAVEN_REPO_URL"
if replace_default_repository:
env_name = "DEFAULT_MAVEN_REPO_URL"
update_env_value(env_name, repo_url, prod)


Expand Down Expand Up @@ -453,29 +453,29 @@ def update_examples_uri_in_clone_repo(examples_uri):
replacement = "git clone {}".format(examples_uri)
update_in_file(CLONE_REPO_SCRIPT, pattern, replacement)

def update_maven_repo_in_build_config(repo_url, replace_jboss_repository):
def update_maven_repo_in_build_config(repo_url, replace_default_repository):
"""
Update maven repository in build config modules
:param repo_url: Maven repository url
:param replace_jboss_repository: Set to true if default Jboss repository needs to be overridden
:param replace_default_repository: Set to true if default repository needs to be overridden
"""
maven_env_name = 'MAVEN_REPO_URL'
if replace_jboss_repository:
maven_env_name = 'JBOSS_MAVEN_REPO_URL'
if replace_default_repository:
maven_env_name = 'DEFAULT_MAVEN_REPO_URL'
update_env_value_in_build_config_modules(maven_env_name, repo_url, True)

def update_maven_repo_in_setup_maven(repo_url, replace_jboss_repository):
def update_maven_repo_in_setup_maven(repo_url, replace_default_repository):
"""
Update maven repository into setup-maven.sh script
:param repo_url: Maven repository url
:param replace_jboss_repository: Set to true if default Jboss repository needs to be overridden
:param replace_default_repository: Set to true if default repository needs to be overridden
"""
print("Set maven repo {} in setup-maven script".format(repo_url))
pattern = ""
replacement = ""
if replace_jboss_repository:
pattern = re.compile(r'(export JBOSS_MAVEN_REPO_URL=.*)')
replacement = 'export JBOSS_MAVEN_REPO_URL="{}"'.format(repo_url)
if replace_default_repository:
pattern = re.compile(r'(export DEFAULT_MAVEN_REPO_URL=.*)')
replacement = 'export DEFAULT_MAVEN_REPO_URL="{}"'.format(repo_url)
else:
pattern = re.compile(r'(# export MAVEN_REPO_URL=.*)')
replacement = 'export MAVEN_REPO_URL="{}"'.format(repo_url)
Expand Down
2 changes: 1 addition & 1 deletion scripts/setup-maven.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ echo "Updating settings file ${maven_settings_path}"

# setup maven env
# Do not remove below, this can be updated by the python scripts
export JBOSS_MAVEN_REPO_URL="https://repository.jboss.org/nexus/content/groups/public/"
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}"
Expand Down
12 changes: 6 additions & 6 deletions scripts/update-repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
parser = argparse.ArgumentParser(description='Update Maven information in repo from the given artifact url and '
'version.')
parser.add_argument('--repo-url', dest='repo_url', help='Defines the url of the repository to setup into the tests')
parser.add_argument('--replace-jboss-repo', dest='replace_jboss_repo', default=False, action='store_true',
help='Enable if repo-url should replace the main JBoss repository')
parser.add_argument('--replace-default-repo', dest='replace_default_repo', default=False, action='store_true',
help='Enable if repo-url should replace the default repository')
parser.add_argument('--ignore-self-signed-cert', dest='ignore_self_signed_cert', default=False,
action='store_true',
help='If set to true will relax the SSL for user-generated self-signed certificates')
Expand All @@ -41,11 +41,11 @@
args = parser.parse_args()

if args.repo_url:
common.update_maven_repo_in_build_config(args.repo_url, args.replace_jboss_repo)
common.update_maven_repo_in_setup_maven(args.repo_url, args.replace_jboss_repo)
common.update_maven_repo_in_behave_tests(args.repo_url, args.replace_jboss_repo)
common.update_maven_repo_in_build_config(args.repo_url, args.replace_default_repo)
common.update_maven_repo_in_setup_maven(args.repo_url, args.replace_default_repo)
common.update_maven_repo_in_behave_tests(args.repo_url, args.replace_default_repo)
if not args.tests_only:
common.update_maven_repo_env_value(args.repo_url, args.replace_jboss_repo, args.prod)
common.update_maven_repo_env_value(args.repo_url, args.replace_default_repo, args.prod)

if args.ignore_self_signed_cert:
common.ignore_maven_self_signed_certificate_in_build_config()
Expand Down
21 changes: 12 additions & 9 deletions tests/test-apps/clone-repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# Clone the kogito-examples and edit the rules-quarkus-helloworld and dmn-quarkus-example for testing purposes
# if image name is supporting services, don't build it
IMAGE_NAME="$2"
KOGITO_EXAMPLES_REPO_NAME='incubator-kie-kogito-examples'

prod=""
if [ -n "${IMAGE_NAME}" ]; then
if [[ ${IMAGE_NAME} =~ rhpam|logic* ]]; then
Expand Down Expand Up @@ -34,16 +36,17 @@ fi
set -e

# Clone examples
KOGITO_EXAMPLES_DIR=/tmp/${KOGITO_EXAMPLES_REPO_NAME}
cd /tmp
rm -rf kogito-examples/
git clone https://github.com/apache/incubator-kie-kogito-examples.git
cd kogito-examples/
rm -rf ${KOGITO_EXAMPLES_REPO_NAME}
git clone https://github.com/apache/${KOGITO_EXAMPLES_REPO_NAME}.git
cd ${KOGITO_EXAMPLES_REPO_NAME}/
git fetch origin
git fetch origin --tags
git checkout -b nightly-main

# make a new copy of rules-quarkus-helloworld for native tests
cp -rv /tmp/kogito-examples/kogito-quarkus-examples/rules-quarkus-helloworld/ /tmp/kogito-examples/kogito-quarkus-examples/rules-quarkus-helloworld-native/
cp -rv ${KOGITO_EXAMPLES_DIR}/kogito-quarkus-examples/rules-quarkus-helloworld/ ${KOGITO_EXAMPLES_DIR}/kogito-quarkus-examples/rules-quarkus-helloworld-native/

set -x

Expand All @@ -53,19 +56,19 @@ mvn -f kogito-springboot-examples/process-springboot-example clean package ${MAV

if [ "$NATIVE_BUILD" = 'true' ]; then
mvn -f kogito-quarkus-examples/rules-quarkus-helloworld-native -Dnative clean package ${MAVEN_OPTIONS} ${MAVEN_QUARKUS_NATIVE_CONTAINER_BUILD_ARGS}
ls -lah /tmp/kogito-examples/kogito-quarkus-examples/rules-quarkus-helloworld-native/target/
ls -lah ${KOGITO_EXAMPLES_DIR}/kogito-quarkus-examples/rules-quarkus-helloworld-native/target/
fi

# preparing directory to run kogito maven archetypes tests
mkdir -pv /tmp/kogito-examples/dmn-example
cp /tmp/kogito-examples/kogito-quarkus-examples/dmn-quarkus-example/src/main/resources/* /tmp/kogito-examples/dmn-example/
mkdir -pv ${KOGITO_EXAMPLES_DIR}/dmn-example
cp ${KOGITO_EXAMPLES_DIR}/kogito-quarkus-examples/dmn-quarkus-example/src/main/resources/* ${KOGITO_EXAMPLES_DIR}/dmn-example/

# by adding the application.properties file telling app to start on
# port 10000, the purpose of this tests is make sure that the images
# will ensure the use of the port 8080.

cp ${base_dir}/application.properties /tmp/kogito-examples/kogito-quarkus-examples/rules-quarkus-helloworld/src/main/resources/META-INF/
(echo ""; echo "server.port=10000") >> /tmp/kogito-examples/kogito-springboot-examples/process-springboot-example/src/main/resources/application.properties
cp ${base_dir}/application.properties ${KOGITO_EXAMPLES_DIR}/kogito-quarkus-examples/rules-quarkus-helloworld/src/main/resources/META-INF/
(echo ""; echo "server.port=10000") >> ${KOGITO_EXAMPLES_DIR}/kogito-springboot-examples/process-springboot-example/src/main/resources/application.properties

set +x

Expand Down

0 comments on commit 099dbb1

Please sign in to comment.