Make bash scripts exit on error rather than continue (#23467)

This commit is contained in:
Michael Telatynski 2022-10-12 16:15:51 +01:00 committed by GitHub
parent 0e8e472138
commit 341b0b469e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 4 deletions

View file

@ -6,7 +6,7 @@
# the branch the current checkout is on, use that branch. Otherwise, # the branch the current checkout is on, use that branch. Otherwise,
# use develop. # use develop.
set -ex set -x
GIT_CLONE_ARGS=("$@") GIT_CLONE_ARGS=("$@")
[ -z "$defbranch" ] && defbranch="develop" [ -z "$defbranch" ] && defbranch="develop"

View file

@ -25,6 +25,8 @@
# all phonenumber.js-supported country flags (as SVGs) into # all phonenumber.js-supported country flags (as SVGs) into
# PNGs that can be used by CountryDropdown.js. # PNGs that can be used by CountryDropdown.js.
set -e
# Allow CTRL+C to terminate the script # Allow CTRL+C to terminate the script
trap "echo Exited!; exit;" SIGINT SIGTERM trap "echo Exited!; exit;" SIGINT SIGTERM

View file

@ -3,6 +3,8 @@
# Echoes a version based on the git hashes of the element-web, react-sdk & js-sdk checkouts, for the case where # Echoes a version based on the git hashes of the element-web, react-sdk & js-sdk checkouts, for the case where
# these dependencies are git checkouts. # these dependencies are git checkouts.
set -e
# Since the deps are fetched from git, we can rev-parse # Since the deps are fetched from git, we can rev-parse
REACT_SHA=$(git -C node_modules/matrix-react-sdk rev-parse --short=12 HEAD) REACT_SHA=$(git -C node_modules/matrix-react-sdk rev-parse --short=12 HEAD)
JSSDK_SHA=$(git -C node_modules/matrix-js-sdk rev-parse --short=12 HEAD) JSSDK_SHA=$(git -C node_modules/matrix-js-sdk rev-parse --short=12 HEAD)

View file

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
set -x set -ex
# Creates a layered environment with the full repo for the app and SDKs cloned # Creates a layered environment with the full repo for the app and SDKs cloned
# and linked. This gives an element-web dev environment ready to build with # and linked. This gives an element-web dev environment ready to build with

View file

@ -12,8 +12,7 @@ then
exit exit
fi fi
set -e set -ex
set -x
tmpdir=`mktemp -d 2>/dev/null || mktemp -d -t 'icontmp'` tmpdir=`mktemp -d 2>/dev/null || mktemp -d -t 'icontmp'`

View file

@ -1,5 +1,7 @@
#!/bin/bash #!/bin/bash
set -e
# If $1 looks like v1.2.3 or v1.2.3-foo, strip the leading v, then print it to stdout # If $1 looks like v1.2.3 or v1.2.3-foo, strip the leading v, then print it to stdout
if [[ $1 =~ ^v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+(-.+)?$ ]]; then if [[ $1 =~ ^v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+(-.+)?$ ]]; then
echo ${1:1} echo ${1:1}