diff options
author | Oliver Smith <osmith@sysmocom.de> | 2022-12-21 18:54:05 +0100 |
---|---|---|
committer | Oliver Smith <osmith@sysmocom.de> | 2022-12-22 13:26:41 +0100 |
commit | 0974da58cdd1ccc30797aa65a9eedd1c1ab120e0 (patch) | |
tree | 37045b86f0d81de2b240e4c68b4806b4358e6b4f | |
parent | a47ab326c5fd500de1a648f14c80b4a45759f787 (diff) |
jenkins-common: tweak echo messages
Use 'set +x' before echo, so messages are not printed twice and the
output becomes more readable.
Example:
+ echo Creating network ttcn3-bts-test
Creating network ttcn3-bts-test
Related: OS#5802
Change-Id: I213cb80bd1d9401281ae1fb7394b2319453550dd
-rw-r--r-- | jenkins-common.sh | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/jenkins-common.sh b/jenkins-common.sh index 33b1a67..3a30ea0 100644 --- a/jenkins-common.sh +++ b/jenkins-common.sh @@ -168,7 +168,9 @@ docker_images_require() { pull_arg="" fi + set +x echo "Building image: $i (export NO_DOCKER_IMAGE_BUILD=1 to prevent this)" + set -x make -C "${IMAGE_DIR_PREFIX}/${dir}" \ BUILD_ARGS="$pull_arg" \ UPSTREAM_DISTRO="$upstream_distro_arg" \ @@ -179,6 +181,7 @@ docker_images_require() { # Detect missing images (build skipped) if ! docker_image_exists "$i"; then + set +x echo "ERROR: missing image: $i" exit 1 fi @@ -195,26 +198,34 @@ network_clean() { network_create() { NET=$1 if docker network ls | grep -q $NET_NAME; then - echo removing stale network and containers... + set +x + echo "Removing stale network and containers..." + set -x network_clean network_remove fi SUB4="172.18.$NET.0/24" SUB6="fd02:db8:$NET::/64" - echo Creating network $NET_NAME + set +x + echo "Creating network $NET_NAME" + set -x docker network create --internal --subnet $SUB4 --ipv6 --subnet $SUB6 $NET_NAME } network_bridge_create() { NET=$1 if docker network ls | grep -q $NET_NAME; then - echo removing stale network and containers... + set +x + echo "Removing stale network and containers..." + set -x network_clean network_remove fi SUB4="172.18.$NET.0/24" SUB6="fd02:db8:$NET::/64" - echo Creating network $NET_NAME + set +x + echo "Creating network $NET_NAME" + set -x docker network create \ --driver=bridge \ --subnet $SUB4 \ @@ -224,7 +235,9 @@ network_bridge_create() { } network_remove() { - echo Removing network $NET_NAME + set +x + echo "Removing network $NET_NAME" + set -x docker network remove $NET_NAME } @@ -238,7 +251,9 @@ docker_network_params() { } fix_perms() { - echo Fixing permissions + set +x + echo "Fixing permissions" + set -x docker run --rm \ -v $VOL_BASE_DIR:/data \ -v $CACHE_DIR:/cache \ @@ -360,6 +375,7 @@ kernel_test_wait_for_vm() { done # Let clean_up_common kill the VM + set +x echo "Timeout while waiting for kernel test VM" exit 1 } @@ -437,6 +453,7 @@ else fi if [ ! -d "$VOL_BASE_DIR" ]; then + set +x echo "ERROR: \$VOL_BASE_DIR does not exist: '$VOL_BASE_DIR'" exit 1 fi |