Skip to content

Commit b2a7e14

Browse files
authored
[DAPS-1551] ci job fail correctly on failed curl (#1556)
* fix: add set -o pipefail to ensure failed curl command correctly cause job failure. * fix: addition of --fail flag to curl command to trigger script error propagation.
1 parent 2ab4dd9 commit b2a7e14

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

scripts/dependency_install_functions.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ source "${SOURCE}/dependency_versions.sh"
55
PROJECT_ROOT=$(realpath "${SOURCE}/..")
66
source "${SOURCE}/utils.sh"
77

8+
# Ensures the shell returns the exit code of the first failed command in a pipeline
9+
set -o pipefail
10+
811
sudo_command
912
# these are the dependencies to be installed by apt
1013
export apt_file_path="${PROJECT_ROOT}/tmp/apt_deps"
@@ -458,7 +461,8 @@ install_nvm() {
458461
# will use it to set the install path
459462
export NVM_DIR="${DATAFED_DEPENDENCIES_INSTALL_PATH}/nvm"
460463
mkdir -p "${NVM_DIR}"
461-
curl -o- "https://raw.githubusercontent.com/nvm-sh/nvm/${DATAFED_NVM_VERSION}/install.sh" | bash
464+
# --fail makes curl return a non-zero exit code for HTTP errors like 404 or 500.
465+
curl --fail -o- "https://raw.githubusercontent.com/nvm-sh/nvm/${DATAFED_NVM_VERSION}/install.sh" | bash
462466
# Mark nvm as installed
463467
touch "${DATAFED_DEPENDENCIES_INSTALL_PATH}/${NVM_FLAG_PREFIX}${DATAFED_NVM_VERSION}"
464468
else

0 commit comments

Comments
 (0)