From 39e571148990fbc8442447b55d509cc92d7f0d71 Mon Sep 17 00:00:00 2001 From: manosnoam Date: Wed, 21 Feb 2024 15:41:04 +0000 Subject: [PATCH] Add option to use KUBECONFIG when calling ods_ci/build/run.sh Signed-off-by: manosnoam --- ods_ci/build/run.sh | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) mode change 100644 => 100755 ods_ci/build/run.sh diff --git a/ods_ci/build/run.sh b/ods_ci/build/run.sh old mode 100644 new mode 100755 index eda9e536a..7efcf953f --- a/ods_ci/build/run.sh +++ b/ods_ci/build/run.sh @@ -1,28 +1,32 @@ #!/bin/bash +set -e + echo RUN SCRIPT ARGS: "${RUN_SCRIPT_ARGS}" echo ROBOT EXTRA ARGS: "${ROBOT_EXTRA_ARGS}" echo SET TEST ENVIRONMENT: "${SET_ENVIRONMENT}" echo -- USE OCM to install IDPs: "${USE_OCM_IDP}" +echo "Set Kubeconfig file path to: ${KUBECONFIG}" +export "KUBECONFIG=${KUBECONFIG}" + # feature requested for MPS pipeline onboarding -if [ "${SET_ENVIRONMENT}" -eq 1 ]; then \ - if [ -z "${OC_HOST}" ] - then - echo -e "\033[0;33m You must set the OC_HOST env variable to automatically set the Test Environment for ODS-CI \033[0m" +if [ "${SET_ENVIRONMENT}" -eq 1 ]; then + if [ -z "${OC_HOST}" ]; then + echo -e "\033[0;33m You must set the OC_HOST env variable to automatically set the Test Environment for ODS-CI \033[0m" + exit 0 + else + if [ "${USE_OCM_IDP}" -eq 0 ]; then + actual_host="$(oc whoami --show-server)" + if [ -z "${RUN_FROM_CONTAINER}" ] && [ "${actual_host}" != "${OC_HOST}" ]; then + echo "-----| USE_OCM_IDP option is disabled, but you are connected to a different cluster than ${OC_HOST}. To prevent you to change IDPs of the wrong cluster, ODS-CI stops here... |-----" exit 0 - else - if [ "${USE_OCM_IDP}" -eq 0 ] - then - actual_host="$(oc whoami --show-server)" - if [ -z "${RUN_FROM_CONTAINER}" ] && [ "${actual_host}" != "${OC_HOST}" ] - then - echo "-----| USE_OCM_IDP option is disabled, but you are connected to a different cluster than ${OC_HOST}. To prevent you to change IDPs of the wrong cluster, ODS-CI stops here...|-----" - exit 0 - fi - fi - echo "-----| SET_ENVIRONMENT option is enabled. ODS-CI is going to configure the test environment for you..|-----" - ./ods_ci/build/install_idp.sh + fi + fi + echo "-----| SET_ENVIRONMENT option is enabled. ODS-CI is going to create IDP users |-----" + ./ods_ci/build/install_idp.sh fi +else + echo "-----| SET_ENVIRONMENT option is disabled. Skipping test environment setup |-----" fi echo "-----| ODS-CI is starting the tests run...|-----" ./ods_ci/run_robot_test.sh --skip-install ${RUN_SCRIPT_ARGS} --extra-robot-args "${ROBOT_EXTRA_ARGS}"