ci: Remove use of cd

This commit is contained in:
MarcoFalke 2019-11-22 13:58:53 -05:00
parent fa2941bbf4
commit fad88e6f86
No known key found for this signature in database
GPG key ID: CE2B75697E69A548
3 changed files with 6 additions and 21 deletions

View file

@ -44,6 +44,8 @@ elif [[ $BITCOIN_CONFIG = *--with-sanitizers=*address* ]]; then # If ran with (A
DOCKER_ADMIN="--cap-add SYS_PTRACE" DOCKER_ADMIN="--cap-add SYS_PTRACE"
fi fi
export P_CI_DIR="$PWD"
if [ -z "$RUN_CI_ON_HOST" ]; then if [ -z "$RUN_CI_ON_HOST" ]; then
echo "Creating $DOCKER_NAME_TAG container to run in" echo "Creating $DOCKER_NAME_TAG container to run in"
${CI_RETRY_EXE} docker pull "$DOCKER_NAME_TAG" ${CI_RETRY_EXE} docker pull "$DOCKER_NAME_TAG"
@ -57,12 +59,12 @@ if [ -z "$RUN_CI_ON_HOST" ]; then
$DOCKER_NAME_TAG) $DOCKER_NAME_TAG)
DOCKER_EXEC () { DOCKER_EXEC () {
docker exec $DOCKER_ID bash -c "export PATH=$BASE_SCRATCH_DIR/bins/:\$PATH && cd $PWD && $*" docker exec $DOCKER_ID bash -c "export PATH=$BASE_SCRATCH_DIR/bins/:\$PATH && cd $P_CI_DIR && $*"
} }
else else
echo "Running on host system without docker wrapper" echo "Running on host system without docker wrapper"
DOCKER_EXEC () { DOCKER_EXEC () {
bash -c "export PATH=$BASE_SCRATCH_DIR/bins/:\$PATH && cd $PWD && $*" bash -c "export PATH=$BASE_SCRATCH_DIR/bins/:\$PATH && cd $P_CI_DIR && $*"
} }
fi fi

View file

@ -19,14 +19,8 @@ else
fi fi
END_FOLD END_FOLD
# Create folder on host and docker, so that `cd` works
mkdir -p build
DOCKER_EXEC mkdir -p build DOCKER_EXEC mkdir -p build
export P_CI_DIR="$P_CI_DIR/build"
# Temporarily disable errexit, because Travis macOS fails without error message
set +o errexit
cd build || (echo "could not enter build directory"; exit 1)
set -o errexit
BEGIN_FOLD configure BEGIN_FOLD configure
DOCKER_EXEC ../configure --cache-file=config.cache $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG || ( (DOCKER_EXEC cat config.log) && false) DOCKER_EXEC ../configure --cache-file=config.cache $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG || ( (DOCKER_EXEC cat config.log) && false)
@ -38,9 +32,7 @@ mkdir -p "bitcoin-$HOST"
DOCKER_EXEC make distdir VERSION=$HOST DOCKER_EXEC make distdir VERSION=$HOST
END_FOLD END_FOLD
set +o errexit export P_CI_DIR="$P_CI_DIR/bitcoin-$HOST"
cd "bitcoin-$HOST" || (echo "could not enter distdir bitcoin-$HOST"; exit 1)
set -o errexit
BEGIN_FOLD configure BEGIN_FOLD configure
DOCKER_EXEC ./configure --cache-file=../config.cache $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG || ( (DOCKER_EXEC cat config.log) && false) DOCKER_EXEC ./configure --cache-file=../config.cache $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG || ( (DOCKER_EXEC cat config.log) && false)
@ -52,7 +44,3 @@ trap 'DOCKER_EXEC "cat ${BASE_SCRATCH_DIR}/sanitizer-output/* 2> /dev/null"' ERR
BEGIN_FOLD build BEGIN_FOLD build
DOCKER_EXEC make $MAKEJOBS $GOAL || ( echo "Build failure. Verbose build follows." && DOCKER_EXEC make $GOAL V=1 ; false ) DOCKER_EXEC make $MAKEJOBS $GOAL || ( echo "Build failure. Verbose build follows." && DOCKER_EXEC make $GOAL V=1 ; false )
END_FOLD END_FOLD
set +o errexit
cd ${BASE_ROOT_DIR} || (echo "could not enter base root dir $BASE_ROOT_DIR"; exit 1)
set -o errexit

View file

@ -6,11 +6,6 @@
export LC_ALL=C.UTF-8 export LC_ALL=C.UTF-8
# Temporarily disable errexit, because Travis macOS fails without error message
set +o errexit
cd "build/bitcoin-$HOST" || (echo "could not enter distdir build/bitcoin-$HOST"; exit 1)
set -o errexit
if [ -n "$QEMU_USER_CMD" ]; then if [ -n "$QEMU_USER_CMD" ]; then
BEGIN_FOLD wrap-qemu BEGIN_FOLD wrap-qemu
echo "Prepare to run functional tests for HOST=$HOST" echo "Prepare to run functional tests for HOST=$HOST"