Change in docker-playground[master]: jenkins-common.sh: add docker_images_require()

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.org
Fri Oct 26 08:11:44 UTC 2018


osmith has submitted this change and it was merged. ( https://gerrit.osmocom.org/11365 )

Change subject: jenkins-common.sh: add docker_images_require()
......................................................................

jenkins-common.sh: add docker_images_require()

This new function can be used on top of each *-test/jenkins.sh to
automatically build the required Docker images before starting a
testsuite.

The top-level Makefile should also be able to build all Docker images
on which a job depends. But in that Makefile the list of dependencies
can not be specified dynamically, as it will be necessary for OS#3268:
ttcn3-mgw-test may depend on osmo-mgw-latest or on osmo-mgw-master.

This will be used by Idbb708ab16cb71bab5069127945b63388222369e.

Related: OS#3268
Change-Id: I0afdf3400282634fca9b31d57eaeedd6b5c28aa1
---
M jenkins-common.sh
1 file changed, 19 insertions(+), 0 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  osmith: Verified



diff --git a/jenkins-common.sh b/jenkins-common.sh
index 515479f..f3d6c61 100644
--- a/jenkins-common.sh
+++ b/jenkins-common.sh
@@ -1,3 +1,22 @@
+docker_image_exists() {
+	test -n "$(docker images -q "$REPO_USER/$1")"
+}
+
+docker_images_require() {
+	for i in $@; do
+		# Trigger image build (cache will be used when up-to-date)
+		if [ -z "$NO_DOCKER_IMAGE_BUILD" ]; then
+			echo "Building image: $i (export NO_DOCKER_IMAGE_BUILD=1 to prevent this)"
+			make -C "../$i"
+		fi
+
+		# Detect missing images (build skipped/failure)
+		if ! docker_image_exists "$i"; then
+			echo "ERROR: missing image: $i"
+			exit 1
+		fi
+	done
+}
 
 network_create() {
 	NET=$1

-- 
To view, visit https://gerrit.osmocom.org/11365
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: docker-playground
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I0afdf3400282634fca9b31d57eaeedd6b5c28aa1
Gerrit-Change-Number: 11365
Gerrit-PatchSet: 5
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181026/120e9c16/attachment.htm>


More information about the gerrit-log mailing list