This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
osmith gerrit-no-reply at lists.osmocom.orgosmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/docker-playground/+/18553 )
Change subject: jenkins-common.sh: add DISTRO environment variable
......................................................................
jenkins-common.sh: add DISTRO environment variable
Set DISTRO and DOCKER_TAG, based on the DISTRO environment variable.
Defaults are debian-stretch and latest, and if DISTRO is centos8,
DOCKER_TAG is also changed to centos8 to avoid collisions.
Related: OS#4564
Change-Id: I598a262fe1a7ed4dd89e13c53e4ded103c6e3b91
---
M jenkins-common.sh
1 file changed, 31 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/docker-playground refs/changes/53/18553/1
diff --git a/jenkins-common.sh b/jenkins-common.sh
index 9fd3857..a34e115 100644
--- a/jenkins-common.sh
+++ b/jenkins-common.sh
@@ -1,7 +1,23 @@
+# Environment variables:
+# * DISTRO: linux distribution name (e.g. "debian-stretch", "centos8"). Defaults to "debian-stretch". This is passed as
+# argument to the Dockerfiles. Also a DOCKER_TAG is set ("latest" for "debian-stretch", otherwise the
+# distribution name), so images built for two different distributions don't both get tagged as "latest".
+
docker_image_exists() {
test -n "$(docker images -q "$REPO_USER/$1")"
}
+docker_get_tag() {
+ case "$DISTRO" in
+ debian-stretch)
+ echo "latest"
+ ;;
+ centos8)
+ echo "centos8"
+ ;;
+ esac
+}
+
docker_images_require() {
local from_line
local pull_arg
@@ -16,13 +32,17 @@
pull_arg=""
fi
- echo "Building image: $i (export NO_DOCKER_IMAGE_BUILD=1 to prevent this)"
- PULL="$pull_arg" make -C "../$i" || exit 1
+ echo "Building image: $i:$DOCKER_TAG (export NO_DOCKER_IMAGE_BUILD=1 to prevent this)"
+ make -C "../$i" \
+ PULL="$pull_arg" \
+ DISTRO="$DISTRO" \
+ DOCKER_TAG="$DOCKER_TAG" \
+ || exit 1
fi
# Detect missing images (build skipped)
- if ! docker_image_exists "$i"; then
- echo "ERROR: missing image: $i"
+ if ! docker_image_exists "$i:$DOCKER_TAG"; then
+ echo "ERROR: missing image: $i:$DOCKER_TAG"
exit 1
fi
done
@@ -96,3 +116,10 @@
SUITE_NAME=`basename $PWD`
NET_NAME=$SUITE_NAME
+
+DISTRO="${DISTRO:-debian-stretch}"
+DOCKER_TAG="$(docker_get_tag)"
+if [ -z "$DOCKER_TAG" ]; then
+ echo "ERROR: failed to translate DISTRO=$DISTRO to docker tag!"
+ exit 1
+fi
--
To view, visit https://gerrit.osmocom.org/c/docker-playground/+/18553
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: docker-playground
Gerrit-Branch: master
Gerrit-Change-Id: I598a262fe1a7ed4dd89e13c53e4ded103c6e3b91
Gerrit-Change-Number: 18553
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200528/19b9dd80/attachment.htm>