Abort the script and trigger the clean up script, whenever any of the
commands below to prepare the testsuite are failing. This saves time
with figuring out why suddenly all or most tests are failing, and avoids
running the entire testsuite on jenkins if it's obviously not going to
Add set_clean_up_trap() in jenkins-common.sh and run it at the beginning
of the jenkins.sh files. Move the common clean up code from the end of
every jenkins.sh file into clean_up_common(), which gets called by the
trap. Add a custom clean_up() function to those jenkins.sh files that
need additional clean up.
Replace explicit container stop commands (for containers attached to the
docker network) with one call to network_clean() in clean_up_common(). It
kills all containers attached to the docker network.
The motivation for this change is the upcoming optional build of initrd
and kernel during ttcn3-ggsn-test/jenkins.sh. After building these, a
short smoke test will be performed to make sure we can boot the kernel
and initrd, before continuing to run the entire testsuite against it. If
building or the smoke test fails, we must do a proper clean up of the
network and fix permissions.
Allow jenkins to fetch the image from our private docker registry.
Outside of jenkins, the image is built locally just like before.
Move the git fetch/checkout code and make call to build the testsuite,
to debian-stretch-titan/ttcn3-docker-prepare.sh. In the next patch, I
will extend the script to update deps right before building too (e.g.
because OSMO_TTCN3_BRANCH changed).
Clone the osmo-ttcn3-hacks and all dependency repositories less often by
moving related commands to the shared debian-stretch-titan image.
Remove the 'git checkout -f -B master origin/master' line, because the
master branch is checked out by default.
While at it, move the shared "git config" commands too, and move them
before cloning the repositories, so they don't run again whenever the
deps change (logic to invalidate the cache if deps change will be added
in the next patch).
Remove leftover from old TTCN-3 build scripts, before refactoring ttcn3
Dockerfiles. This line has already been removed in 357ec806 from 2017 for
In osmo-ttcn3-hacks.git, this is only referenced in the obsolete
bin/install.script (looks like we could remove that, together with the
rest of the bin dir?).
We previously only allocated IPv4 sub-nets to the network segments
created with 'docker network'. Let's fix that by assigning both
IPv4 and IPv6 address ranges to each docker network.
Don't list debian-stretch-build and debian-stretch-titan as dependencies
anymore, now that docker_images_require finds them automatically.
Allow to pass options to each "docker run" line in the various
jenkins.sh scripts. I'm using this to run the testsuites and Osmocom
components in docker with the same configurations as jenkins, but with
Osmocom and testsuite binaries built outside and mounted into the
DOCKER_ARGS="-v /usr/local:/usr/local:ro -v $hacks:/osmo-ttcn3-hacks:ro"
This allows very short test cycles without a second set of configs. The
full script that makes use of this feature is in osmo-dev.git,
The default filename pattern of the JUnit log plugins of TTCN-3 is
"junit-xml-%u.xml" where %u represents the PID of the process. This
is typically a good idea as the PID doesn't wrap that quickly. However,
if you're executing a new docker container for every test suite run,
then chances are high that two subsequent runs of the test suite
container might end up with the same PID and hence the smae filename.
This results in the output file being overwritten, which is what's
responsible for many missing RemsimServer_Tests results on the
jenkins.osmocom.org test results analyzer.