Skip to content

Commit

Permalink
add the possibility to disable exit on error via environment variable…
Browse files Browse the repository at this point in the history
… in a CI job
  • Loading branch information
SimeonEhrig authored and psychocoderHPC committed Aug 14, 2024
1 parent cdeae8a commit 2ed0f24
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
6 changes: 5 additions & 1 deletion script/gitlabci/print_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@

# set exit on error manually instead using setup_utilities because
# otherwise the begin of the job log looks not helpful
set -e
if [ -z ${alpaka_DISABLE_EXIT_FAILURE+x} ]; then
set -e
fi

# display output with yellow color
echo -e "\033[0;33mSteps to setup containter locally"
Expand Down Expand Up @@ -41,6 +43,8 @@ printenv | grep -E 'alpaka_*|ALPAKA_*|CMAKE_*|BOOST_|CC|CXX|CUDA_' | while read
echo "export $line \\"
done

# the variable is not set, but should be set if a job is debugged locally in a container
echo 'export alpaka_DISABLE_EXIT_FAILURE=true \'
echo 'export GITLAB_CI=true'
echo ""

Expand Down
9 changes: 8 additions & 1 deletion script/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,14 @@ then
then
set +eu
which ${CXX} || source /opt/intel/oneapi/setvars.sh
set -eu

# exit by default if the command does not return 0
# can be deactivated by setting the environment variable alpaka_DISABLE_EXIT_FAILURE
# for example for local debugging in a Docker container
if [ -z ${alpaka_DISABLE_EXIT_FAILURE+x} ]; then
set -e
fi
set -u
fi

which "${CXX}"
Expand Down
7 changes: 6 additions & 1 deletion script/setup_utilities.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
# if a bash script is normal called, self defined bash functions are not avaible from the calling bash instance


set -e
# exit by default if the command does not return 0
# can be deactivated by setting the environment variable alpaka_DISABLE_EXIT_FAILURE
# for example for local debugging in a Docker container
if [ -z ${alpaka_DISABLE_EXIT_FAILURE+x} ]; then
set -e
fi

# disable command traces for the following scripts to avoid useless noise in the job output
source ./script/setup_utilities/color_echo.sh
Expand Down
10 changes: 9 additions & 1 deletion script/setup_utilities/set.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,12 @@
# -u: treat unset variables as an error
# -v: Print shell input lines as they are read
# -x: Print command traces before executing command
set -eouvx pipefail

# exit by default if the command does not return 0
# can be deactivated by setting the environment variable alpaka_DISABLE_EXIT_FAILURE
# for example for local debugging in a Docker container
if [ -z ${alpaka_DISABLE_EXIT_FAILURE+x} ]; then
set -e
fi

set -ouvx pipefail

0 comments on commit 2ed0f24

Please sign in to comment.