|
| 1 | +name: Linux A/B Testing Verification |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - '**' |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - '**' |
| 10 | + workflow_dispatch: # Allow manual triggering |
| 11 | + |
| 12 | +jobs: |
| 13 | + linux-ab-testing-verification: |
| 14 | + name: Verify Linux A/B Testing Variables |
| 15 | + runs-on: ubuntu-latest |
| 16 | + strategy: |
| 17 | + matrix: |
| 18 | + distro_container: |
| 19 | + - debian:testing |
| 20 | + - fedora:latest |
| 21 | + build_method: |
| 22 | + - target |
| 23 | + - 9p |
| 24 | + - builder |
| 25 | + |
| 26 | + container: ${{ matrix.distro_container }} |
| 27 | + steps: |
| 28 | + - name: Document test environment |
| 29 | + run: | |
| 30 | + echo "Running Linux A/B testing verification on ${{ matrix.distro_container }}" |
| 31 | + echo "Build method: ${{ matrix.build_method }}" |
| 32 | + uname -a |
| 33 | +
|
| 34 | + - name: Install dependencies |
| 35 | + run: | |
| 36 | + if [ "${{ matrix.distro_container }}" = "debian:testing" ]; then |
| 37 | + echo "Installing packages for Debian" |
| 38 | + apt-get update |
| 39 | + apt-get install -y ansible-core make gcc ncurses-dev bison flex git python3 |
| 40 | + elif [ "${{ matrix.distro_container }}" = "fedora:latest" ]; then |
| 41 | + echo "Installing packages for Fedora" |
| 42 | + dnf install -y ansible make gcc ncurses-devel bison flex git python3 |
| 43 | + else |
| 44 | + echo "Unknown distribution: ${{ matrix.distro_container }}" |
| 45 | + exit 1 |
| 46 | + fi |
| 47 | +
|
| 48 | + - name: Checkout repository |
| 49 | + uses: actions/checkout@v4 |
| 50 | + |
| 51 | + - name: Configure git for kdevops |
| 52 | + run: | |
| 53 | + git config --global --add safe.directory '*' |
| 54 | + git config --global user.name "kdevops-ci" |
| 55 | + git config --global user.email "[email protected]" |
| 56 | +
|
| 57 | + - name: Apply A/B testing defconfig |
| 58 | + run: | |
| 59 | + echo "Applying linux-ab-testing-${{ matrix.build_method }} defconfig" |
| 60 | + make defconfig-linux-ab-testing-${{ matrix.build_method }} |
| 61 | +
|
| 62 | + # Verify configuration was applied correctly |
| 63 | + echo "=== Verifying A/B testing configuration ===" |
| 64 | + grep -E "CONFIG_KDEVOPS_BASELINE_AND_DEV=y" .config || exit 1 |
| 65 | + grep -E "CONFIG_BOOTLINUX_AB_DIFFERENT_REF=y" .config || exit 1 |
| 66 | +
|
| 67 | + # Check build method specific configs |
| 68 | + case "${{ matrix.build_method }}" in |
| 69 | + target) |
| 70 | + grep -E "CONFIG_BOOTLINUX_TARGET=y" .config || exit 1 |
| 71 | + ;; |
| 72 | + 9p) |
| 73 | + grep -E "CONFIG_BOOTLINUX_9P=y" .config || exit 1 |
| 74 | + ;; |
| 75 | + builder) |
| 76 | + grep -E "CONFIG_BOOTLINUX_BUILDER=y" .config || exit 1 |
| 77 | + ;; |
| 78 | + esac |
| 79 | +
|
| 80 | + - name: Run make to generate extra_vars.yaml |
| 81 | + run: | |
| 82 | + make |
| 83 | +
|
| 84 | + - name: Extract and verify kernel references |
| 85 | + run: | |
| 86 | + echo "=== Extracting kernel references from configuration ===" |
| 87 | +
|
| 88 | + # Get the baseline ref (should be master or main) |
| 89 | + BASELINE_REF=$(grep "^bootlinux_tree_ref:" extra_vars.yaml | awk '{print $2}') |
| 90 | + echo "Baseline ref: $BASELINE_REF" |
| 91 | +
|
| 92 | + # Get the dev ref using the inference script |
| 93 | + DEV_REF=$(grep "^bootlinux_dev_tree_ref:" extra_vars.yaml | awk '{print $2}') |
| 94 | + echo "Dev ref from config: $DEV_REF" |
| 95 | +
|
| 96 | + # Since we're in a container without /mirror/linux.git, the script will fallback |
| 97 | + # For CI, we'll simulate getting the latest stable tag |
| 98 | + if [ -f scripts/infer_last_stable_kernel.sh ]; then |
| 99 | + INFERRED_STABLE=$(./scripts/infer_last_stable_kernel.sh 2>/dev/null || echo "v6.12") |
| 100 | + echo "Inferred stable version: $INFERRED_STABLE" |
| 101 | + fi |
| 102 | +
|
| 103 | + # Verify refs are different |
| 104 | + if [ "$BASELINE_REF" = "$DEV_REF" ]; then |
| 105 | + echo "ERROR: Baseline and dev refs should be different for A/B testing" |
| 106 | + exit 1 |
| 107 | + fi |
| 108 | +
|
| 109 | + # Store refs for later verification |
| 110 | + echo "BASELINE_REF=$BASELINE_REF" >> $GITHUB_ENV |
| 111 | + echo "DEV_REF=$DEV_REF" >> $GITHUB_ENV |
| 112 | +
|
| 113 | + - name: Test debug functionality with Ansible |
| 114 | + run: | |
| 115 | + echo "=== Testing debug output with DEBUG_REF=1 ===" |
| 116 | +
|
| 117 | + # Create a minimal hosts file for container testing |
| 118 | + cat > hosts << EOF |
| 119 | + [all] |
| 120 | + localhost ansible_connection=local |
| 121 | +
|
| 122 | + [baseline] |
| 123 | + localhost ansible_connection=local |
| 124 | +
|
| 125 | + [dev] |
| 126 | + EOF |
| 127 | +
|
| 128 | + # Run the bootlinux playbook with debug enabled and capture output |
| 129 | + export DEBUG_REF=1 |
| 130 | + ansible-playbook -i hosts playbooks/bootlinux.yml --tags vars,debug -v > debug_output.txt 2>&1 || true |
| 131 | +
|
| 132 | + # Verify debug output based on build method |
| 133 | + case "${{ matrix.build_method }}" in |
| 134 | + 9p) |
| 135 | + echo "=== Verifying 9P debug output (localhost context) ===" |
| 136 | + if grep -q "active_linux_ref" debug_output.txt; then |
| 137 | + echo "✓ Found active_linux_ref in 9P debug output" |
| 138 | + else |
| 139 | + echo "✗ Missing active_linux_ref in 9P debug output" |
| 140 | + cat debug_output.txt |
| 141 | + exit 1 |
| 142 | + fi |
| 143 | + ;; |
| 144 | + target|builder) |
| 145 | + echo "=== Verifying non-9P debug output (per-node context) ===" |
| 146 | + if grep -q "target_linux_ref" debug_output.txt; then |
| 147 | + echo "✓ Found target_linux_ref in non-9P debug output" |
| 148 | + else |
| 149 | + echo "✗ Missing target_linux_ref in non-9P debug output" |
| 150 | + cat debug_output.txt |
| 151 | + exit 1 |
| 152 | + fi |
| 153 | + ;; |
| 154 | + esac |
| 155 | +
|
| 156 | + - name: Verify A/B testing Makefile rules |
| 157 | + run: | |
| 158 | + echo "=== Verifying A/B testing Makefile structure ===" |
| 159 | +
|
| 160 | + # Check that linux target depends on linux-baseline and linux-dev |
| 161 | + if grep -A5 "^linux:" workflows/linux/Makefile | grep -q "linux-baseline linux-dev"; then |
| 162 | + echo "✓ Makefile has correct A/B testing dependencies" |
| 163 | + else |
| 164 | + echo "✗ Makefile missing A/B testing dependencies" |
| 165 | + exit 1 |
| 166 | + fi |
| 167 | +
|
| 168 | + # Verify linux-baseline and linux-dev targets exist |
| 169 | + if grep -q "^linux-baseline:" workflows/linux/Makefile && \ |
| 170 | + grep -q "^linux-dev:" workflows/linux/Makefile; then |
| 171 | + echo "✓ Both linux-baseline and linux-dev targets exist" |
| 172 | + else |
| 173 | + echo "✗ Missing linux-baseline or linux-dev targets" |
| 174 | + exit 1 |
| 175 | + fi |
| 176 | +
|
| 177 | + - name: Test variable resolution patterns |
| 178 | + run: | |
| 179 | + echo "=== Testing variable resolution patterns ===" |
| 180 | +
|
| 181 | + # Create test playbook to verify variable resolution |
| 182 | + cat > test_vars.yml << 'EOF' |
| 183 | + --- |
| 184 | + - hosts: localhost |
| 185 | + connection: local |
| 186 | + tasks: |
| 187 | + - name: Load extra vars |
| 188 | + include_vars: extra_vars.yaml |
| 189 | +
|
| 190 | + - name: Display loaded variables |
| 191 | + debug: |
| 192 | + msg: | |
| 193 | + bootlinux_tree_ref: {{ bootlinux_tree_ref | default('undefined') }} |
| 194 | + bootlinux_dev_tree_ref: {{ bootlinux_dev_tree_ref | default('undefined') }} |
| 195 | + kdevops_baseline_and_dev: {{ kdevops_baseline_and_dev | default(false) }} |
| 196 | + bootlinux_ab_different_ref: {{ bootlinux_ab_different_ref | default(false) }} |
| 197 | + EOF |
| 198 | +
|
| 199 | + ansible-playbook test_vars.yml -v |
| 200 | +
|
| 201 | + - name: Summary report |
| 202 | + if: always() |
| 203 | + run: | |
| 204 | + echo "=== A/B Testing Verification Summary ===" |
| 205 | + echo "Distribution: ${{ matrix.distro_container }}" |
| 206 | + echo "Build Method: ${{ matrix.build_method }}" |
| 207 | + echo "Baseline Ref: ${BASELINE_REF:-not set}" |
| 208 | + echo "Dev Ref: ${DEV_REF:-not set}" |
| 209 | + echo "" |
| 210 | +
|
| 211 | + if [ -f .config ]; then |
| 212 | + echo "Key configurations:" |
| 213 | + grep -E "(BASELINE_AND_DEV|AB_DIFFERENT_REF|BOOTLINUX_TARGET|BOOTLINUX_9P|BOOTLINUX_BUILDER)" .config | head -10 |
| 214 | + fi |
| 215 | +
|
| 216 | + echo "" |
| 217 | + echo "Test completed successfully ✓" |
0 commit comments