Enforce long running pipeline to run only on set schedule on master b…#4209
Enforce long running pipeline to run only on set schedule on master b…#4209sivakami-projects wants to merge 1 commit intomasterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds enforcement to ensure the long running SwiftV2 cluster test pipeline only executes on scheduled runs on the master branch. This prevents concurrent test runs that could interfere with each other by exhausting available NICs on the shared test cluster.
Changes:
- Added a ValidateScheduledRun stage that checks Build.Reason is "Schedule" and Build.SourceBranch is "refs/heads/master"
- Updated AKSClusterAndNetworking stage to depend on ValidateScheduledRun
- Added an unused variable declaration for isScheduledMasterRun
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| .pipelines/swiftv2-long-running/template/long-running-pipeline-template.yaml | Adds validation stage with runtime checks and updates stage dependencies |
| .pipelines/swiftv2-long-running/pipeline.yaml | Defines unused compile-time variable for scheduled master run detection |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| variables: | ||
| # Enforce scheduled runs only on master branch | ||
| - name: isScheduledMasterRun | ||
| value: ${{ and(eq(variables['Build.Reason'], 'Schedule'), eq(variables['Build.SourceBranch'], 'refs/heads/master')) }} | ||
|
|
There was a problem hiding this comment.
The variable 'isScheduledMasterRun' is defined but never used in the pipeline. This variable appears to be redundant since the validation logic is implemented directly in the ValidateScheduledRun stage using shell script checks. Consider removing this unused variable declaration to avoid confusion.
| variables: | |
| # Enforce scheduled runs only on master branch | |
| - name: isScheduledMasterRun | |
| value: ${{ and(eq(variables['Build.Reason'], 'Schedule'), eq(variables['Build.SourceBranch'], 'refs/heads/master')) }} |
| dependsOn: ValidateScheduledRun | ||
| condition: and(succeeded(), eq(${{ parameters.runSetupStages }}, true)) |
There was a problem hiding this comment.
When runSetupStages is false, the datapath test stages will bypass the ValidateScheduledRun stage. This happens because:
- AKSClusterAndNetworking stage has condition
and(succeeded(), eq(parameters.runSetupStages, true))which causes it to be skipped when runSetupStages is false - The datapath test stages depend on AKSClusterAndNetworking (lines 207-213 in long-running-pipeline-template.yaml)
- The datapath test stages have condition
or(eq(parameters.runSetupStages, false), succeeded())which allows them to run even when their dependency is skipped
This means when runSetupStages is false, tests will run without validation, defeating the purpose of this PR. To fix this, the datapath test stages should explicitly include ValidateScheduledRun in their dependencies when runSetupStages is false.
Enforce only scheduled runs to run on the long running test pipeline.
Long running swiftv2 cluster test pipeline, runs data path tests on a pre-created swiftv2 cluster. Multiple runs run simultaneously on the same cluster, it could lead to failures as the pods created by one test could use all the available nics on the cluster, leaving the other runs to fail.
Enforced this by adding a check to validate if the current run is on master branch and if it is a scheduled run.
Reason for Change:
Issue Fixed:
Requirements:
Notes: