Change in osmo-ci[master]: repo-install-test: move from docker-playground

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
Wed May 27 10:35:05 UTC 2020


osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ci/+/18509 )


Change subject: repo-install-test: move from docker-playground
......................................................................

repo-install-test: move from docker-playground

Prepare the repo-install-test to be extended to cover centos8 as well.
Move the scripts to osmo-ci.git first, so we can mount them as shared
files into the docker containers from here.

Move files without any changes. Integration will be done in a follow-up
commit, so we have a clean git log.

debian-repo-install-test/jenkins.sh
	=> scripts/repo-install-test.sh
debian-repo-install-test/testdata/blacklist.txt
	=> scripts/repo-install-test/blacklist.txt
debian-repo-install-test/testdata/repo-install-test.sh
	=> scripts/repo-install-test/run-inside-docker.sh

Related: OS#4563
Related: If93f37e8d46597a9abc67a4529be9addd65780f5 (docker-playground)
Change-Id: Ia678cc15e66630bd6b75b6c89bc75c1e27afd66c
---
A scripts/repo-install-test.sh
A scripts/repo-install-test/blacklist.txt
A scripts/repo-install-test/run-inside-docker.sh
3 files changed, 231 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/09/18509/1

diff --git a/scripts/repo-install-test.sh b/scripts/repo-install-test.sh
new file mode 100755
index 0000000..c0c38c5
--- /dev/null
+++ b/scripts/repo-install-test.sh
@@ -0,0 +1,58 @@
+#!/bin/sh
+. ../jenkins-common.sh
+docker_images_require "debian-repo-install-test"
+
+[ -z "$FEED" ] && FEED="nightly"
+CONTAINER="repo-install-test-$FEED"
+
+# Try to run "systemctl status" 10 times, kill the container on failure
+check_if_systemd_is_running() {
+	for i in $(seq 1 10); do
+		sleep 1
+		if docker exec "$CONTAINER" systemctl status; then
+			return
+		fi
+	done
+
+	echo "ERROR: systemd is not running properly."
+	docker container kill "$CONTAINER"
+	exit 1
+}
+
+# Kill already running container
+if [ "$(docker inspect -f '{{.State.Running}}' "$CONTAINER" 2> /dev/null)" = "true" ]; then
+	docker container kill "$CONTAINER"
+	sleep 1
+fi
+
+# Run the container
+# * This does not output anything, for debugging add -it and remove &.
+# * /run, /tmp, cgroups, SYS_ADMIN: needed for systemd
+# * SYS_NICE: needed for changing CPUScheduling{Policy,Priority} (osmo-bts systemd service files)
+docker run	--rm \
+		-v "$PWD/testdata:/testdata:ro" \
+		-v "$VOL_BASE_DIR:/data" \
+		--name "$CONTAINER" \
+		-e FEED="$FEED" \
+		-e container=docker \
+		--tmpfs /run \
+		--tmpfs /tmp \
+		-v /sys/fs/cgroup:/sys/fs/cgroup:ro \
+		--cap-add SYS_ADMIN \
+		--cap-add SYS_NICE \
+		"$REPO_USER/debian-repo-install-test" \
+		/lib/systemd/systemd &
+check_if_systemd_is_running
+
+# Run the test script
+docker exec "$CONTAINER" /testdata/repo-install-test.sh
+ret="$?"
+
+# Interactive shell
+if [ -n "$INTERACTIVE" ]; then
+	docker exec -it "$CONTAINER" bash
+fi
+
+docker container kill "$CONTAINER"
+
+exit $ret
diff --git a/scripts/repo-install-test/blacklist.txt b/scripts/repo-install-test/blacklist.txt
new file mode 100644
index 0000000..cb7db6a
--- /dev/null
+++ b/scripts/repo-install-test/blacklist.txt
@@ -0,0 +1,27 @@
+# These packages will not get explicitly installed in this test.
+# Package lines must have nothing but the package (no comment,
+# no additional space etc).
+
+# OpenBSC
+# This is legacy, we aren't really interested in testing openbsc.git
+# derived packages. Packages are found in openbsc/debian/control.
+openbsc-dev
+osmo-bsc-mgcp
+osmo-bsc-mgcp-dbg
+osmocom-bs11-utils
+osmocom-bs11-utils-dbg
+osmocom-bsc-nat
+osmocom-bsc-nat-dbg
+osmocom-bsc-sccplite
+osmocom-bsc-sccplite-dbg
+osmocom-ipaccess-utils
+osmocom-ipaccess-utils-dbg
+osmocom-nitb
+osmocom-nitb-dbg
+
+# SoapySDR is not used anymore (see OS#3542)
+soapysdr-module-lms7
+soapysdr0.6-module-lms7
+soapysdr0.6-module-lms7-dbgsym
+soapysdr0.7-module-lms7
+soapysdr0.7-module-lms7-dbgsym
diff --git a/scripts/repo-install-test/run-inside-docker.sh b/scripts/repo-install-test/run-inside-docker.sh
new file mode 100755
index 0000000..63e1819
--- /dev/null
+++ b/scripts/repo-install-test/run-inside-docker.sh
@@ -0,0 +1,146 @@
+#!/bin/sh -ex
+
+# Systemd services that must start up successfully after installing all packages (OS#3369)
+# Disabled services:
+# * osmo-ctrl2cgi (missing config: /etc/osmocom/ctrl2cgi.ini, OS#4108)
+# * osmo-trap2cgi (missing config: /etc/osmocom/%N.ini, OS#4108)
+# * osmo-ggsn (no tun device in docker)
+SERVICES="
+	osmo-bsc
+	osmo-gbproxy
+	osmo-gtphub
+	osmo-hlr
+	osmo-mgw
+	osmo-msc
+	osmo-pcap-client
+	osmo-sip-connector
+	osmo-stp
+"
+# Services working in nightly, but not yet in latest
+# * osmo-pcap-server: service not included in osmo-pcap 0.0.11
+# * osmo-sgsn: conflicts with osmo-gtphub config in osmo-sgsn 1.4.0
+# * osmo-pcu: needs osmo-bts-virtual to start up properly
+# * osmo-hnbgw: tries to listen on 10.23.24.1 in osmo-iuh 0.4.0
+# * osmo-bts-virtual: unit id not matching osmo-bsc's config in osmo-bsc 1.4.0
+SERVICES_NIGHTLY="
+	osmo-pcap-server
+	osmo-sgsn
+	osmo-pcu
+	osmo-hnbgw
+	osmo-bts-virtual
+"
+
+HTTP="http://download.opensuse.org/repositories/network:/osmocom:/$FEED/Debian_9.0/"
+OBS="obs://build.opensuse.org/network:osmocom:$FEED/Debian_9.0"
+
+check_env() {
+	if [ -n "$FEED" ]; then
+		echo "Checking feed: $FEED"
+	else
+		echo "ERROR: missing environment variable \$FEED!"
+		exit 1
+	fi
+}
+
+configure_osmocom_repo() {
+	echo "Configuring Osmocom repository"
+	echo "deb $HTTP ./" \
+		> /etc/apt/sources.list.d/osmocom-latest.list
+	apt-get update
+}
+
+install_repo_packages() {
+	echo "Installing all repository packages"
+
+	# Get a list of all packages from the repository. Reference:
+	# https://www.debian.org/doc/manuals/aptitude/ch02s04s05.en.html
+	aptitude search -F%p \
+		"?origin($OBS) ?architecture(native)" | sort \
+		> /data/osmocom_packages_all.txt
+
+	# Remove comments from blacklist.txt (and sort it)
+	grep -v "^#" /testdata/blacklist.txt | sort -u > /data/blacklist.txt
+
+	# Install all repo packages which are not on the blacklist
+	comm -23 /data/osmocom_packages_all.txt \
+		/data/blacklist.txt > /data/osmocom_packages.txt
+	apt install -y $(cat /data/osmocom_packages.txt)
+}
+
+test_binaries_version() {
+	# Make sure --version runs and does not output UNKNOWN
+	failed=""
+	for program in $@; do
+		# Make sure it runs at all
+		$program --version
+
+		# Check for UNKNOWN
+		if $program --version | grep -q UNKNOWN; then
+			failed="$failed $program"
+			echo "ERROR: this program prints UNKNOWN in --version!"
+		fi
+	done
+
+	if [ -n "$failed" ]; then
+		echo "ERROR: the following program(s) print UNKNOWN in --version:"
+		echo "$failed"
+		return 1
+	fi
+}
+
+test_binaries() {
+	# Make sure that binares run at all and output a proper version
+	test_binaries_version \
+		osmo-bsc \
+		osmo-bts-trx \
+		osmo-bts-virtual \
+		osmo-gbproxy \
+		osmo-gtphub \
+		osmo-ggsn \
+		osmo-hlr \
+		osmo-hlr-db-tool \
+		osmo-hnbgw \
+		osmo-mgw \
+		osmo-msc \
+		osmo-pcu \
+		osmo-sgsn \
+		osmo-sip-connector \
+		osmo-stp \
+		osmo-trx-uhd \
+		osmo-trx-usrp1
+}
+
+services_check() {
+	local service
+	local services_feed="$SERVICES"
+	local failed=""
+
+	if [ "$FEED" = "nightly" ]; then
+		services_feed="$services_feed $SERVICES_NIGHTLY"
+	fi
+
+	systemctl start $services_feed
+	sleep 2
+
+	for service in $services_feed; do
+		if ! systemctl --no-pager -l -n 200 status $service; then
+			failed="$failed $service"
+		fi
+	done
+
+	systemctl stop $services_feed
+
+	if [ -n "$failed" ]; then
+		set +x
+		echo
+		echo "ERROR: services failed to start: $failed"
+		echo
+		exit 1
+	fi
+}
+
+check_env
+configure_osmocom_repo
+install_repo_packages
+test_binaries
+services_check

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/18509
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: Ia678cc15e66630bd6b75b6c89bc75c1e27afd66c
Gerrit-Change-Number: 18509
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/20200527/009efaab/attachment.htm>


More information about the gerrit-log mailing list