Commit Graph

68 Commits

Author SHA1 Message Date
Oliver Smith 5a48bfbe24 scripts/kernel-test: build initrd+kernel as user
Refactor code to build the initramfs and kernel as user, instead of
running related code as root. Put the smoke_test.log into /tmp instead
of the cache dir, so we don't write as root into the cache dir. We cat
it on error anyway, so we don't need to have it in the workspace.

Change-Id: I1670dd86f2670f42eb99e4527d483965d8222402
2024-04-03 12:41:11 +00:00
Oliver Smith 363e268cdc jenkins-common: fix_perms: chown files too
Ensure the user that runs docker owns files in cache and data dirs
during fix_perms, if an old job created them as root.

Change-Id: I43af48bd87e27abad5ad52e734256d78651f67c3
2024-04-03 12:41:11 +00:00
Oliver Smith aad045f5b6 ttcn3-bts-test: add env var to not run all configs
Make it possible to e.g. run only one of the generic/oml/hopping
configurations.

I made a version of this patch a few weeks ago for testing OS#6375,
and I'm submitting it now so I can add multiple configurations for
ttcn3-ggsn-test in the next patch with the same logic.

Change-Id: I1dce5e6aa4b5d67f9f8c96ced611ab2875c353c8
2024-03-25 12:21:09 +01:00
Oliver Smith ff0b8c6d94 Use 2023q1 osmo-ttcn3-hacks branch for 2023q1 SUTs
Fix the TTCN3-centos-pcu-test-2023q1 jenkins job where currently most
tests are failing. This is because 2023q1 is using an older PCUIF
version that is no longer supported by osmo-ttcn3-hacks.git. As
discussed, use a 2023q1 branch of osmo-ttcn3-hacks where the support was
not removed yet.

Fixes: SYS#6638
Change-Id: Id82425aca4a8ff87feb8a130d31712bc62fa27ed
2023-11-15 21:54:45 +00:00
Pau Espin 1b03229848 Introduce osmo-epdg-master
Related: OS#6204
Change-Id: Iefc43ffa47f443f2826b8979d4dd0c5542dda1c5
2023-10-17 19:13:21 +02:00
Oliver Smith c68d4d9f0f ttcn3-pcu-test: use PFUIF v10 for 2023q1
Change-Id: Iae895240276fa68bfd9fdb2e13358a3a7fb65f59
2023-10-10 12:24:43 +00:00
Pau Espin f15080eb62 Fix osmo_dia2gsup-master not pulling in debian-bookworm-erlang dep image
Change-Id: I8d9bd77bbfac14a9951a549a21ee6bc4ea7b267a
2023-10-05 15:31:57 +02:00
Pau Espin a94ec07c0f Introduce osmo-dia2gsup-master, ttcn3-dia2gsup-test
- Add a docker container to run osmo_dia2gsup from git master.
- Add infrastructure to run the osmo-dia2gsup container against
  osmo-ttcn3-hacks.git/dia2gsup testsuite.

Related: OS#5757
Change-Id: I646096d5a010df02af75aefa33b023b55997a6d7
2023-08-28 14:32:38 +02:00
Oliver Smith 6a8118dad8 ttcn3: use debian-bookworm-titan
Related: OS#6057
Change-Id: I2017dd3888670c475b96e692d911a433484f3df9
2023-08-14 09:28:24 +00:00
Oliver Smith 1335eb578b kernel_test_prepare: use $DOCKER_ARGS
Use $DOCKER_ARGS in the docker run call to kernel-test/prepare.sh, which
builds the initramfs. I use this to make a local build of osmo-ggsn +
depends available in the docker container in /usr/local with the
ttcn3.sh script in osmo-dev.git.

Change-Id: Ie2500fa1bd9d57e2531463ce93fdd9930ad829d3
2023-07-21 11:28:33 +00:00
Oliver Smith 9500c29ce6 scripts/kernel-test: add KERNEL_SKIP_SMOKE_TEST
Speed up local test cycles by not running the smoke test every time.

Change-Id: I505b74e8c9b221655a97c5464f6fe4f21204a894
2023-07-21 11:28:33 +00:00
Oliver Smith c53a630c19 scripts/kernel-test: add KERNEL_SKIP_REBUILD
Speed up local test cycles by not building the kernel again from source
if not needed.

