Change in docker-playground[master]: docker_images_require: list installed Osmocom pkgs

osmith gerrit-no-reply at lists.osmocom.org
Wed Apr 7 08:47:31 UTC 2021


osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/docker-playground/+/23664 )


Change subject: docker_images_require: list installed Osmocom pkgs
......................................................................

docker_images_require: list installed Osmocom pkgs

Display an overview of installed Osmocom packages at the start of each
ttcn3-*/jenkins.sh script (and others making use of
docker_images_require).

Closes: OS#5091
Change-Id: I62670017d790fd67c6a0d8d464386c0f8e94c1a8
---
M jenkins-common.sh
1 file changed, 38 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/docker-playground refs/changes/64/23664/1

diff --git a/jenkins-common.sh b/jenkins-common.sh
index 6c27fae..67a467d 100644
--- a/jenkins-common.sh
+++ b/jenkins-common.sh
@@ -39,6 +39,40 @@
 	esac
 }
 
+# $1: distro name, from docker_distro_from_image_name()
+# $2: docker image name (without $REPO_USER/ prefix)
+list_osmo_packages() {
+	local distro="$1"
+	local image="$2"
+	local docker_run_sh="docker run --rm --entrypoint=/bin/sh $REPO_USER/$image -c"
+
+	# Don't run on all images
+	case "$image" in
+	osmo-*) ;;
+	*) return ;;
+	esac
+
+	set +x
+	echo
+	echo "### Installed Osmocom packages in: $image ###"
+	echo
+
+	case "$distro" in
+	centos*)
+		$docker_run_sh "rpm -qa | grep osmo"
+		;;
+	debian*)
+		$docker_run_sh "dpkg -l | grep osmo"
+		;;
+	*)
+		echo "ERROR: don't know how to list installed packages for distro=$distro"
+		;;
+	esac
+
+	echo
+	set -x
+}
+
 # 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
@@ -67,10 +101,11 @@
 			docker_images_require $depends
 		fi
 
+		distro_arg="$(docker_distro_from_image_name "$i")"
+
 		# Trigger image build (cache will be used when up-to-date)
 		if [ -z "$NO_DOCKER_IMAGE_BUILD" ]; then
 			upstream_distro_arg="$(docker_upstream_distro_from_image_name "$i")"
-			distro_arg="$(docker_distro_from_image_name "$i")"
 			dir="$(docker_dir_from_image_name "$i")"
 
 			# Pull upstream base images
@@ -94,6 +129,8 @@
 			echo "ERROR: missing image: $i"
 			exit 1
 		fi
+
+		list_osmo_packages "$distro_arg" "$i"
 	done
 }
 

-- 
To view, visit https://gerrit.osmocom.org/c/docker-playground/+/23664
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: docker-playground
Gerrit-Branch: master
Gerrit-Change-Id: I62670017d790fd67c6a0d8d464386c0f8e94c1a8
Gerrit-Change-Number: 23664
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/20210407/c633adad/attachment.htm>


More information about the gerrit-log mailing list