Skip to content

ci: conditionally run e2es#4351

Merged
QxBytes merged 32 commits intomasterfrom
alew/conditional-test
Apr 21, 2026
Merged

ci: conditionally run e2es#4351
QxBytes merged 32 commits intomasterfrom
alew/conditional-test

Conversation

@QxBytes
Copy link
Copy Markdown
Contributor

@QxBytes QxBytes commented Apr 14, 2026

Reason for Change:

Does not run cilium e2es if we only modify cni/ ipam/ or network/
Does not run windows e2es if we only modify linux or test files (still runs windows e2es)

Issue Fixed:

Requirements:

Notes:
If this is triggered in the merge queue, the PR is not classified as Pull Request and might not have target branch set, in which case it might diff against master instead of the branch it will merge into. I have made a change to detect the source branch if it is in the merge queue and extract the target branch that way, but even if it doesn't detect that it just means we might run more tests than necessary. If there are no files changed, should run all tests. If branch is refs/tag (tagged run) we also run all tests.

@QxBytes QxBytes self-assigned this Apr 14, 2026
@QxBytes QxBytes added the ci Infra or tooling. label Apr 14, 2026
@QxBytes QxBytes force-pushed the alew/conditional-test branch from 97eaa3e to 2738558 Compare April 14, 2026 21:08
@QxBytes QxBytes force-pushed the alew/conditional-test branch from 2738558 to 49376fb Compare April 14, 2026 21:31
@QxBytes
Copy link
Copy Markdown
Contributor Author

QxBytes commented Apr 20, 2026

/azp run Azure Container Networking PR

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@QxBytes QxBytes marked this pull request as ready for review April 20, 2026 20:57
@QxBytes QxBytes requested a review from a team as a code owner April 20, 2026 20:57
@QxBytes QxBytes requested review from Copilot and thomasricci April 20, 2026 20:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a git-diff–based gating mechanism to the Azure DevOps pipeline so that expensive E2E stages (Cilium and Windows) can be skipped when changes are limited to specific areas of the repo.

Changes:

  • Added a script to determine whether Windows and/or Cilium E2Es should run based on files changed vs the target branch.
  • Added a pipeline template step that runs the script and exports RunWindowsTests / RunCiliumTests as output variables.
  • Updated multiple E2E stage templates and the main pipeline to conditionally run (and delete) clusters based on those outputs.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
hack/scripts/check-changed-files.sh Computes changed files vs merge-base and emits RUN_WINDOWS_TESTS / RUN_CILIUM_TESTS.
.pipelines/templates/git-diff-check.yaml Runs the diff check script and sets ADO output variables for downstream stage conditions.
.pipelines/pipeline.yaml Wires in the diff-check step and splits delete stages to align with conditional execution.
.pipelines/singletenancy/cilium/cilium-e2e-job-template.yaml Gates Cilium cluster creation + E2E stages on RunCiliumTests.
.pipelines/singletenancy/cilium-overlay/cilium-overlay-e2e-job-template.yaml Gates Cilium overlay E2Es on RunCiliumTests.
.pipelines/singletenancy/cilium-overlay-withhubble/cilium-overlay-e2e-job-template.yaml Gates Cilium overlay-with-hubble E2Es on RunCiliumTests.
.pipelines/singletenancy/cilium-nodesubnet/cilium-nodesubnet-e2e-job-template.yaml Gates Cilium nodesubnet E2Es on RunCiliumTests.
.pipelines/singletenancy/cilium-dualstack-overlay/cilium-dualstackoverlay-e2e-job-template.yaml Gates Cilium dualstack overlay E2Es on RunCiliumTests.
.pipelines/singletenancy/aks/e2e-job-template.yaml Gates Windows AKS cluster creation on RunWindowsTests.
.pipelines/singletenancy/dualstack-overlay/dualstackoverlay-e2e-job-template.yaml Gates Windows dualstack overlay cluster creation on RunWindowsTests.
.pipelines/singletenancy/azure-cni-overlay/azure-cni-overlay-e2e-job-template.yaml Adds Windows gating for Azure overlay cluster creation (currently inverted in the diff).
.pipelines/singletenancy/azure-cni-overlay-stateless/azure-cni-overlay-stateless-e2e-job-template.yaml Gates stateless Windows overlay cluster creation on RunWindowsTests.
.pipelines/singletenancy/aks-swift/e2e-job-template.yaml Moves the tag-match condition to the stage level for AKS Swift E2Es.
Comments suppressed due to low confidence (2)

.pipelines/singletenancy/dualstack-overlay/dualstackoverlay-e2e-job-template.yaml:40

  • This condition gates only the cluster creation stage on RunWindowsTests, but the downstream E2E stage has no corresponding condition and may still run if the create stage is skipped. Add the same RunWindowsTests gate to the E2E stage (or explicitly check the dependency stage result) to avoid running E2Es without a created cluster.
  - stage: ${{ parameters.clusterName }}
    displayName: ${{ parameters.displayName }} - Create Cluster
    condition: or(
        eq('${{ parameters.os }}', 'linux'),
        and(eq('${{ parameters.os }}', 'windows'), eq(dependencies.setup.outputs['env.GitDiffCheck.RunWindowsTests'], 'true'))
      )
    dependsOn:
      - ${{ parameters.dependsOn }}
      - setup
    pool:

.pipelines/singletenancy/azure-cni-overlay-stateless/azure-cni-overlay-stateless-e2e-job-template.yaml:31

  • RunWindowsTests gating is applied to the create-cluster stage, but the E2E stage that depends on it has no corresponding condition and may still run when the create stage is skipped. Add the same gate to the E2E stage (or explicitly check dependency stage result) to avoid running E2Es without a created cluster.
  - stage: ${{ parameters.clusterName }}
    displayName: ${{ parameters.displayName }} - Create Cluster
    condition: eq(dependencies.setup.outputs['env.GitDiffCheck.RunWindowsTests'], 'true')
    dependsOn:
      - ${{ parameters.dependsOn }}
      - setup
    pool:

Comment thread .pipelines/templates/git-diff-check.yaml Outdated
Comment thread hack/scripts/check-changed-files.sh
Comment thread .pipelines/singletenancy/aks/e2e-job-template.yaml
@QxBytes
Copy link
Copy Markdown
Contributor Author

QxBytes commented Apr 20, 2026

/azp run Azure Container Networking PR

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@QxBytes QxBytes force-pushed the alew/conditional-test branch from dc46a5e to 582e532 Compare April 20, 2026 21:32
@QxBytes QxBytes force-pushed the alew/conditional-test branch from 582e532 to 6c7050c Compare April 20, 2026 21:43
@QxBytes
Copy link
Copy Markdown
Contributor Author

QxBytes commented Apr 20, 2026

/azp run Azure Container Networking PR

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Comment thread .pipelines/singletenancy/aks-swift/e2e-job-template.yaml
jpayne3506
jpayne3506 previously approved these changes Apr 20, 2026
Copy link
Copy Markdown
Contributor

@jpayne3506 jpayne3506 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Talked to @QxBytes offline. We could have leveraged path filters + multiple pipelines to get the same result, but didn't want to deal with image generation and additional dependencies.

Comment thread .pipelines/templates/git-diff-check.yaml
Comment thread .pipelines/templates/git-diff-check.yaml
@QxBytes
Copy link
Copy Markdown
Contributor Author

QxBytes commented Apr 21, 2026

/azp run Azure Container Networking PR

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@QxBytes QxBytes enabled auto-merge April 21, 2026 00:15
@QxBytes QxBytes added this pull request to the merge queue Apr 21, 2026
Merged via the queue into master with commit e08ed7f Apr 21, 2026
53 of 54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Infra or tooling.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants