Skip to content

Commit

Permalink
Add option to use KUBECONFIG when calling ods_ci/build/run.sh
Browse files Browse the repository at this point in the history
Signed-off-by: manosnoam <[email protected]>
  • Loading branch information
manosnoam committed Mar 3, 2024
1 parent 68743c8 commit 39e5711
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions ods_ci/build/run.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -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}"

Check warning on line 32 in ods_ci/build/run.sh

View workflow job for this annotation

GitHub Actions / shellcheck linter

[shellcheck] reported by reviewdog 🐶 Double quote to prevent globbing and word splitting. [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086) Raw Output: ./ods_ci/build/run.sh:32:43:info:Double quote to prevent globbing and word splitting. [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086)
Expand Down

0 comments on commit 39e5711

Please sign in to comment.