Skip to content

Commit

Permalink
fix: the " or exit " command need to return 1 and output redirection …
Browse files Browse the repository at this point in the history
…to stder on error [NMO-457]. Update N2ST submodule to latest
  • Loading branch information
RedLeader962 committed Dec 22, 2023
1 parent e961cdf commit a674723
Show file tree
Hide file tree
Showing 14 changed files with 26 additions and 26 deletions.
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -216,15 +216,15 @@ SPROJECT_BUILD_SYSTEM_PATH="${SPROJECT_ROOT}/build_system"
NBS_PATH="${SPROJECT_ROOT}/utilities/norlab-build-system"

# ....Load environment variables from file..............................................
cd "${SPROJECT_BUILD_SYSTEM_PATH}" || exit
cd "${SPROJECT_BUILD_SYSTEM_PATH}" || exit 1
set -o allexport && source .env && set +o allexport

# ....Source NBS dependencies...........................................................
cd "${NBS_PATH}" || exit
cd "${NBS_PATH}" || exit 1
source import_norlab_build_system_lib.bash

# ====begin=============================================================================
cd "${NBS_PATH}/src/utility_scripts" || exit
cd "${NBS_PATH}/src/utility_scripts" || exit 1

DOTENV_BUILD_MATRIX_REALPATH=${SPROJECT_BUILD_SYSTEM_PATH}/.env.build_matrix.dependencies

