pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/docker-playground/+/31623 )
Change subject: Introduce debian-bullseye-titan-master ......................................................................
Introduce debian-bullseye-titan-master
This Dockerfile allows building a given repo and branch of titan.core.git which can then be used by any ttcn-*-test/ environment by simply changing its Dockerfile "FROM" line from $REGISTRY/$USER/debian-bullseye-titan to $REGISTRY/$USER/debian-bullseye-titan-mater.
This is useful to debug or develop titan.core or test whether a given testsuite works fine with a newer version of titan.core.
Change-Id: I19ee98a319ccad167d06c4f183fe80ecac909483 --- A debian-bullseye-titan-master/Dockerfile A debian-bullseye-titan-master/Makefile A debian-bullseye-titan-master/ttcn3-docker-prepare.sh A debian-bullseye-titan-master/ttcn3-docker-run.sh 4 files changed, 215 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/docker-playground refs/changes/23/31623/1
diff --git a/debian-bullseye-titan-master/Dockerfile b/debian-bullseye-titan-master/Dockerfile new file mode 100644 index 0000000..2671fa8 --- /dev/null +++ b/debian-bullseye-titan-master/Dockerfile @@ -0,0 +1,115 @@ +ARG REGISTRY=docker.io +ARG UPSTREAM_DISTRO=debian:bullseye +FROM ${REGISTRY}/${UPSTREAM_DISTRO} +# Arguments used after FROM must be specified again +ARG OSMOCOM_REPO_TESTSUITE_MIRROR="https://downloads.osmocom.org" +ARG OSMOCOM_REPO="$OSMOCOM_REPO_TESTSUITE_MIRROR/packages/osmocom:/latest/Debian_11/" + +RUN apt-get update && apt-get install -y \ + ca-certificates \ + gnupg + +COPY .common/Release.key /usr/share/keyrings/osmocom-latest.asc +RUN echo "deb [signed-by=/usr/share/keyrings/osmocom-latest.asc] $OSMOCOM_REPO ./" \ + > /etc/apt/sources.list.d/osmocom-latest.list + +RUN apt-get update && \ + apt-get upgrade -y && \ + DEBIAN_FRONTEND='noninteractive' apt-get install -y --no-install-recommends --no-install-suggests \ + build-essential \ + git \ + inetutils-ping \ + netcat-openbsd \ + procps \ + python3-pip \ + python3-setuptools \ + tcpdump \ + vim \ + wireshark-common \ + && \ + apt-get clean + +#Install titan.core dependencies listed in debian/control: +RUN apt-get update && \ + apt-get upgrade -y && \ + DEBIAN_FRONTEND='noninteractive' apt-get install -y --no-install-recommends --no-install-suggests \ + bison \ + debhelper \ + default-jdk \ + expect \ + flex \ + libedit-dev \ + libncurses5-dev \ + libssl-dev \ + libxml2-dev \ + expect \ + libedit-dev \ + libpcap-dev \ + libpcre3-dev \ + libsctp-dev \ + libssl-dev \ + libxml2-dev \ + make \ + perl \ + python3 \ + gcc \ + && \ + apt-get clean + +# Remember to adapt the URL fetching /root/titan.core-ver.json if TITAN_REPO_URL is changed! +ARG TITAN_REPO_URL=https://gitlab.eclipse.org/eclipse/titan/titan.core.git +ARG TITAN_BRANCH=master +ARG TITAN_REPO_DIR=titan.core +# clone titan.core.git +RUN git clone $TITAN_REPO_URL + +ADD https://gitlab.eclipse.org/api/v4/projects/eclipse%2Ftitan%2Ftitan.core/repo... /root/titan.core-ver.json + +# update the source code (if needed) +RUN cd $TITAN_REPO_DIR && \ + git fetch && git checkout -f -B $TITAN_BRANCH origin/$TITAN_BRANCH + +# build + install titan.core onto /titan.core/Install +RUN cd $TITAN_REPO_DIR && \ + make -j8 prefix=/usr install + +# Install files in proper places: +RUN cd /$TITAN_REPO_DIR/Install && \ + cp -r bin/* /usr/bin/ && \ + mkdir -p /usr/share/titan/etc/ && cp -r etc/* /usr/share/titan/etc/ && \ + mkdir -p /usr/share/titan/help/ && cp -r help/* /usr/share/titan/help/ && \ + mkdir -p /usr/include/titan/ && cp -r include/* /usr/include/titan/ && \ + mkdir -p /usr/lib/titan/ && cp -r lib/* /usr/lib/titan/ + +# somehow Debian folks updated the gcc version but not titan :/ +RUN sed -i 's/^#error///#error/' /usr/include/titan/cversion.h + +# This is required for obtaining talloc reports from the SUT +RUN pip3 install git+https://gitea.osmocom.org/cellular-infrastructure/osmo-python-tests + +# binary-only transcoding library for RANAP/RUA/HNBAP to work around TITAN only implementing BER +RUN apt-get update && \ + apt-get -y install wget +RUN DPKG_ARCH="$(dpkg --print-architecture)" && export $DPKG_ARCH && \ + wget https://ftp.osmocom.org/binaries/libfftranscode/libfftranscode0_0.5_$%7BDPKG... && \ + wget https://ftp.osmocom.org/binaries/libfftranscode/libfftranscode-dev_0.5_$%7BD... && \ + dpkg -i ./libfftranscode0_0.5_${DPKG_ARCH}.deb ./libfftranscode-dev_0.5_${DPKG_ARCH}.deb && \ + apt install --fix-broken && \ + rm libfftranscode*.deb + +RUN git config --global user.email docker@dock.er && \ + git config --global user.name "Dock Er" + +# clone osmo-ttcn3-hacks and deps, invalidate cache if deps change (OS#5017) +RUN git clone https://gerrit.osmocom.org/osmo-ttcn3-hacks && \ + make -j8 -C /osmo-ttcn3-hacks deps +ADD https://gerrit.osmocom.org/plugins/gitiles/osmo-ttcn3-hacks/+/refs/heads/mas... /tmp/deps-Makefile +RUN if ! diff -q /tmp/deps-Makefile /osmo-ttcn3-hacks/deps/Makefile; then \ + cd /osmo-ttcn3-hacks && \ + git pull && \ + make -j8 deps; \ + fi + +ADD ttcn3-docker-prepare.sh /usr/local/bin/ttcn3-docker-prepare +ADD ttcn3-docker-run.sh /usr/local/bin/ttcn3-docker-run +ADD .common/pipework /usr/local/bin/pipework diff --git a/debian-bullseye-titan-master/Makefile b/debian-bullseye-titan-master/Makefile new file mode 120000 index 0000000..ddd2d16 --- /dev/null +++ b/debian-bullseye-titan-master/Makefile @@ -0,0 +1 @@ +../debian-bullseye-titan/Makefile \ No newline at end of file diff --git a/debian-bullseye-titan-master/ttcn3-docker-prepare.sh b/debian-bullseye-titan-master/ttcn3-docker-prepare.sh new file mode 100755 index 0000000..2c18b53 --- /dev/null +++ b/debian-bullseye-titan-master/ttcn3-docker-prepare.sh @@ -0,0 +1,40 @@ +#!/bin/sh -e +if [ $# -lt 2 ]; then + echo + echo "usage: ttcn3-docker-prepare OSMO_TTCN3_BRANCH PROJECT [PROJECT ...]" + echo "arguments:" + echo " OSMO_TTCN3_BRANCH: as passed from docker" + echo " PROJECT: make target from osmo-ttcn3-hacks.git, e.g. 'msc'" + echo + exit 1 +fi + +set -x +OSMO_TTCN3_BRANCH=$1 +shift + +cd /osmo-ttcn3-hacks +git remote set-url origin "https://gerrit.osmocom.org/osmo-ttcn3-hacks" +git fetch +git checkout "$OSMO_TTCN3_BRANCH" + +if git symbolic-ref -q HEAD; then + git reset --hard origin/"$OSMO_TTCN3_BRANCH" +fi + +git rev-parse --abbrev-ref HEAD +git rev-parse HEAD + +# Update deps if Makefile changed since last 'make deps' (e.g. because +# OSMO_TTCN3_BRANCH is different). The Dockerfile does the initial 'make deps' +# and downloads /tmp/deps-Makefile. +if ! diff -q /tmp/deps-Makefile deps/Makefile; then + make -j8 deps +fi + +# Link start/stop scripts to / +for i in ttcn3-*-start.sh ttcn3-*-stop.sh; do + ln -sv "/osmo-ttcn3-hacks/$i" "/$i" +done + +make $@ diff --git a/debian-bullseye-titan-master/ttcn3-docker-run.sh b/debian-bullseye-titan-master/ttcn3-docker-run.sh new file mode 100755 index 0000000..26e291c --- /dev/null +++ b/debian-bullseye-titan-master/ttcn3-docker-run.sh @@ -0,0 +1,41 @@ +#!/bin/bash +if [ $# -lt 2 ]; then + echo + echo "usage: ttcn3-docker-run SUBDIR SUITE" + echo "arguments:" + echo " SUBDIR: directory in osmo-ttcn3-hacks, e.g. 'msc'" + echo " SUITE: name of the testsuite, e.g. 'MSC_Tests'" + echo + exit 1 +fi + +set -x +SUBDIR=$1 +SUITE=$2 + +if [ -n "$WAIT_FOR_NETDEV" ]; then + echo "Waiting for ${WAIT_FOR_NETDEV} to appear" + pipework --wait -i "$WAIT_FOR_NETDEV" + + while true; do + if [ ! -f /sys/class/net/${WAIT_FOR_NETDEV}/flags ]; then + exit 23 + fi + FLAGS=$(cat /sys/class/net/${WAIT_FOR_NETDEV}/flags) + let FLAG_UP=$FLAGS&1 + if [ "$FLAG_UP" = "1" ]; then + break + fi + echo "Waiting for ${WAIT_FOR_NETDEV} to become operational" + sleep 1 + done +fi + +cd /data + +/osmo-ttcn3-hacks/start-testsuite.sh "/osmo-ttcn3-hacks/$SUBDIR/$SUITE" +exit_code=$? + +/osmo-ttcn3-hacks/log_merge.sh "$SUITE" --rm + +exit $exit_code