diff --git a/.github/scripts/matrix.py b/.github/scripts/matrix.py index 2c9e8aff..b88d2d48 100644 --- a/.github/scripts/matrix.py +++ b/.github/scripts/matrix.py @@ -135,6 +135,7 @@ class BuildConfig: run_veristat: bool = False parallel_tests: bool = False build_release: bool = False + is_netdev: bool = False @property def runs_on(self) -> List[str]: @@ -184,7 +185,7 @@ def tests(self) -> Dict[str, Any]: if self.llvm_version >= 18: tests_list.append("test_progs_cpuv4") - if self.arch in [Arch.X86_64, Arch.AARCH64]: + if self.arch in [Arch.X86_64, Arch.AARCH64] and not self.is_netdev: tests_list.append("sched_ext") # Don't run GCC BPF runner, because too many tests are failing @@ -207,6 +208,7 @@ def to_dict(self) -> Dict[str, Any]: "run_veristat": self.run_veristat, "parallel_tests": self.parallel_tests, "build_release": self.build_release, + "is_netdev": self.is_netdev, "runs_on": self.runs_on, "tests": self.tests, "build_runs_on": self.build_runs_on, @@ -270,6 +272,17 @@ def generate_test_config(test: str) -> Dict[str, Union[str, int]]: if not is_managed_repo(): matrix = [config for config in matrix if config.arch == Arch.X86_64] + # Detect netdev PRs: head repo is linux-netdev/testing-bpf-ci and branch is to-test + pr_head_repo = os.environ.get("PR_HEAD_REPO", "") + head_ref = os.environ.get("GITHUB_HEAD_REF", "") + is_netdev = pr_head_repo == "linux-netdev/testing-bpf-ci" and head_ref == "to-test" + if is_netdev: + print("Netdev PR detected, disabling BPF-specific jobs") + for config in matrix: + config.run_veristat = False + config.build_release = False + config.is_netdev = True + json_matrix = json.dumps({"include": [config.to_dict() for config in matrix]}) print(json.dumps(json.loads(json_matrix), indent=4)) set_output("build_matrix", json_matrix) diff --git a/.github/workflows/kernel-build-test.yml b/.github/workflows/kernel-build-test.yml index 26dc86be..87416c70 100644 --- a/.github/workflows/kernel-build-test.yml +++ b/.github/workflows/kernel-build-test.yml @@ -57,6 +57,11 @@ on: type: boolean description: Build selftests with -O2 optimization in addition to non-optimized build. default: false + is_netdev: + required: true + type: boolean + description: Whether this is a netdev PR. When true, BPF-specific jobs like GCC BPF are skipped. + default: false secrets: AWS_ROLE_ARN: required: true @@ -179,7 +184,7 @@ jobs: gcc-bpf: name: 'GCC BPF' - if: ${{ inputs.arch == 'x86_64' }} + if: ${{ inputs.arch == 'x86_64' && !inputs.is_netdev }} uses: ./.github/workflows/gcc-bpf.yml needs: [build] with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 94016080..4bf0f107 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,6 +33,7 @@ jobs: - id: set-matrix-impl env: GITHUB_TOKEN: ${{ secrets.GH_PAT_READ_RUNNERS }} + PR_HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name }} run: | python3 .github/scripts/matrix.py @@ -64,5 +65,6 @@ jobs: # Download sources download_sources: ${{ github.repository == 'kernel-patches/vmtest' }} build_release: ${{ matrix.build_release }} + is_netdev: ${{ matrix.is_netdev }} secrets: AWS_ROLE_ARN: ${{ secrets.AWS_ROLE_ARN }}