Change-Id: Iaa401918d7c09ec92ec546071d8961e99a4cbb47
2023-07-21 11:28:33 +00:00
Oliver Smith 82334bf123 jenkins-common: add + set default: debian bookworm
Related: OS#6057
Change-Id: I37e5393398f17c5c8809e17bb363fa86d769f2c2
2023-07-17 08:52:41 +00:00
Oliver Smith 4f459b779e docker kill: wait until containers are stopped
As "docker kill" / "docker container kill" (alias) doesn't block until
the given container stops, make sure to always run "docker wait"
afterwards.

Closes: OS#5928
Change-Id: I0242ece96541d8036ebbf8b0f498ebf231db26b5
2023-03-07 09:02:02 +00:00
Vadim Yanitskiy 4a2d9d1c0c jenkins-common.sh: open5gs-latest does not require debian-bullseye-build
We're not *building* anything for the open5gs-latest, but simply
downloading and installing DEBs from Sukchan's opensuse.org repo.

Change-Id: Iec7ccab28c37d274a731e08a2f893ec0514c1068
Fixes: 62ac21133a
2023-02-08 17:44:38 +07:00
Oliver Smith 46e4362ae2 FR testsuites: clean up all networks before start
Add a new network_clean_remove_all_ttcn3 function and use it in the fr
related testsuites to ensure no network is running before the test
starts. We just had the situation where the network link between
gtp0-deb10fr (where these testsuites run exclusively, and only one at a
time) and the jenkins host went down. And so the clean up trap
apparently did not run and starting a new test fails as the old network
still exists and has the network devices attached.

Related: OS#5802
Change-Id: I6a9464a11edcba978be08764bec9de19760a5c77
2023-01-30 13:45:30 +01:00
Oliver Smith f71e0f2856 ttcn3-bts-test: replace subnets during 'make cfg'
Make ttcn3-bts-test work as expected again by replacing the subnets
hardcoded in the confmerge files and Makefile.

Related: OS#5802
Change-Id: I733619f80b4e2456da070649634d3c942bb6d95f
2023-01-18 12:35:42 +01:00
Oliver Smith 76533bea88 kernel_test_wait_for_vm: increase timeout to 15s
As we run more testsuites in parallel, the load was higher and so this
timeout was reached.

Related: OS#5802
Change-Id: I823010106a99a4906e32198ed42b36f9fe662c4e
2023-01-17 13:42:04 +01:00
Oliver Smith 381e2f3a0e network_create: set NET_NAME after next SUBNET
Put the current SUBNET into NET_NAME, not the previous one. Without this
patch it works too, but this makes more sense.

Related: OS#5802
Change-Id: I6c90505fd6c0ba62244ff67709b0bf31bf44b449
2023-01-17 13:41:29 +01:00
Oliver Smith 998bc92f07 jenkins-common: replace subnet in scm files too
Replace the subnet in *.scm configs of nplab-sua-test and
nplab-m3ua-test too.

Related: OS#5802
Change-Id: Ia734df3721a4ae3408a17d33c835282b79174132
2023-01-17 12:47:52 +01:00
Oliver Smith d2827d91ce network_create: put SUBNET in NET_NAME
Fix the bug that running a test twice on the same host results in the
second test stopping the containers and network of the first test:

* Have the subnet name in the network name, so there's no collision of
  network names when cleaning up the network.

* Don't clean up the network when creating a new network. Rely on the
  clean up trap to clean up the network instead.

