Continuous Integration (CI) Whonix Testing - Automated Test Suite

Building Whonix for Debian bookworm on Debian bookworm is still a bit difficult because VirtualBox is neither available from Debian stable repository, Debian fasttrack nor Oracle repository.

At the moment it can only be installed from Debian sid which is good enough at least for development purposes and CI. Since this is a moving target (now it’s Debian sid, in the future hopefully at least fasttrack), could you please leave VirtualBox installation on the CI server to a script that I would maintain?

This command should work for VirtualBox installation on Debian bookworm:

~/derivative-maker/packages/kicksecure/usability-misc/usr/bin/installer-dist --non-interactive --virtualbox-only --log-level=info

And if not, then I would fix it.

(related: Whonix Linux Installer - Development Discussion)

Aight @Patrick, it took a few hours but the CI should be running on Debian 12 and installing VirtualBox from the installer-dist script

I am heads down in my ecommerce work for the next few weeks still, but will come back in full force and make package_parser more performant and satisfy html requirements. Then we can work on getting OpenQA running for GUI testing

1 Like

Build successful with debian 12 and the install script

Remove tasks to delete existing VMs since VPS is newly created · Whonix/derivative-maker@3a045b1 · GitHub

1 Like

Excellent! Thank you, most helpful!

1 Like

State of Automated GUI Testing

Posting so I remember historical context later of all the shit I did. It might be a while until this gets revisted, due to all the work that must be done with whonix/ks package site builder

Current Progress

  • Pulled WATS in to a repo I could work on GitHub - Mycobee/whonix_automated_test_suite: Whonix Automated GUI Testing Suite for CI
  • Set up automated builder CI pipeline to have two different paths…GUI builds happen when a tag is pushed, and headless builds happen when a commit is pushed. Ideally, in the future GUI testing will occur any time a tag is pushed.
  • made some of progress installing a GUI on the VPS host here and here
  • ran in to glitchy bugs using GUI and VNC on remote debian VPS host

Steps to Move Forward

  1. Fix GUI host bugs…hopefully with Jeremy’s suggestion…otherwise may have to use terraform and AWS to remotely provision ec2 instance with GPU installed
  2. Have CI run existing flaky wats suite for proof of concept (small lift once GUI bugs are ironed out…see previous PRs listed above)
  3. Implement OpenQA testing…once this is in place building automated gui testing should be much more stable and dependable…iteration should be quicker.
1 Like

CI broken.

Sorry for the delays. I was travelling, then I got sick as shit. Finally got around to fixing it this morning

1 Like

Do we need to gather_build_logs.yml or could we just use github’s default log function?

Maybe github has a maximum log size function?

Githubs default log function is very useful for the contaimer they spin up, but it does not give us much observability on our digital ocean VM where the derivative maker building occurs. The ansible log gathering logic gives us much more detailed output when things break on the build step itself

1 Like

CI Roadmap

Moving forward with CI, here are some useful improvements to our CI

Preconfigured Runner VPS

We should utilize an existing img file in digitalocean instead of installing and configuring the box every time CI runs. We should split the ansible tasks out to have a build_machine_image role. The role should install all needed depedencies including virtualbox, and do all configuration unrelated to the actual code changes in derivative-maker

The role should conditionally run, ONLY when git changes are in the ./automated_builder directory. It should tag the new image in a sane way, and publish the image to digital ocean.

When a code change happens in any directory that is not ./automated_builder, the CI should load this image and run the steps to install the source code, and build the whonix images

Parallelize Builds

The workstation and the gateway do not need to run on the same machine. CI should spin up two VPS machines and run the builds in parallel. The logs should be updated to reflect these separate builds, and tagging of machines should be updated in digitalocean. Teardown should successfully destroy all these machines, and run regardless of any behavior.

We should assess the CPU and Memory usage of our images, and then decide whether or not we can scale down based on that. We should only use as much machine as we need to run the build efficiently, to save costs. CI is cheap as it is, but the cheaper we can make things, the better.

This might mean making different sized images for commit builds (headless), and tag builds (GUI + full depedencies)

Upon further research, both builds must be on same host. Investigate running these with gnu parallel on the same host, and determine how big of a box is needed to run as fast as possible without being over provisioned.

Documentation Overhaul

As CI becomes more leveraged, we need good documentation so that it can be more maintainable and understood. The wiki should be updated and we should ensure that we have some sort of visual representation of how the system works.

OpenQA Setup in CI

This one is going to be a big fucking task, but super important to the future of both Whonix and KS. We need a useful OpenQA setup. This probably will need to be split in to multiple subtasks.

Exploration of Further CI Usage

Take stock of other things we can automatically build with CI to ensure integrity

VirtualBox installer script? Etc. Some of this can likely be done with OpenQA, but there might be areas of our codebase we can utilize CI to make life easier for us all, and improve the development cycle.

1 Like

Sounds all good!

This is nice however the prepare-release step requires both images to be present on the same hard drive.

1 Like

Ahh good to know. That would suck to do all that work and get blocked by that.

1 Like

CI started having issues.

Lots of these.

warning: 766957415d1add40f1c1a4d6b308d7396446782e:.gitmodules, multiple configurations found for ‘submodule.packages/anon-apt-sources-list.path’. Skipping second one!

Not reproducible outside of the CI.

And somehow automated_builder/roles/headless-build/tasks/install_source.yml does not pass command line arguments to automated_builder/roles/common/templates/install_source.sh, hence the git checkout is failing.

Yeah somehow not reading environment variables with branch name. Ill look in to it

1 Like

Hey @Patrick

Finally got a chance to dig in to this. Got the CI script install_source.sh working on my branch ci-fix-empty-env-vars

Unfortunately now the virtualbox installation script is failing. Any idea why?

/bin/sh: 1: /home/ansible/derivative-maker/packages/kicksecure/usability-misc/usr/bin/dist-installer-cli: not found

Once this is fixed, CI should be working again. Github changed around the name of some of their environment variables which broke our pipeline

1 Like