Add DisableNewBranchLogic opt-out flag for branch-name override#5141
Add DisableNewBranchLogic opt-out flag for branch-name override#5141LoopedBard3 wants to merge 1 commit intodotnet:mainfrom
Conversation
Add a queue-time variable DisableNewBranchLogic to the performance pipeline YAMLs. When set to 'true', it skips the branch-name append logic from dotnet#5131 so results always upload as main — allowing custom perf branches to still ingest against the main branch. Pass the variable as DISABLE_NEW_BRANCH_LOGIC env var to the Python script, which checks it before applying the branch override. Set it in the 'Run pipeline' UI under Variables. New behavior remains the default when the variable isn't set. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds an opt-out flag to disable the newer perf-repo branch-name override logic so perf results can be uploaded as main when desired.
Changes:
- Added
DISABLE_NEW_BRANCH_LOGICenvironment flag to gate the perf branch-append logic inrun_performance_job.py. - Plumbed a new AzDO queue-time variable
DisableNewBranchLogicinto the script step’s environment.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| scripts/run_performance_job.py | Gates perf-repo branch override behind a DISABLE_NEW_BRANCH_LOGIC env var. |
| eng/pipelines/templates/run-performance-job-script-step.yml | Passes the new queue-time variable into the script as an environment variable. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if perf_branch and perf_branch != "main": | ||
| ci_setup_arguments.perf_repo_branch = perf_branch | ||
| # Set DisableNewBranchLogic=true as a queue-time variable to revert to always uploading as main | ||
| disable_branch_logic = os.environ.get("DISABLE_NEW_BRANCH_LOGIC", "").lower() == "true" |
There was a problem hiding this comment.
The boolean env var parsing is very strict (only exact 'true' matches). This is easy to mis-set in pipeline UI (e.g., 'True', ' true', '1', 'yes') and will silently not opt out. Consider normalizing with .strip() and accepting a small set of truthy values (e.g., {'true','1','yes','y','on'}) to make the flag more robust.
| disable_branch_logic = os.environ.get("DISABLE_NEW_BRANCH_LOGIC", "").lower() == "true" | |
| disable_branch_logic_value = os.environ.get("DISABLE_NEW_BRANCH_LOGIC", "") | |
| disable_branch_logic = disable_branch_logic_value.strip().lower() in {"true", "1", "yes", "y", "on"} |
| perf_branch = perf_repo_ref.replace("refs/heads/", "").replace("refs/tags/", "") | ||
| if perf_branch and perf_branch != "main": | ||
| ci_setup_arguments.perf_repo_branch = perf_branch | ||
| # Set DisableNewBranchLogic=true as a queue-time variable to revert to always uploading as main |
There was a problem hiding this comment.
The comment references the queue-time variable name (DisableNewBranchLogic), but the code reads a different env var name (DISABLE_NEW_BRANCH_LOGIC). To reduce operator confusion, consider clarifying in the comment that DisableNewBranchLogic is the pipeline variable and it is mapped to DISABLE_NEW_BRANCH_LOGIC for the script, and note the expected value format (e.g., 'true').
| # Set DisableNewBranchLogic=true as a queue-time variable to revert to always uploading as main | |
| # Set the queue-time/pipeline variable DisableNewBranchLogic=true to revert to always uploading as main. | |
| # In this script, the CI system exposes that variable as the environment variable DISABLE_NEW_BRANCH_LOGIC, | |
| # and the logic is disabled when its value (case-insensitive) is the string "true". |
Add a queue-time variable DisableNewBranchLogic to the performance pipeline YAMLs. When set to 'true', it skips the branch-name append logic from #5131 so results always upload as main — allowing custom perf branches to still ingest against the main branch.
Pass the variable as DISABLE_NEW_BRANCH_LOGIC env var to the Python script, which checks it before applying the branch override.
Set it in the 'Run pipeline' UI under Variables. New behavior remains the default when the variable isn't set.