* Don't set NET_NAME when sourcing jenkins-common.sh anymore, as
  network_create will set it. There's also network_bridge_create, which
  only gets used by osmo-ran (which we don't run in jenkins). Add a
  check to this function to ensure NET_NAME is set before calling it,
  which osmo-ran is already doing.

Related: OS#5802
Change-Id: Ifcd384272c56d585e220e2588f2186dc110902ed
2023-01-17 09:39:52 +01:00
Oliver Smith f997b4e771 network_create: find free subnet automatically
Try multiple subnet numbers until successfully creating a network. This
way we can run the same ttcn3 testsuite multiple times in parallel
without conflicts (e.g. once against latest, once against nightly). Also
we don't need to make sure each new testsuite has a unique subnet
number anymore.

I've considered also adjusting network_bridge_create, but that gets used
exclusively by osmo-ran/jenkins.sh, a script which we don't actually run
in jenkins. It seems that in this script it makes more sense to not get
a random subnet number.

Related: OS#5802
Change-Id: I57152b08ef0f38e17e7019a8df032189b03f56cf
2023-01-16 15:19:29 +00:00
Oliver Smith 0974da58cd jenkins-common: tweak echo messages
Use 'set +x' before echo, so messages are not printed twice and the
output becomes more readable.

Example:
  + echo Creating network ttcn3-bts-test
  Creating network ttcn3-bts-test

Related: OS#5802
Change-Id: I213cb80bd1d9401281ae1fb7394b2319453550dd
2022-12-22 13:26:41 +01:00
Oliver Smith 278ed47265 fix_perms: use debian:bullseye
Use debian:bullseye instead of debian-bullseye-build. Building the
latter requires a lot of time, it's definitively not needed for just
running chmod. Use debian:bullseye, since we use it as base for most
images and it's therefore very likely that it's already downloaded
(and if not, it would get downloaded here).

Change-Id: I88f513a0a8ee04628842a7aa1b663c390d2032cd
2022-08-04 12:45:29 +00:00
Oliver Smith 62ac21133a jenkins-common: docker_depends: add open5gs
Change-Id: Ibcca8cf399abb4a4778318d1743985da8afde185
2022-05-30 13:35:46 +02:00
Oliver Smith 5c158b326a treewide: fix missing --rm for "docker run"
Add "--rm" to each "docker run" command, so they don't continuously fill
up disk space.

Fix this even in the pipework script. We don't use the code path there,
but by always having --rm after "docker run" (same line or next line),
a new lint script in osmo-ci I8ab9c291504475d670bdefc50c4524c5bdd4c880
can help us avoid this in the future.

In ttcn3-ggsn-test/jenkins.sh, move one existing --rm in a later line
upwards so the linter can find it.

Related: SYS#5827, OS#5099
Related: https://github.com/jpetazzo/pipework/pull/248
Change-Id: I48b01c43fedf379b8a565eaab0369806d7831bd8
2022-02-14 08:56:27 +01:00
Vadim Yanitskiy 31b54054f7 make/Makefile: generalize passing additional build arguments
Building of some images may require additional options to be passed.

Change-Id: Id1761062ac6ec1d1a4eb6a6b724e42cf576c848f
2022-02-07 17:19:36 +00:00
Oliver Smith 3817abe0e4 treewide: use almalinux instead of centos8
CentOS Linux 8 is EOL, attempting to install packages in it results in
an error. CentOS Linux is a rebuild of RHEL (stable versions). The
CentOS projects recommends to use CentOS Stream instead, which is a
build of the "public development branch for RHEL".

After the early EOL was announced on 2020-12-08, alternative projects
AlmaLinux and Rocky Linux have been established as binary compatible
forks of RHEL 8 (stable versions).

Both Alma and Rocky seem to be solid projects, see related Wikipedia
articles and their sources. Pick Alma and adjust the whole tree to use
the almalinux:8 docker image instead of centos:centos8.

Fix for:
  Error: Failed to download metadata for repo 'appstream': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried

Related: SYS#5818
Related: https://www.centos.org/cl-vs-cs/
Related: https://www.centos.org/centos-linux-eol/
Related: https://bugs.centos.org/view.php?id=18394
Related: https://en.wikipedia.org/wiki/AlmaLinux
Related: https://en.wikipedia.org/wiki/Rocky_Linux
Change-Id: I30e1a773b901b1d2187214445116c7f2aecc4e36
2022-02-02 10:02:54 +00:00
Oliver Smith 140a227472 jenkins-common.sh: add d9 to upstream_distro func
After the default UPSTREAM_DISTRO was changed from debian:stretch to
debian:bullseye, the "debian9-repo-install-test" container has gotten
built with bullseye instead of stretch. This is the reason for failures
of the jenkins job Osmocom-repo-install-debian9 we have seen over the
past days.

With this patch applied, it runs through again:
https://jenkins.osmocom.org/jenkins/job/Osmocom-repo-install-debian9/339/

Change-Id: I98a19184ba936114c03cd5cc4f54a3173cbd9cfe
2021-12-23 16:52:11 +01:00
Oliver Smith 5118a44ed8 debian-bullseye-obs-latest: new image
Add missing container for -latest tests. Currently this causes the
-latest tests to fail.

Related: OS#4969
Change-Id: I1230e87784bc21b5a6424db0bd8734181ead9bfd
2021-12-16 13:06:47 +01:00
Harald Welte c3874143c0 Switch ttcn3-* master tests from Debian stretch to bullseys
So far we were using ancient Debian 9 (stretch) for our IUT
containers.  Let's upgrade that to Debian 11 (bullseye).

Related: OS#4969
Change-Id: Ic6bece9cb695e6eccfcb1e83fdbf1048724a3cf9
2021-12-16 11:40:17 +01:00
Harald Welte 0f74af6083 titan: move from debian-stetch-titan to debian-bullseye-titan
So far we were executing all our TTCN-3  tests from a container
image with Debian stretch (9) plus a custom more recent eclipse-titan
package from the osmocom feed.

Let's update the container base OS from stretch (9) to bullseye (11)
while using the same packaged eclipse-titan version (8.0.0) for running
the tests.  So this should be a low-risk change, as titan runtime
remains identical.

I've executed all test suites locally and couldn't see any regressions.

Related: OS#4969
Change-Id: Ib3bdfa3bec8f8ef42c55ca61cdee8fbca923874f
2021-12-16 11:40:17 +01:00
Oliver Smith 6f43284ee5 jenkins-common.sh: non-jenkins: unique build tag
Support running multiple TTCN-3 testsuites in parallel when the
jenkins.sh scripts get called from outside of jenkins too.

Closes: OS#5358
Change-Id: Iaaf5719f758553687f2ab57975be275e7ac07e36
2021-12-16 11:27:57 +01:00
Oliver Smith db275974b8 Add centos7 containers
Related: SYS#5754
Change-Id: Iadf3d0d7143c2d81ea5e87fd07a3f4cd9239cb46
2021-12-11 15:16:54 +00:00
Oliver Smith ff961f6a9b jenkins-common.sh: pull registry.osmocom.org imgs
Pull debian-stretch-titan from registry.osmocom.org if the repository is
enabled. Otherwise the image gets only pulled the first time, and does
not get updated once it becomes outdated.

Fixes: OS#5336
Change-Id: I1cf998c21e4ee1f723c3b783703e339328377f3e
2021-12-03 17:30:28 +01:00
Oliver Smith f61d3ad8b5 jenkins-common.sh: fix redundant titan image build
Do not build debian-stretch-titan, when registry.osmocom.org is enabled.
The image that would be built at this point is not useful, since other
images like ttcn3-msc-test will use the debian-stretch-titan image from
the registry instead of the one that was just built locally.

Related: OS#5336
Change-Id: I7127e3ebac3a6a985c3ba50ba8c7cb8c5de978d9
2021-12-03 17:29:40 +01:00
Oliver Smith 305ce55b74 ttcn3: write Osmocom repository to configs
Write a line like 'Misc_Helpers.mp_osmo_repo := "nightly"' into the
TTCN-3 config file (e.g. BSC_Tests.cfg), before starting the testsuite.
This allows executing different code paths in the tests based on the
repository.

Related: OS#5327
Change-Id: Ic06532f7a67e59458652c5cf4c8f6fee8113e703
2021-11-26 18:12:50 +01:00
Oliver Smith 9c6eda65cc jenkins-common.sh: add NO_LIST_OSMO_PACKAGES
Allow to optionally skip listing the installed packages. This is useful
to speed up tests when running locally.

Related: osmo-dev I3d9976d07f088e2d106d23259889a4bffe1abbcb
Change-Id: Iaafb81e9ee94850ae3b6318574ad5370d74a2838
2021-07-12 08:04:39 +00:00
Vadim Yanitskiy 0e9d8d75a2 jenkins-common.sh: add image_suffix_is_master()
Since recently, we also have a new IMAGE_SUFFIX '2021q1-centos8'.
We cannot rely on image_suffix_is_latest() anymore, because this
prefix does not qualify as 'latest'.  If one needs to enable a
feature that is only available in master, then here is a way:

  if ! image_suffix_is_master; then
      # Patch the configuration files
  fi

Change-Id: I65df66cd2e14934bed8114618d6ffad7831d1025
2021-06-29 13:13:47 +02:00
Oliver Smith 4ae6ba75b4 jenkins-common.sh: add image_suffix_is_latest
Make sure we run the latest-code paths for "latest-centos8" too.

Change-Id: Ibcc7dfb092b3766ef9b189ae990b43fdb746a022
2021-05-21 16:24:58 +02:00
Oliver Smith cdcce03966 jenkins-common.sh: support 2021q1 feed
Adjust docker_depends and docker_dir_from_image_name for 2021q1. Extend
README.md with examples.

Related: SYS#5370
Change-Id: Icf1e3f1928658ff3d82190c4176252cf3590a1f5
2021-05-04 12:20:05 +02:00
Oliver Smith 7ff8bea9f5 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
2021-04-07 18:39:18 +00:00
Oliver Smith 69b3ecb912 osmo-*-latest: support centos8
Add a new centos8-obs-latest container with shared code (just like
debian-stretch-obs-latest) and adjust the package install blocks in
osmo-*-latest.

Related: OS#5049
Change-Id: I274b31d4903df07e99fd434af25bdb72991f6923
2021-03-04 14:42:32 +01:00
Oliver Smith effdb1a452 debian-stretch-obs-latest: new container
Move common code from osmo-*-latest to debian-stretch-obs-latest:
* add the OBS repository key
* add the OBS repository with "latest" feed
* install telnet
* invalidate the cache once the repository is updated

This is in preparation to make osmo-*-latest work with centos8,
preventing the following issues we would have without this refactoring:
* avoid need to read the repository index of both debian-stretch and
  centos8, and to invalidate the cache if either of them changes
  (instead of just the relevant one). This is currently a problem in
  osmo-*-master/Dockerfile, Id69f3eaf37f823bac0947366f27a25edd277a4cb
  will fix it there.
* no need to add boilerplate code to install the centos8 repository to
  each osmo-*-latest/Dockerfile

While at it, also remove deprecated MAINTAINER lines.

Related: OS#5049
Related: https://docs.docker.com/engine/reference/builder/#maintainer-deprecated
Change-Id: I443d52eba416ea298cc5421e280ad2f4ca59283b
2021-03-04 14:39:46 +01:00
Oliver Smith cb2a8326c1 kernel-test: don't try to use KVM if not available
Disable KVM if /dev/kvm is missing, as it is apparently the case on our
jenkins nodes. This makes the tests run a bit slower, but not much. Add
kernel_test_wait_for_vm to sleep until the VM is booted up (~5s instead
of ~1s without KVM), so the first test in the testsuite does not fail
when using KVM.

The variable is useful to test the non-KVM code path even if KVM is
available on the host.

Related: OS#3208
Change-Id: I1f337af1e2de6db05b22636bc31a535404235559
2021-02-26 16:18:26 +00:00
Oliver Smith 79e48fd3ae ttcn3-ggsn-test: add kernel test
Make it possible to run ttcn3-ggsn-test against osmo-ggsn with the GTP
kernel module. This feature is enabled by environment variables
explained in ttcn3-ggsn-test/jenkins.sh, and can either use the
pre-built kernel from Debian, or build a kernel from source.

The kernel runs inside QEMU inside the usual osmo-ggsn-master docker
image.

Thanks to Pau for providing the kernel config and kernel-test scripts
that this patch is based on! I ended up modifying them quite a bit to
fit the docker use case, and to build the initrd (so we can use the
stock debian kernel).

Related: OS#3208
Change-Id: I54e752048eed2a170a1cf4e0fd410de255b9de5d
2021-02-26 09:32:39 +01:00
Oliver Smith cf43f686ac jenkins-common: put fix_perms() in clean_up_common
Don't call fix_perms from collect_logs anymore, it looks like it was
only added there to avoid adding it at the end of each jenkins.sh. Now
that we have clean_up_common, put it there.

Related: OS#3208
Change-Id: I6e7e5b35198f420e130b1282eb948b96ccd6c8e0
2021-02-26 09:32:39 +01:00
Oliver Smith 12b961942a jenkins-common.sh: add common clean up trap
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.

Related: OS#3208
Change-Id: I807c6221d22fec31db23e2516e477a3eb43347fb
2021-02-26 09:32:06 +01:00
Oliver Smith 4407e0e3aa debian10-repo-install-test: new container
Related: OS#4969
Change-Id: I7addb30aa3f8564dcbdc3f6cf2e2e0cfdf4dd02d
2021-01-25 09:24:03 +00:00
Pau Espin d3bd2c2ba9 Introduce osmo-ran docker image set up
See osmo-ran/README.md in this commit for a description.

Related: SYS#4889
Change-Id: If5d22e9fa818310cbb4adc34bd7aceb4416ec969
2020-12-18 11:45:33 +00:00