Skip to content

Commit

Permalink
[Fix] run_robot_test.sh - let's check return code of yq before oc login
Browse files Browse the repository at this point in the history
  • Loading branch information
jstourac committed Sep 26, 2023
1 parent 7b94102 commit 0cd5340
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions ods_ci/run_robot_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -263,15 +263,27 @@ if command -v yq &> /dev/null
then
oc_host=${api_server}
else
oc_host=$(yq -er '.OCP_API_URL' "${TEST_VARIABLES_FILE}")
oc_host=$(yq -er '.OCP_API_URL' "${TEST_VARIABLES_FILE}") || {
echo "Couldn't find '.OCP_API_URL' variable in provided '${TEST_VARIABLES_FILE}'."
echo "Please either provide it or use '--skip-oclogin true' (don't forget to login to the testing cluster manually then)."
exit 1
}
fi


if [ -z "${SERVICE_ACCOUNT}" ]
then
echo "Performing oc login using username and password"
oc_user=$(yq -er '.OCP_ADMIN_USER.USERNAME' "${TEST_VARIABLES_FILE}")
oc_pass=$(yq -er '.OCP_ADMIN_USER.PASSWORD' "${TEST_VARIABLES_FILE}")
oc_user=$(yq -er '.OCP_ADMIN_USER.USERNAME' "${TEST_VARIABLES_FILE}") || {
echo "Couldn't find '.OCP_ADMIN_USER.USERNAME' variable in provided '${TEST_VARIABLES_FILE}'."
echo "Please either provide it or use '--skip-oclogin true' (don't forget to login to the testing cluster manually then)."
exit 1
}
oc_pass=$(yq -er '.OCP_ADMIN_USER.PASSWORD' "${TEST_VARIABLES_FILE}") || {
echo "Couldn't find '.OCP_ADMIN_USER.PASSWORD' variable in provided '${TEST_VARIABLES_FILE}'."
echo "Please either provide it or use '--skip-oclogin true' (don't forget to login to the testing cluster manually then)."
exit 1
}
oc login "${oc_host}" --username "${oc_user}" --password "${oc_pass}" --insecure-skip-tls-verify=true
retVal=$?
else
Expand Down

0 comments on commit 0cd5340

Please sign in to comment.