travis-ci: use 'set -e' in the 32 bit Linux build job
The script 'ci/run-linux32-build.sh' running inside the Docker container of the 32 bit Linux build job uses an && chain to break the build if one of the commands fails. This is problematic for two reasons: - The && chain is broken, because there is this in the middle: test -z $HOST_UID || (CI_USER="ci" && useradd -u $HOST_UID $CI_USER) && Luckily it is broken in a way that it didn't lead to false successes. If installing dependencies fails, then the rest of the first && chain is skipped and execution resumes after the || operator. At that point $HOST_UID is still unset, causing 'useradd' to error out with "invalid user ID 'ci'", which in turn causes the second && chain to abort the script and thus break the build. - All other 'ci/*' scripts use 'set -e' to break the build if one of the commands fails. This inconsistency among these scripts is asking for trouble: I forgot about the && chain more than once while working on this patch series. Enable 'set -e' for the whole script and for the commands executed under 'su' as well. While touching every line in the 'su' command block anyway, change their indentation to use a tab instead of spaces. Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
f63b12392a
commit
04d47e969a
@ -6,29 +6,29 @@
|
|||||||
# run-linux32-build.sh [host-user-id]
|
# run-linux32-build.sh [host-user-id]
|
||||||
#
|
#
|
||||||
|
|
||||||
set -x
|
set -ex
|
||||||
|
|
||||||
# Update packages to the latest available versions
|
# Update packages to the latest available versions
|
||||||
linux32 --32bit i386 sh -c '
|
linux32 --32bit i386 sh -c '
|
||||||
apt update >/dev/null &&
|
apt update >/dev/null &&
|
||||||
apt install -y build-essential libcurl4-openssl-dev libssl-dev \
|
apt install -y build-essential libcurl4-openssl-dev libssl-dev \
|
||||||
libexpat-dev gettext python >/dev/null
|
libexpat-dev gettext python >/dev/null
|
||||||
' &&
|
'
|
||||||
|
|
||||||
# If this script runs inside a docker container, then all commands are
|
# If this script runs inside a docker container, then all commands are
|
||||||
# usually executed as root. Consequently, the host user might not be
|
# usually executed as root. Consequently, the host user might not be
|
||||||
# able to access the test output files.
|
# able to access the test output files.
|
||||||
# If a host user id is given, then create a user "ci" with the host user
|
# If a host user id is given, then create a user "ci" with the host user
|
||||||
# id to make everything accessible to the host user.
|
# id to make everything accessible to the host user.
|
||||||
HOST_UID=$1 &&
|
HOST_UID=$1
|
||||||
CI_USER=$USER &&
|
CI_USER=$USER
|
||||||
test -z $HOST_UID || (CI_USER="ci" && useradd -u $HOST_UID $CI_USER) &&
|
test -z $HOST_UID || (CI_USER="ci" && useradd -u $HOST_UID $CI_USER)
|
||||||
|
|
||||||
# Build and test
|
# Build and test
|
||||||
linux32 --32bit i386 su -m -l $CI_USER -c '
|
linux32 --32bit i386 su -m -l $CI_USER -c '
|
||||||
set -x &&
|
set -ex
|
||||||
cd /usr/src/git &&
|
cd /usr/src/git
|
||||||
ln -s /tmp/travis-cache/.prove t/.prove &&
|
ln -s /tmp/travis-cache/.prove t/.prove
|
||||||
make --jobs=2 &&
|
make --jobs=2
|
||||||
make --quiet test
|
make --quiet test
|
||||||
'
|
'
|
||||||
|
Loading…
Reference in New Issue
Block a user