osmith submitted this change.

View Change

Approvals: Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve pespin: Looks good to me, but someone else must approve osmith: Looks good to me, approved
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
---
M jenkins-common.sh
1 file 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 @@
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 @@

# 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_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_remove() {
- echo Removing network $NET_NAME
+ set +x
+ echo "Removing network $NET_NAME"
+ set -x
docker network remove $NET_NAME
}

@@ -238,7 +251,9 @@
}

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 @@
done

# Let clean_up_common kill the VM
+ set +x
echo "Timeout while waiting for kernel test VM"
exit 1
}
@@ -437,6 +453,7 @@
fi

if [ ! -d "$VOL_BASE_DIR" ]; then
+ set +x
echo "ERROR: \$VOL_BASE_DIR does not exist: '$VOL_BASE_DIR'"
exit 1
fi

To view, visit change 30766. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: docker-playground
Gerrit-Branch: master
Gerrit-Change-Id: I213cb80bd1d9401281ae1fb7394b2319453550dd
Gerrit-Change-Number: 30766
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>
Gerrit-MessageType: merged