Expand Down
8 changes: 4 additions & 4 deletions import_norlab_build_system_lib.bash
Expand Up @@ -22,7 +22,7 @@ function nbs::source_lib(){
_REPO_ROOT="$(dirname "${_PATH_TO_SCRIPT}")"

# ....Load environment variables from file.......................................................
cd "${_REPO_ROOT}" || exit
cd "${_REPO_ROOT}" || exit 1
set -o allexport
source .env.nbs
set +o allexport
Expand All @@ -37,17 +37,17 @@ function nbs::source_lib(){
source "import_norlab_shell_script_tools_lib.bash"

# ....Source NBS functions.......................................................................
cd "${NBS_PATH}/src/function_library/build_tools" || exit
cd "${NBS_PATH}/src/function_library/build_tools" || exit 1
for each_file in "$(pwd)"/*.bash ; do
source "${each_file}"
done

cd "${NBS_PATH}/src/function_library/container_tools" || exit
cd "${NBS_PATH}/src/function_library/container_tools" || exit 1
for each_file in "$(pwd)"/*.bash ; do
source "${each_file}"
done

cd "${NBS_PATH}/src/function_library/dev_tools" || exit
cd "${NBS_PATH}/src/function_library/dev_tools" || exit 1
for each_file in "$(pwd)"/*.bash ; do
source "${each_file}"
done
Expand Down
2 changes: 1 addition & 1 deletion install_scripts/nbs_create_multiarch_docker_builder.bash
Expand Up @@ -16,7 +16,7 @@ function nbs::create_multiarch_docker_builder() {
NBS_PATH=$(git rev-parse --show-toplevel)

# ....Load environment variables from file.......................................................
cd "${NBS_PATH}" || exit
cd "${NBS_PATH}" || exit 1
set -o allexport
source .env.nbs
set +o allexport
Expand Down
2 changes: 1 addition & 1 deletion install_scripts/nbs_install_docker_tools.bash
Expand Up @@ -17,7 +17,7 @@ function nbs::install_docker_tools() {
NBS_PATH=$(git rev-parse --show-toplevel)

# ....Load environment variables from file.......................................................
cd "${NBS_PATH}" || exit
cd "${NBS_PATH}" || exit 1
set -o allexport
source .env.nbs
set +o allexport
Expand Down
Expand Up @@ -46,7 +46,7 @@

# ....Pre-condition................................................................................
if [[ "$(basename "$(pwd)")" != "utility_scripts" ]]; then
echo -e "\n[\033[1;31mERROR\033[0m] 'nbs_execute_compose_over_build_matrix.bash' script must be executed from the 'norlab-build-system/src/utility_scripts/' directory!\n Curent working directory is '$(pwd)'"
echo -e "\n[\033[1;31mERROR\033[0m] 'nbs_execute_compose_over_build_matrix.bash' script must be executed from the 'norlab-build-system/src/utility_scripts/' directory!\n Curent working directory is '$(pwd)'" 1>&2
echo '(press any key to exit)'
read -r -n 1
exit 1
Expand Down
2 changes: 1 addition & 1 deletion src/utility_scripts/nbs_install_python_dev_tools.bash
Expand Up @@ -9,7 +9,7 @@ set -e

# ....Pre-condition................................................................................
if [[ "$(basename "$(pwd)")" != "utility_scripts" ]]; then
echo -e "\n[\033[1;31mERROR\033[0m] 'nbs_install_python_dev_tools.bash' script must be executed from the 'norlab-build-system/src/utility_scripts/' directory!\n Curent working directory is '$(pwd)'"
echo -e "\n[\033[1;31mERROR\033[0m] 'nbs_install_python_dev_tools.bash' script must be executed from the 'norlab-build-system/src/utility_scripts/' directory!\n Curent working directory is '$(pwd)'" 1>&2
echo '(press any key to exit)'
read -r -n 1
exit 1
Expand Down
Expand Up @@ -24,7 +24,7 @@ MSG_END_FORMAT="\033[0m"
function nbs::run_all_script_in_directory(){
local _TMP_CWD
_TMP_CWD=$(pwd)
cd "${SCRIPT_DIR_PATH}" || exit
cd "${SCRIPT_DIR_PATH}" || exit 1

declare -a FILE_NAME

Expand Down
4 changes: 2 additions & 2 deletions tests/tests_bats/test_import_lib.bats
Expand Up @@ -26,7 +26,7 @@ if [[ -d ${BATS_HELPER_PATH} ]]; then
load "${SRC_CODE_PATH}/${N2ST_BATS_TESTING_TOOLS_RELATIVE_PATH}/bats_helper_functions"
#load "${BATS_HELPER_PATH}/bats-detik/load" # << Kubernetes support
else
echo -e "\n[\033[1;31mERROR\033[0m] $0 path to bats-core helper library unreachable at \"${BATS_HELPER_PATH}\"!"
echo -e "\n[\033[1;31mERROR\033[0m] $0 path to bats-core helper library unreachable at \"${BATS_HELPER_PATH}\"!" 1>&2
echo '(press any key to exit)'
read -r -n 1
exit 1
Expand All @@ -48,7 +48,7 @@ setup_file() {

# executed before each test
setup() {
cd "$TESTED_FILE_PATH" || exit
cd "$TESTED_FILE_PATH" || exit 1
}

# ====Teardown=====================================================================================
Expand Down
Expand Up @@ -26,7 +26,7 @@ if [[ -d ${BATS_HELPER_PATH} ]]; then
load "${SRC_CODE_PATH}/${N2ST_BATS_TESTING_TOOLS_RELATIVE_PATH}/bats_helper_functions"
#load "${BATS_HELPER_PATH}/bats-detik/load" # << Kubernetes support
else
echo -e "\n[\033[1;31mERROR\033[0m] $0 path to bats-core helper library unreachable at \"${BATS_HELPER_PATH}\"!"
echo -e "\n[\033[1;31mERROR\033[0m] $0 path to bats-core helper library unreachable at \"${BATS_HELPER_PATH}\"!" 1>&2
echo '(press any key to exit)'
read -r -n 1
exit 1
Expand All @@ -50,7 +50,7 @@ setup_file() {
# executed before each test
setup() {
source import_norlab_build_system_lib.bash
cd "${SRC_CODE_PATH}/$TESTED_FILE_PATH" || exit
cd "${SRC_CODE_PATH}/$TESTED_FILE_PATH" || exit 1
}

# ====Teardown=====================================================================================
Expand Down Expand Up @@ -79,7 +79,7 @@ PATH_TO_DOCKERFILE="${SRC_CODE_PATH}"/build_system_templates/docker-compose.depe
# ....Test fct integration to script...............................................................
@test "${TESTED_FILE} › function ${TESTED_FCT} › integration in nbs_execute_compose_over_build_matrix.bash › execute ok › expect pass" {

cd "${SRC_CODE_PATH}/src/utility_scripts/" || exit
cd "${SRC_CODE_PATH}/src/utility_scripts/" || exit 1

DOTENV_BUILD_MATRIX="${SRC_CODE_PATH}"/build_system_templates/.env.build_matrix.dependencies.template
run bash "nbs_execute_compose_over_build_matrix.bash" "${DOTENV_BUILD_MATRIX}" --fail-fast -- build
Expand Down
Expand Up @@ -26,7 +26,7 @@ if [[ -d ${BATS_HELPER_PATH} ]]; then
load "${SRC_CODE_PATH}/${N2ST_BATS_TESTING_TOOLS_RELATIVE_PATH}/bats_helper_functions"
#load "${BATS_HELPER_PATH}/bats-detik/load" # << Kubernetes support
else
echo -e "\n[\033[1;31mERROR\033[0m] $0 path to bats-core helper library unreachable at \"${BATS_HELPER_PATH}\"!"
echo -e "\n[\033[1;31mERROR\033[0m] $0 path to bats-core helper library unreachable at \"${BATS_HELPER_PATH}\"!" 1>&2
echo '(press any key to exit)'
read -r -n 1
exit 1
Expand All @@ -49,7 +49,7 @@ setup_file() {
# executed before each test
setup() {
source import_norlab_build_system_lib.bash
cd "$TESTED_FILE_PATH" || exit
cd "$TESTED_FILE_PATH" || exit 1
}

# ====Teardown=====================================================================================
Expand Down
Expand Up @@ -26,7 +26,7 @@ if [[ -d ${BATS_HELPER_PATH} ]]; then
load "${SRC_CODE_PATH}/${N2ST_BATS_TESTING_TOOLS_RELATIVE_PATH}/bats_helper_functions"
#load "${BATS_HELPER_PATH}/bats-detik/load" # << Kubernetes support
else
echo -e "\n[\033[1;31mERROR\033[0m] $0 path to bats-core helper library unreachable at \"${BATS_HELPER_PATH}\"!"
echo -e "\n[\033[1;31mERROR\033[0m] $0 path to bats-core helper library unreachable at \"${BATS_HELPER_PATH}\"!" 1>&2
echo '(press any key to exit)'
read -r -n 1
exit 1
Expand Down Expand Up @@ -55,7 +55,7 @@ setup() {
cd "${SRC_CODE_PATH}"
source import_norlab_build_system_lib.bash

cd "$TESTED_FILE_PATH" || exit
cd "$TESTED_FILE_PATH" || exit 1
}

# ====Teardown=====================================================================================
Expand Down
Expand Up @@ -26,7 +26,7 @@ if [[ -d ${BATS_HELPER_PATH} ]]; then
load "${SRC_CODE_PATH}/${N2ST_BATS_TESTING_TOOLS_RELATIVE_PATH}/bats_helper_functions"
#load "${BATS_HELPER_PATH}/bats-detik/load" # << Kubernetes support
else
echo -e "\n[\033[1;31mERROR\033[0m] $0 path to bats-core helper library unreachable at \"${BATS_HELPER_PATH}\"!"
echo -e "\n[\033[1;31mERROR\033[0m] $0 path to bats-core helper library unreachable at \"${BATS_HELPER_PATH}\"!" 1>&2
echo '(press any key to exit)'
read -r -n 1
exit 1
Expand All @@ -49,7 +49,7 @@ setup_file() {

# executed before each test
setup() {
cd "$TESTED_FILE_PATH" || exit
cd "$TESTED_FILE_PATH" || exit 1
}

# ====Teardown=====================================================================================
Expand Down
Expand Up @@ -26,7 +26,7 @@ if [[ -d ${BATS_HELPER_PATH} ]]; then
load "${SRC_CODE_PATH}/${N2ST_BATS_TESTING_TOOLS_RELATIVE_PATH}/bats_helper_functions"
#load "${BATS_HELPER_PATH}/bats-detik/load" # << Kubernetes support
else
echo -e "\n[\033[1;31mERROR\033[0m] $0 path to bats-core helper library unreachable at \"${BATS_HELPER_PATH}\"!"
echo -e "\n[\033[1;31mERROR\033[0m] $0 path to bats-core helper library unreachable at \"${BATS_HELPER_PATH}\"!" 1>&2
echo '(press any key to exit)'
read -r -n 1
exit 1
Expand All @@ -48,7 +48,7 @@ setup_file() {

# executed before each test
setup() {
cd "$TESTED_FILE_PATH" || exit
cd "$TESTED_FILE_PATH" || exit 1
}

# ====Teardown=====================================================================================
Expand Down

0 comments on commit a674723

Please sign in to comment.