Oliver Smith
61f2be7bd4
Replace 'git checkout -f -B $BRANCH origin/$BRANCH && \' in all Dockerfiles that accept branch variables ($OSMO_TTCN3_BRANCH, $OSMO_MGW_BRANCH, ...) with the following: git checkout $BRANCH && \ (git symbolic-ref -q HEAD && git reset --hard origin/$BRANCH || exit 1); \ This allows using branch names and commit hashes in the $BRANCH variables. Using commits is needed for the bisect script added in [1]. The second line ("(git symbolic...") checks if we are in detached HEAD state after the checkout, and if we are not, pulls in all new commits from origin/$BRANCH. Note that it ends in ';' instead of '&&', because the command in the next line should be executed even if "git symbolic-ref" does not exit with 0 (detached HEAD state). Here is an example, to illustrate that the new command does the right thing. Clone a repository and be 50 commits behind origin/master: $ git clone "https://git.osmocom.org/osmo-mgw" $ cd osmo-mgw $ git reset --hard origin/master~50 With BRANCH="master": $ git checkout master && \ (git symbolic-ref -q HEAD && git reset --hard origin/master || exit 1); \ echo "done" Already on 'master' ... done $ git status Your branch is up-to-date with 'origin/master'. With BRANCH="85978d": $ git checkout 85978d && \ (git symbolic-ref -q HEAD && git reset --hard origin/85978d || exit 1); \ echo "done" Note: checking out '85978d'. ... done $ git status HEAD detached at 85978dad Related previous changes: * [2] made it work for commit hashes, but broke using branch names other than master, and pulling in new commits from master * [3] made branches other than master work again, but did not fix pulling in new commits from master * [4] reverted [3] and the git checkout related part from [2] [1] Change-Id: I11f7e61a9b30d58a0fdfcaf77dde447806bf661f [2] Change-Id: If3bc5fae07cf63c4fef68306be4c4328660bc869 [3] Change-Id: I2ff745c8d19b777d876170d5717c082ceb68a1f3 [4] Change-Id: Ie6da0f9ea96f11407e38545a6b3cf22ef9cadc25 Related: OS#4015 Change-Id: I4004980baf0b7d6096702b6f3067ccbdb369a28c |
||
---|---|---|
alpine-build | ||
alpine-lighttpd | ||
bind9 | ||
cgit | ||
debian-jessie-build | ||
debian-jessie-buildslave | ||
debian-jessie-buildslave-st | ||
debian-jessie-osmocom | ||
debian-repo-install-test | ||
debian-sid-build | ||
debian-stretch-build | ||
debian-stretch-titan | ||
gerrit | ||
git-daemon | ||
gitolite | ||
gr-gsm-master | ||
make | ||
nplab-m3ua-test | ||
nplab-sua-test | ||
osmo-bsc-latest | ||
osmo-bsc-master | ||
osmo-bts-latest | ||
osmo-bts-master | ||
osmo-cn-latest | ||
osmo-dev-on-debian-sid | ||
osmo-gerrit-libosmo | ||
osmo-ggsn-latest | ||
osmo-ggsn-master | ||
osmo-hlr-latest | ||
osmo-hlr-master | ||
osmo-hnbgw-latest | ||
osmo-hnbgw-master | ||
osmo-mgw-latest | ||
osmo-mgw-master | ||
osmo-msc-latest | ||
osmo-msc-master | ||
osmo-nitb-master | ||
osmo-pcu-latest | ||
osmo-pcu-master | ||
osmo-sgsn-latest | ||
osmo-sgsn-master | ||
osmo-sip-latest | ||
osmo-sip-master | ||
osmo-stp-latest | ||
osmo-stp-master | ||
osmocom-bb-host-master | ||
patchwork | ||
public-inbox | ||
redmine | ||
sctp-test | ||
sigtran-tests | ||
tmp | ||
ttcn3-bsc-test | ||
ttcn3-bsc-test-sccplite | ||
ttcn3-bscnat-test | ||
ttcn3-bts-test | ||
ttcn3-ggsn-test | ||
ttcn3-hlr-test | ||
ttcn3-mgw-test | ||
ttcn3-msc-test | ||
ttcn3-nitb-sysinfo | ||
ttcn3-pcu-test | ||
ttcn3-pcu-test-sns | ||
ttcn3-sgsn-test | ||
ttcn3-sip-test | ||
ubuntu-zesty-build | ||
.gitignore | ||
.gitreview | ||
README.md | ||
Release.key | ||
jenkins-common.sh | ||
osmo-bisect.sh |
README.md
Osmocom docker playground
This repository contains some humble attempts at creating some Docker containers + related stacks around Osmocom. So far, the main focus is test automation.
Running a testsuite
All testsuite folders start with ttcn3
or nplab
. Run the following
to build/update all required containers and start a specific testsuite:
$ cd ttcn3-mgw-test
$ ./jenkins.sh
Environment variables:
IMAGE_SUFFIX
: the version of the Osmocom stack to run the testsuite against. Default ismaster
, set this tolatest
to test the last stable releases.OSMO_TTCN3_BRANCH
: osmo-ttcn3-hacks.git branch, which will be used when building attcn3-*
docker image. Defaults tomaster
.NO_DOCKER_IMAGE_BUILD
: when set to1
, it won't try to update the containers (see "caching" below)
Building containers manually
Most folders in this repository contain a Dockerfile
. Build a docker
container with the same name as the folder like this:
$ cd debian-stretch-build
$ make
Caching
All folders named osmo-*-latest
and osmo-*-master
build the latest
stable or most recent commit from master
of the corresponding Osmocom
program's git repository. When you have built it already, running make
will only do a small HTTP request to check if the sources are outdated
and skip the build in case it is still up-to-date.
Dependencies
Folders that don't have a jenkins.sh
usually only depend on the
container that is specified in the FROM
line of their Dockerfile
.
Testsuites depend on multiple containers, they are defined on top of
each jenkins.sh
:
. ../jenkins-common.sh
IMAGE_SUFFIX="${IMAGE_SUFFIX:-master}"
docker_images_require \
"debian-stretch-build" \
"osmo-stp-$IMAGE_SUFFIX" \
"osmo-bsc-$IMAGE_SUFFIX" \
"osmo-bts-$IMAGE_SUFFIX" \
"debian-stretch-titan" \
"ttcn3-bsc-test"
Reasoning for this implementation
Before having the docker_images_require
lines, there used to be a
top-level Makefile
for resolving dependencies between the containers.
But it was prone to mistakes: when new folders in the repository
were added without related targets in the Makefile
, make
would
always assume that the targets where the always existing folders and
therefore never build the containers.
In order to implement testing latest
in addition to master
(OS#3268), it would have been
necessary to add further complexity to the Makefile
. Instead it was
decided to scrap the file, and just keep the short list of dependencies
right above where they would be needed in the jenkins.sh
.
See also
- Overhyped Docker for related rambling on why this doesn't work as well as one would want.
- Osmocom wiki: Titan TTCN3 Testsuites