-
Notifications
You must be signed in to change notification settings - Fork 1
feat: cluster test framework #545
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
base: master
Are you sure you want to change the base?
Changes from all commits
adcb184
b01e734
de92f15
5516012
7171bea
96be296
bfeb083
f0978b2
011e1f6
7135633
6a41e02
d600b72
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,32 @@ | ||||||||||||||||||||||||||||||||
| # PR-only, KVM. | ||||||||||||||||||||||||||||||||
| # Build nixosTestConfigurations.* for all server hosts. | ||||||||||||||||||||||||||||||||
| # TODO: affected-host build (PR-changed only). | ||||||||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||||||||
| # Independent of check.yaml. | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| labels: | ||||||||||||||||||||||||||||||||
| platform: linux/amd64 | ||||||||||||||||||||||||||||||||
| kvm: true | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| when: | ||||||||||||||||||||||||||||||||
| - event: pull_request | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||
| - name: Build VM tests | ||||||||||||||||||||||||||||||||
| image: registry.racci.dev/lix-woodpecker:latest | ||||||||||||||||||||||||||||||||
| pull: true | ||||||||||||||||||||||||||||||||
| environment: | ||||||||||||||||||||||||||||||||
| binary_cache_token: | ||||||||||||||||||||||||||||||||
| from_secret: binary_cache_token | ||||||||||||||||||||||||||||||||
| commands: | | ||||||||||||||||||||||||||||||||
| nix run .#setup-attic -- --watch | ||||||||||||||||||||||||||||||||
| nix run .#archive-flakes -- "." "flake/nixos" | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| - name: Run VM tests | ||||||||||||||||||||||||||||||||
| image: registry.racci.dev/lix-woodpecker:latest | ||||||||||||||||||||||||||||||||
| commands: | | ||||||||||||||||||||||||||||||||
| for host in $(nix eval .#nixosTestConfigurations --apply 'builtins.attrNames' --json | jq -r '.[]'); do | ||||||||||||||||||||||||||||||||
| echo "::group::VM test: $host" | ||||||||||||||||||||||||||||||||
| nix build ".#nixosTestConfigurations.$host" --no-link -L || echo "FAILED: $host" | ||||||||||||||||||||||||||||||||
| echo "::endgroup::" | ||||||||||||||||||||||||||||||||
| done | ||||||||||||||||||||||||||||||||
|
Comment on lines
+28
to
+32
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚀 Performance & Scalability | 🔵 Trivial Sequential per-host loop won't scale as hosts/scenarios grow. All builds run serially in a single shell loop on one agent, so total CI time grows linearly with the host count. Native Woodpecker 🤖 Prompt for AI Agents🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win Per-host build failures are swallowed — the step always reports success. Woodpecker runs step 🐛 Proposed fix to propagate failures - name: Run VM tests
image: registry.racci.dev/lix-woodpecker:latest
commands: |
+ status=0
for host in $(nix eval .#nixosTestConfigurations --apply 'builtins.attrNames' --json | jq -r '.[]'); do
echo "::group::VM test: $host"
- nix build ".#nixosTestConfigurations.$host" --no-link -L || echo "FAILED: $host"
+ if ! nix build ".#nixosTestConfigurations.$host" --no-link -L; then
+ echo "FAILED: $host"
+ status=1
+ fi
echo "::endgroup::"
done
+ exit $status📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| #!/usr/bin/env bash | ||
| # QEMU VM integration test runner - sequential | ||
| # Usage: bash _run_tests.sh | ||
|
|
||
| set -o pipefail | ||
|
|
||
| HOSTS=("nixai" "nixmon" "nixdev" "nixio") | ||
|
DaRacci marked this conversation as resolved.
|
||
| RESULTS=() | ||
|
|
||
| for host in "${HOSTS[@]}"; do | ||
| echo "" | ||
| echo "============================================" | ||
| echo "=== BUILDING: ${host} ===" | ||
| echo "============================================" | ||
| start=$(date +%s) | ||
| output=$(nix build ".#nixosTestConfigurations.${host}" --no-link -L 2>&1) | ||
| exit_code=$? | ||
| end=$(date +%s) | ||
| elapsed=$((end - start)) | ||
|
|
||
| if [ $exit_code -eq 0 ]; then | ||
| echo "=== PASS: ${host} (${elapsed}s) ===" | ||
| RESULTS+=("PASS:${host}:${elapsed}s") | ||
| else | ||
| echo "=== FAIL: ${host} (exit code ${exit_code}, ${elapsed}s) ===" | ||
| RESULTS+=("FAIL:${host}:exit=${exit_code}:${elapsed}s") | ||
| fi | ||
| # Print last 20 lines of output for context | ||
| echo "--- Last 20 lines of ${host} output ---" | ||
| echo "${output}" | tail -n 20 | ||
| echo "---" | ||
| done | ||
|
|
||
| echo "" | ||
| echo "============================================" | ||
| echo "=== SUMMARY ===" | ||
| echo "============================================" | ||
| for r in "${RESULTS[@]}"; do | ||
| echo "$r" | ||
| done | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 Performance & Scalability | 🔵 Trivial
TODO acknowledges full-host builds; currently every PR builds all server + scenario hosts.
Per the
flake/nixos/flake-module.nixsnippet,nixosTestConfigurationsenumerates every server host plus every scenario directory, so this pipeline will grow linearly (VM builds are expensive) as hosts/scenarios are added. Want help sketching an affected-host filter (e.g., diffinghosts/server/**against the PR's changed files) to close the TODO?🤖 Prompt for AI Agents