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 submitted this change. ( https://gerrit.osmocom.org/c/docker-playground/+/18553 )
Change subject: jenkins-common.sh: support osmo-*-centos8 images
......................................................................
jenkins-common.sh: support osmo-*-centos8 images
Make it possible to call the ttcn3-*/jenkins.sh scripts with:
IMAGE_SUFFIX="master-centos8"
The existing docker_images_require lines of these jenkins.sh scripts
will then call docker_images_require with arguments like
"osmo-mgw-master-centos8". For example, from ttcn3-mgw-test/jenkins.sh:
docker_images_require \
"osmo-mgw-$IMAGE_SUFFIX" \
"ttcn3-mgw-test"
Let docker_images_require build the image from
osmo-mgw-master/Dockerfile (-centos8 is cut off from the dirname) and
with DISTRO=centos8 as argument.
Collisions with the debian-stretch images are avoided by setting IMAGE
to the full image name (e.g. osmo-mgw-master-centos8).
Related: OS#4564
Change-Id: I598a262fe1a7ed4dd89e13c53e4ded103c6e3b91
---
M jenkins-common.sh
1 file changed, 34 insertions(+), 2 deletions(-)
Approvals:
laforge: Looks good to me, approved
fixeria: Looks good to me, but someone else must approve
osmith: Verified
diff --git a/jenkins-common.sh b/jenkins-common.sh
index ea03d52..a29720c 100644
--- a/jenkins-common.sh
+++ b/jenkins-common.sh
@@ -4,16 +4,41 @@
docker_depends() {
case "$1" in
+ osmo-*-centos8) echo "centos8-build" ;;
osmo-*) echo "debian-stretch-build" ;;
ttcn3-*) echo "debian-stretch-titan" ;;
esac
}
+docker_distro_from_image_name() {
+ case "$1" in
+ osmo-*-centos8) echo "centos8"; ;;
+ *) echo "debian-stretch" ;;
+ esac
+
+}
+
+docker_dir_from_image_name() {
+ case "$1" in
+ osmo-*-centos8) echo "$1" | sed 's/\-centos8$//' ;;
+ *) echo "$1" ;;
+ esac
+}
+
+# Make sure required images are available and build them if necessary.
+# $*: image names (e.g. "debian-stretch-build", "osmo-mgw-master", "osmo-mgw-master-centos8")
+# The images are automatically built from the Dockerfile of the subdir of the same name. If there is a
+# distribution name at the end of the image name (e.g. osmo-mgw-master-centos8), it gets removed from the subdir
+# where the Dockerfile is taken from (e.g. osmo-mgw-master/Dockerfile) and DISTRO is passed accordingly
+# (e.g. DISTRO=centos8). This allows one Dockerfile for multiple distributions, without duplicating configs for
+# each distribution. Dependencies listed in docker_depends() are built automatically too.
docker_images_require() {
local i
local from_line
local pull_arg
+ local distro_arg
local depends
+ local dir
for i in $@; do
# Build dependencies first
@@ -24,15 +49,22 @@
# Trigger image build (cache will be used when up-to-date)
if [ -z "$NO_DOCKER_IMAGE_BUILD" ]; then
+ distro_arg="$(docker_distro_from_image_name "$i")"
+ dir="$(docker_dir_from_image_name "$i")"
+
# Pull upstream base images
pull_arg="--pull"
- from_line="$(grep '^FROM' ../$i/Dockerfile)"
+ from_line="$(grep '^FROM' ../$dir/Dockerfile)"
if echo "$from_line" | grep -q '$USER'; then
pull_arg=""
fi
echo "Building image: $i (export NO_DOCKER_IMAGE_BUILD=1 to prevent this)"
- PULL="$pull_arg" make -C "../$i" || exit 1
+ make -C "../$dir" \
+ PULL="$pull_arg" \
+ DISTRO="$distro_arg" \
+ IMAGE="$REPO_USER/$i" \
+ || exit 1
fi
# Detect missing images (build skipped)
--
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: 5
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200530/43d7eba2/attachment.htm>