Skip to content

Bintar deps validation script #694

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

cvicentiu
Copy link
Member

@cvicentiu cvicentiu commented Jan 27, 2025

This commit introduces two different validation scripts.

  • One that checks dependencies of ELF files in bintar archives.
  • One that does a smoke test on bintar archives:
    Goes through each supported distribution and starts a bare-bones
    container image. Then within the image it does:
    1. Extract the archive mariadb-install-db
    2. Run ./mariadb-install-db
    3. Start ./mariadbd as a process inside the container
    4. Use the ./mariadb client from the archive to connect and run
      SELECT VERSION().

@cvicentiu cvicentiu force-pushed the bintar_check branch 2 times, most recently from 5a03ab6 to 7320133 Compare February 4, 2025 15:02
@cvicentiu cvicentiu force-pushed the bintar_check branch 2 times, most recently from 05533eb to ed1387f Compare February 14, 2025 20:35
@cvicentiu cvicentiu force-pushed the bintar_check branch 3 times, most recently from fee71ca to a046d68 Compare February 21, 2025 18:21
@cvicentiu cvicentiu marked this pull request as ready for review February 21, 2025 18:21
@cvicentiu cvicentiu force-pushed the bintar_check branch 3 times, most recently from 26efa9b to df65af1 Compare February 21, 2025 18:44
This commit introduces two different validation scripts.
* One that checks dependencies of ELF files in bintar archives.
* One that does a smoke test on bintar archives:
  Goes through each supported distribution and starts a bare-bones
  container image. Then within the image it does:
  1. Extract the archive mariadb-install-db
  2. Run ./mariadb-install-db
  3. Start ./mariadbd as a process inside the container
  4. Use the ./mariadb client from the archive to connect and run
     SELECT VERSION().
@cvicentiu cvicentiu changed the title WIP: Bintar deps validation script Bintar deps validation script Feb 25, 2025
@RazvanLiviuVarzaru
Copy link
Collaborator

RazvanLiviuVarzaru commented Mar 10, 2025

@cvicentiu
It might be early to discuss this but I think it's important for avoiding future refactoring.
I hope you are willing to briefly agree on the delivery method of these scripts.
@fauust this discussion might interest you.

As you know, the workers run different Python versions depending on the Host operating system and these scripts come with a bunch of requirements to be installed beforehand. This can make the maintenance, delivery and installation a pain point.
Of course, we can work with virtual environments, find the best installation method, but the effort is still there and it's the CI spending time on it.

For deps_test.py I have the following idea:

  • this script can easily be included in a Docker image, where we pin the python version and the dependencies. This reduces the complexity of delivering it to a variety of worker host systems.
  • given that in the future we will use buildbot non-latent workers, launching this script can be as easy as setting the Dockerfile entry-point to ENTRYPOINT ["python", "deps_test.py"] and then docker run #IMAGE# #args# (of course mounting the path where the binary tarball was produced in a previous step).

For smoke_test.py the problem is not that easy if, let's say, we go by the same principle I presented for deps_test.py

  • there is something I never explored which is Docker-in-Docker https://hub.docker.com/_/docker but can be a potential solution
  • another solution I can think of is mounting the docker socket and let the script control docker on the host from within a container

Let me know what are your thoughts,
If creating a container image sounds interesting to you, I'm willing to help and create the Dockerfiles.

### Usage example

# Build - from the ROOT of the repository
  docker build --build-arg SCRIPT=smoke_test.py -f scripts/bintars/BUILD/Dockerfile -t local:bintar_smoke_test .
  docker build --build-arg SCRIPT=deps_test.py -f scripts/bintars/BUILD/Dockerfile -t local:bintar_deps_test .

# Interactive session (for debugging)
  docker run --rm -it --entrypoint=/bin/bash local:bintar_deps_test
  docker run --rm -it --entrypoint=/bin/bash local:bintar_smoke_test

# deps test - mount a volume for mariadb archive
$ docker run --rm -v /home/razvan/Documents/bincheck:/runtime \
    local:bintar_deps_test \
    /runtime/mariadb-10.6.21-linux-systemd-x86_64.tar.gz config/deps_10.6.yaml

  ---
  INFO: Product version (major.minor) 10.6
  INFO: Extracting archive /runtime/mariadb-10.6.21-linux-systemd-x86_64.tar.gz
  INFO: Fetching archive dependencies
  INFO: Cleaned up tests/mariadb-10.6.21-linux-systemd-x86_64
  INFO: All OK
  ---

# smoke test - mount a volume for mariadb archive and docker socket (Docker Out of Docker)
# is important that the test-directory is a bind mounted host path
# so the script can further mount volumes for sibling containers
$ docker run --rm -v /var/run/docker.sock:/var/run/docker.sock \
  -v /tmp/buildnumber-builder:/tmp/buildnumber-builder \
  -v /home/razvan/Documents/bincheck:/runtime  \
  local:bintar_smoke_test \
  /runtime/mariadb-10.6.21-linux-systemd-x86_64.tar.gz \
  config/supported_os.yaml --test_directory /tmp/buildnumber-builder

---
  INFO: Product version (major.minor) 10.6
  INFO: Extracting archive /runtime/mariadb-10.6.21-linux-systemd-x86_64.tar.gz
  INFO: Using docker socket http+docker://localhost
  INFO: [1/2]: ubuntu:20.04 PASS
  INFO: [2/2]: ubuntu:22.04 PASS
  INFO: ------ TEST SUMMARY ------
  INFO: PASSED: [ubuntu:20.04, ubuntu:22.04]
  INFO: Cleaned up /tmp/buildnumber-builder/mariadb-10.6.21-linux-systemd-x86_64
---

# These are written as ROOT. Buildbot-Worker cannot clean them
/tmp$ tree buildnumber-builder/
buildnumber-builder/
├── ubuntu_20.04
└── ubuntu_22.04
@RazvanLiviuVarzaru
Copy link
Collaborator

RazvanLiviuVarzaru commented Mar 11, 2025

@cvicentiu I've added a Dockerfile to build two images for deps and smoke tests
5f517b3

deps approach is pretty elegant, with no major workarounds.

Instead for smoke tests, the Docker-Out-Of-Docker method have several constraints:

  • mounting docker socket
  • --test_directory is mandatory and the mounted paths host:container should be symmetric so that MariaDBContainerRunner bind mounts the right host path into test containers.
  • there are some leftover dirs after a run, the tests base dir, and a dir for each test container (datadir). And unfortunately these are owned by root and cannot be removed by buildbot-worker for example

See the commit message for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants