osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ci/+/30468 )
Change subject: repo-install-test: run inside podman ......................................................................
repo-install-test: run inside podman
Change repo-install-test to run inside podman instead of systemd. This job needs to run systemd to verify that the systemd services start up properly. Running systemd inside docker was never officially supported, it worked with cgroups1 but does not work anymore with cgroups2. It is officially supported in podman.
Related: OS#5365 Change-Id: I2be8359972556ab99fcfb7967fc43bcec1ca05f7 --- M jobs/repo-install-test.yml M scripts/repo-install-test.sh R scripts/repo-install-test/run-inside-podman.sh 3 files changed, 32 insertions(+), 21 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/68/30468/1
diff --git a/jobs/repo-install-test.yml b/jobs/repo-install-test.yml index 5343f33..4ec6806 100644 --- a/jobs/repo-install-test.yml +++ b/jobs/repo-install-test.yml @@ -26,7 +26,6 @@ <li> <a href="https://osmocom.org/issues/3369">OS#3369</a>: check if systemd services start properly <li> <a href="https://osmocom.org/issues/4563">OS#4563</a>: extend for centos </ul> - node: osmocom-master-debian9 parameters: - string: name: BRANCH_CI @@ -42,14 +41,20 @@ - axis: type: slave name: label - values: !!python/tuple [repo-install-test] + values: !!python/tuple [podman] - axis: type: user-defined name: feed values: '{obj:feeds}' builders: - shell: | - export OSMO_BRANCH_DOCKER_PLAYGROUND="$BRANCH_DP" + git clone \ + --depth=1 \ + --branch="$BRANCH_DP" \ + https://gerrit.osmocom.org/docker-playground \ + _docker_playground + git -C _docker_playground log --oneline + export FEED="$feed" scripts/repo-install-test.sh "{distro}" scm: diff --git a/scripts/repo-install-test.sh b/scripts/repo-install-test.sh index 2a3e739..3891ebd 100755 --- a/scripts/repo-install-test.sh +++ b/scripts/repo-install-test.sh @@ -28,12 +28,18 @@ }
check_usage -docker_images_require "$DISTRO-repo-install-test"
FEED="${FEED:-nightly}" PROJ="${PROJ:-osmocom:$FEED}" +IMAGE="$USER/$DISTRO-repo-install-test" CONTAINER="$DISTRO-repo-install-test-$FEED"
+if ! podman image exists "$IMAGE"; then + buildah bud \ + -t "$IMAGE" \ + _docker_playground/$DISTRO-repo-install-test/Dockerfile +fi + if [ -z "$TESTS" ]; then TESTS=" test_conflict @@ -61,25 +67,28 @@ check_if_systemd_is_running() { for i in $(seq 1 10); do sleep 1 - if docker exec "$CONTAINER" systemctl status; then + if podman exec "$CONTAINER" systemctl status; then return fi done
echo "ERROR: systemd is not running properly." - docker container kill "$CONTAINER" + podman 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" +if [ "$(podman inspect -f '{{.State.Running}}' "$CONTAINER" 2> /dev/null)" = "true" ]; then + podman container kill "$CONTAINER" sleep 1 fi
-# Additional docker run arguments +# Additional podman run arguments args="" if [ -n "$KEEP_CACHE" ]; then + mkdir -p \ + $OSMO_CI_DIR/_repo_install_test_cache/debian/apt \ + $OSMO_CI_DIR/_repo_install_test_cache/centos/dnf args="$args -e KEEP_CACHE=1" args="$args -v $OSMO_CI_DIR/_repo_install_test_cache/debian/apt:/var/cache/apt" args="$args -v $OSMO_CI_DIR/_repo_install_test_cache/centos/dnf:/var/cache/dnf" @@ -87,9 +96,9 @@
# Run the container # * This does not output anything, for debugging add -it and remove &. -# * /run, /tmp, cgroups, SYS_ADMIN: needed for systemd +# * SYS_ADMIN: needed for osmo-pcap-client # * SYS_NICE: needed for changing CPUScheduling{Policy,Priority} (osmo-bts systemd service files) -docker run --rm \ +podman run --rm \ -v "$OSMO_CI_DIR/scripts/repo-install-test:/repo-install-test:ro" \ --name "$CONTAINER" \ -e FEED="$FEED" \ @@ -97,29 +106,26 @@ -e PROJ_CONFLICT="$PROJ_CONFLICT" \ -e DISTRO="$DISTRO" \ -e TESTS="$TESTS" \ - -e container=docker \ - --tmpfs /run \ - --tmpfs /run/lock \ - --tmpfs /tmp \ - -v /sys/fs/cgroup:/sys/fs/cgroup:ro \ + -e container=podman \ --cap-add SYS_ADMIN \ + --systemd=always \ --cap-add SYS_NICE \ $args \ - "$USER/$DISTRO-repo-install-test" \ + "$IMAGE" \ /lib/systemd/systemd & check_if_systemd_is_running
# Run the test script ret=0 -if ! docker exec "$CONTAINER" /repo-install-test/run-inside-docker.sh; then +if ! podman exec "$CONTAINER" /repo-install-test/run-inside-podman.sh; then ret=1 fi
# Interactive shell if [ -n "$INTERACTIVE" ]; then - docker exec -it "$CONTAINER" bash || true + podman exec -it "$CONTAINER" bash || true fi
-docker container kill "$CONTAINER" +podman container kill "$CONTAINER"
exit $ret diff --git a/scripts/repo-install-test/run-inside-docker.sh b/scripts/repo-install-test/run-inside-podman.sh similarity index 99% rename from scripts/repo-install-test/run-inside-docker.sh rename to scripts/repo-install-test/run-inside-podman.sh index f95bae0..4426932 100755 --- a/scripts/repo-install-test/run-inside-docker.sh +++ b/scripts/repo-install-test/run-inside-podman.sh @@ -11,7 +11,7 @@ # 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) +# * osmo-ggsn (no tun device in podman) SERVICES=" osmo-bsc osmo-bts-virtual