Skip to content

Add DisableNewBranchLogic opt-out flag for branch-name override#5141

Open
LoopedBard3 wants to merge 1 commit intodotnet:mainfrom
LoopedBard3:AddAbilityToForceRunsToUploadToMain
Open

Add DisableNewBranchLogic opt-out flag for branch-name override#5141
LoopedBard3 wants to merge 1 commit intodotnet:mainfrom
LoopedBard3:AddAbilityToForceRunsToUploadToMain

Conversation

@LoopedBard3
Copy link
Member

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.

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>
Copy link
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

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_LOGIC environment flag to gate the perf branch-append logic in run_performance_job.py.
  • Plumbed a new AzDO queue-time variable DisableNewBranchLogic into 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"
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
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"}

Copilot uses AI. Check for mistakes.
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
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

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').

Suggested change
# 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".

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants