Use ONEESPT_BUILDTYPE for official vs unofficial detection#619
Merged
Conversation
The original Build.DefinitionName.EndsWith("(unofficial)") check is
case-sensitive and depends on a human-set naming convention. A pipeline
whose name does not end with exactly that literal suffix would be
misclassified as official and retained forever.
Switch to $env:ONEESPT_BUILDTYPE, which is set by 1ES Pipeline Templates
and is already the source of truth used by docker-tools' validate-branch.yml
and set-dry-run.yml for the same decision.
Mirrors the equivalent fix already applied to microsoft/go-infra-images.
Contributor
There was a problem hiding this comment.
Pull request overview
Switches set-retain-build-var.yml from a brittle Build.DefinitionName suffix check to the 1ESPT-provided ONEESPT_BUILDTYPE environment variable for distinguishing official vs unofficial builds, matching the convention already used in validate-branch.yml and set-dry-run.yml.
Changes:
- Replace
Build.DefinitionName.EndsWith("(unofficial)")check with$env:ONEESPT_BUILDTYPE -ne "Unofficial". - Add explanatory comment about why the env-var-based approach is more reliable.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
dagood
approved these changes
Jun 1, 2026
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request updates the logic for determining official vs. unofficial builds in the
set-retain-build-var.ymlpipeline step. The change switches the source of truth from a naming convention onBuild.DefinitionNameto theONEESPT_BUILDTYPEenvironment variable, which is more reliable and consistent with other pipeline steps.Pipeline reliability improvement:
eng/pipeline/steps/set-retain-build-var.yml: Updated the method for identifying official builds to use theONEESPT_BUILDTYPEenvironment variable instead of relying on the case-sensitive and human-setBuild.DefinitionNamesuffix. This prevents unofficial pipelines with non-conforming names from being incorrectly retained.