Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

openqa (aerialis)

General

openQA at openqa.garudalinux.org tests the ISOs of image-builder. The openqa:<edition> job of its ISO pipeline is the gate before publish:<edition>, see docs/ci.md of image-builder.

Container explanations

  • webui: the openQA web UI, scheduler, websockets, gru and livehandler with Apache in one container (openqa_webui image without MODE). The database is openqa in the postgres container.
  • worker: a single openQA worker, so one test VM runs at a time. The image openqa-worker:latest is built by image-builder (ci/openqa.Containerfile on the upstream openqa_worker image), with Inline::Python for the Python tests and the OVMF files under /usr/share/garuda-openqa/.

Resource limits

The web services of aerialis come first. The nspawn container caps web UI, worker and QEMU together:

SettingValue
CPUQuota8 threads
MemoryHigh18 GiB
MemoryMax20 GiB
CPUWeight10
IOWeight10

The install scenario uses a VM with 6 GB and 4 vCPUs, live-modes one with 12 GB.

Data

/data_2/containers/openqa on the host (/var/lib/openqa-data in the container): factory (ISOs and disk images), testresults, images, tests and the worker pool. Not backed up. The database is in the borgmatic dumps of postgres.

openQA cleans up after each job ([minion_task_triggers]): results after 90 days, untracked assets after 7 days, assets of a job group above 60 GiB.

Authentication

openQA accepts any GitLab account. web-front therefore puts /login behind oauth2-proxy, which only lets members of the GitLab group garuda-linux through (the same GitLab application, which also needs the scopes openid and email and the callback https://openqa.garudalinux.org/oauth2/callback). Everything else, including /api, stays public.

The worker and the image-builder pipeline use API keys, created under Manage API keys.

Restarting containers

sudo systemctl restart compose-runner-openqa

Nix expression

{
  config,
  garuda-lib,
  sources,
  ...
}:
let
  inherit (garuda-lib.monitoring) aerialisContainers;
  ph = config.sops.placeholder;

  mkConfig = content: {
    inherit content;
    mode = "0444";
    restartUnits = [ "compose-runner-openqa.service" ];
  };
in
{
  imports = sources.defaultModules ++ [ ../../modules ];

  garuda =
    garuda-lib.mkMonitoring {
      host = "aerialis";
      units = [
        "compose-runner-openqa.service"
        "docker.service"
      ];
    }
    // {
      services.compose-runner.openqa = {
        source = ../../../compose/openqa;
        extraFiles = [
          {
            targetFileName = "openqa.ini";
            file = config.sops.templates."openqa.ini".path;
          }
          {
            targetFileName = "database.ini";
            file = config.sops.templates."openqa-database.ini".path;
          }
          {
            targetFileName = "client.conf";
            file = config.sops.templates."openqa-client.conf".path;
          }
        ];
      };
    };

  # Written by different unprivileged users in webui and worker
  systemd.tmpfiles.rules = map (dir: "d /var/lib/openqa-data/${dir} 0777 root root") [
    "factory"
    "factory/iso"
    "factory/hdd"
    "factory/other"
    "factory/repo"
    "factory/tmp"
    "images"
    "pool"
    "testresults"
    "tests"
  ];

  sops.secrets = {
    "openqa/api_key" = { };
    "openqa/api_secret" = { };
    "openqa/db_password" = { };
    "openqa/oauth2_key" = { };
    "openqa/oauth2_secret" = { };
  };

  sops.templates = {
    "openqa.ini" = mkConfig ''
      [global]
      appname = Garuda Linux openQA
      branding = plain
      base_url = https://openqa.garudalinux.org
      download_domains = iso.builds.garudalinux.org
      recognized_referers = gitlab.com

      [auth]
      method = OAuth2

      [oauth2]
      provider = custom
      unique_name = gitlab
      key = ${ph."openqa/oauth2_key"}
      secret = ${ph."openqa/oauth2_secret"}
      authorize_url = https://gitlab.com/oauth/authorize?response_type=code
      token_url = https://gitlab.com/oauth/token
      user_url = https://gitlab.com/api/v4/user
      token_scope = read_user
      token_label = Bearer
      id_from = id
      fullname_from = name
      nickname_from = username
      email_from = email

      [default_group_limits]
      asset_size_limit = 60
      result_storage_duration = 90

      # The gate schedules without a job group
      [no_group_limits]
      result_storage_duration = 90

      # No systemd cleanup timers in the container
      [minion_task_triggers]
      on_job_done = limit_results_and_logs limit_assets

      [misc_limits]
      untracked_assets_storage_duration = 7
    '';

    "openqa-database.ini" = mkConfig ''
      [production]
      dsn = DBI:Pg:dbname=openqa;host=${aerialisContainers.postgres}
      user = openqa
      password = ${ph."openqa/db_password"}
    '';

    # Section = HOST in workers.ini
    "openqa-client.conf" = mkConfig ''
      [webui]
      key = ${ph."openqa/api_key"}
      secret = ${ph."openqa/api_secret"}
    '';
  };

  system.stateVersion = "26.11";
}

Docker containers

services:
  webui:
    image: registry.opensuse.org/devel/openqa/containers16.1/openqa_webui:latest
    container_name: openqa-webui
    ports: ['80:80']
    volumes:
      - ./openqa.ini:/data/conf/openqa.ini:ro
      - ./database.ini:/data/conf/database.ini:ro
      - /var/lib/openqa-data/factory:/data/factory
      - /var/lib/openqa-data/images:/data/images
      - /var/lib/openqa-data/testresults:/data/testresults
      - /var/lib/openqa-data/tests:/data/tests
    # Created empty by the upstream Dockerfile, missing in the pulled image
    tmpfs: [/srv/www/htdocs, /var/log/apache2]
    healthcheck:
      test: [CMD, curl, -f, "http://localhost:9526/login"]
      interval: 30s
      timeout: 5s
      retries: 5
      start_period: 60s
    restart: always

  worker:
    image: registry.gitlab.com/garuda-linux/tools/image-builder/openqa-worker:latest
    container_name: openqa-worker
    devices: [/dev/kvm]
    environment:
      OPENQA_WORKER_INSTANCE: '1'
    volumes:
      - ./workers.ini:/data/conf/workers.ini:ro
      - ./client.conf:/data/conf/client.conf:ro
      - /var/lib/openqa-data/factory:/data/factory
      - /var/lib/openqa-data/tests:/data/tests:ro
      - /var/lib/openqa-data/pool:/var/lib/openqa/pool
    depends_on:
      webui:
        condition: service_healthy
    restart: always