diff --git a/.bumpversion.cfg b/.bumpversion.cfg index a8bb1486f91f4ed80e82be6a22b753a6b2cb9324..55417e9f3f8a3eca9da8ba84c4951cb763fc0f3c 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -11,4 +11,3 @@ search = <version>{current_version}</version><!-- BUMP_VERSION --> replace = <version>{new_version}</version><!-- BUMP_VERSION --> [bumpversion:file:hbp.yml] - diff --git a/build.sh b/build.sh index 4573daa4af9a974c37449c7f099a7730eb1a29b1..927b578b1d058e544dcff2884db810707aa95eb9 100755 --- a/build.sh +++ b/build.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash -set -e + +set -o pipefail # trace ERR through pipes +set -o errtrace # trace ERR through 'time command' and other functions +set -o errexit ## set -e : exit the script if any statement returns a non-true return value get_script_dir () { SOURCE="${BASH_SOURCE[0]}" @@ -13,19 +16,17 @@ get_script_dir () { pwd } -if pgrep -lf sshuttle > /dev/null ; then - echo "sshuttle detected. Please close this program as it messes with networking and prevents builds inside Docker to work" - exit 1 -fi +cd "$(get_script_dir)" -if groups $USER | grep &>/dev/null '\bdocker\b'; then +if [[ $NO_SUDO || -n "$CIRCLECI" ]]; then + CAPTAIN="captain" +elif groups $USER | grep &>/dev/null '\bdocker\b'; then CAPTAIN="captain" else CAPTAIN="sudo captain" fi -BUILD_DATE=$(date --iso-8601=seconds) \ +BUILD_DATE=$(date -Iseconds) \ VCS_REF=$(git describe --tags --dirty) \ VERSION=$(git describe --tags --dirty) \ - WORKSPACE=$(get_script_dir) \ $CAPTAIN build