diff options
author | Joey Hewitt <joey@joeyhewitt.com> | 2019-07-01 11:32:30 -0600 |
---|---|---|
committer | Joey Hewitt <joey@joeyhewitt.com> | 2019-07-07 21:47:09 -0600 |
commit | 0e6bb4e898f14af1b476c07cd1da65f4cccc3ee1 (patch) | |
tree | e6f34452ae32220fd9952b1cad403c9259fd1b04 /.gitlab-ci.yml | |
parent | 05d963e751070f6a5b4a831b075176a7bdae0b38 (diff) |
workaround GitLab CI KVM issue
Their CI environment currently doesn't have KVM. This commit should be
reverted when/if they do, for much better CI speed.
You can still run tests locally on your KVM-enabled machine as documented
on the wiki.
Workaround on GitLab is several pieces (injected through .gitlab-ci.yml):
- Make a /dev/kvm file so that nix thinks we have "kvm" system feature
and proceeds with executing the tests.
- Inject a QEMU package that replaces qemu-kvm with a full emulator.
- Monkey-patch the test script to wait longer for the VM to boot, since
it's slow on full emulation. 1200 seconds, double the previous value.
The patch method is not bulletproof, but better than maintaining forks of
nixpkgs.
- Set systemd's DefaultTimeoutStartSec=15min, so nix's "backdoor" test
service doesn't time out on the slow boot.
Diffstat (limited to '.gitlab-ci.yml')
-rw-r--r-- | .gitlab-ci.yml | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2e5b6aa..ac6f54b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,41 +1,47 @@ +before_script: + # report CPU info so we can monitor if real KVM becomes available. create /dev/kvm to fool nix + - cat /proc/cpuinfo + - ls -l /dev/kvm || true + - touch /dev/kvm + nixos-intern: image: nixos/nix variables: NIX_PATH: "nixpkgs=https://github.com/NixOS/nixpkgs-channels/archive/nixos-19.03.tar.gz" script: - - nix-build tests/intern.nix + - nix-build --arg pkgs 'import tests/lib/pkgs.nokvm.nix' tests/intern.nix nixos-extern: image: nixos/nix variables: NIX_PATH: "nixpkgs=https://github.com/NixOS/nixpkgs-channels/archive/nixos-19.03.tar.gz" script: - - nix-build tests/extern.nix + - nix-build --arg pkgs 'import tests/lib/pkgs.nokvm.nix' tests/extern.nix nixos-clamav: image: nixos/nix variables: NIX_PATH: "nixpkgs=https://github.com/NixOS/nixpkgs-channels/archive/nixos-19.03.tar.gz" script: - - nix-build tests/clamav.nix + - nix-build --arg pkgs 'import tests/lib/pkgs.nokvm.nix' tests/clamav.nix nixos-unstable-intern: image: nixos/nix variables: NIX_PATH: "nixpkgs=https://github.com/NixOS/nixpkgs-channels/archive/nixos-unstable.tar.gz" script: - - nix-build tests/intern.nix + - nix-build --arg pkgs 'import tests/lib/pkgs.nokvm.nix' tests/intern.nix nixos-unstable-extern: image: nixos/nix variables: NIX_PATH: "nixpkgs=https://github.com/NixOS/nixpkgs-channels/archive/nixos-unstable.tar.gz" script: - - nix-build tests/extern.nix + - nix-build --arg pkgs 'import tests/lib/pkgs.nokvm.nix' tests/extern.nix nixos-unstable-clamav: image: nixos/nix variables: NIX_PATH: "nixpkgs=https://github.com/NixOS/nixpkgs-channels/archive/nixos-unstable.tar.gz" script: - - nix-build tests/clamav.nix + - nix-build --arg pkgs 'import tests/lib/pkgs.nokvm.nix' tests/clamav.nix |