You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OptionsService reads option values via a fallback:
Explicit values set via SetOption (called from SettingsApplier after Spectre parses [CommandOption]s).
Environment variables, with names derived from option keys via a camelCase→UPPER_SNAKE regex pipeline in OptionNameToEnvironmentVariableName.
Step 2 is a holdover from the Cake-script era of these workflows, where setting env vars was the natural way to parameterize the build. With bv, CLI args are first-class and just as ergonomic in CI. The fallback now carries cost without offsetting benefit:
The regex pipeline is non-trivial (three passes) and the mapping is undocumented at the option-definition site: from [CommandOption("--main-branch <NAME>")] in BuildSettings.cs, you can't see that MAIN_BRANCH is also accepted. (The two affected [Description] strings spell it out for --configuration and --main-branch only — partial coverage.)
Renaming an option silently breaks any consumer relying on the env-var form. PR [bv] English help output and kebab-case-only release options #261 illustrates: UPDATE_SELF_REFERENCES, documented in CHANGELOG.md as a public surface for 1.1.4, became DOGFOOD with no warning path for users with the old env var still set.
Drop the env-var lookup path from OptionsService.TryGetOptionString. The service becomes a thin key → value map populated only by SetOption. CI workflows pass values via CLI args; nothing else needs to change.
Implementation proposals
Remove the env-var-lookup branch in OptionsService.TryGetOptionString.
Remove OptionNameToEnvironmentVariableName and its three [GeneratedRegex] partials.
Adjust GetOptionOrFail's error message to drop the env-var equivalent reference.
Trim the [Description] text for Configuration and MainBranch in BuildSettings.cs to remove the "or the X environment variable" parenthetical.
CHANGELOG.md documents the removal as a **BREAKING CHANGE**.
steps:
- run: dotnet bv build --main-branch main --configuration Release
Risks
Breaking change for any user relying on env-var defaults in CI. Acceptable scope: bv is in preview, the public env-var surface is already partially broken by the renames in #261, and the migration is a one-line shell change per option.
Additional information
Acceptance criteria
OptionsService reads only from explicitly-set options (no env-var fallback).
BuildSettings.cs descriptions no longer mention env-var fallbacks.
CHANGELOG.md entry under **BREAKING CHANGE**.
dotnet bv pack succeeds with zero errors and zero warnings.
dotnet dnx JetBrains.ReSharper.GlobalTools inspectcode --severity=WARNING … reports zero results.
Reference version
2.0.103-preview.Background and motivation
OptionsServicereads option values via a fallback:SetOption(called fromSettingsApplierafter Spectre parses[CommandOption]s).OptionNameToEnvironmentVariableName.Step 2 is a holdover from the Cake-script era of these workflows, where setting env vars was the natural way to parameterize the build. With
bv, CLI args are first-class and just as ergonomic in CI. The fallback now carries cost without offsetting benefit:[CommandOption("--main-branch <NAME>")]inBuildSettings.cs, you can't see thatMAIN_BRANCHis also accepted. (The two affected[Description]strings spell it out for--configurationand--main-branchonly — partial coverage.)UPDATE_SELF_REFERENCES, documented inCHANGELOG.mdas a public surface for 1.1.4, becameDOGFOODwith no warning path for users with the old env var still set.Proposed enhancement
Drop the env-var lookup path from
OptionsService.TryGetOptionString. The service becomes a thinkey → valuemap populated only bySetOption. CI workflows pass values via CLI args; nothing else needs to change.Implementation proposals
OptionsService.TryGetOptionString.OptionNameToEnvironmentVariableNameand its three[GeneratedRegex]partials.GetOptionOrFail's error message to drop the env-var equivalent reference.[Description]text forConfigurationandMainBranchinBuildSettings.csto remove the "or the X environment variable" parenthetical.CHANGELOG.mddocuments the removal as a**BREAKING CHANGE**.Usage examples
Before, in CI:
After:
Risks
Breaking change for any user relying on env-var defaults in CI. Acceptable scope: bv is in preview, the public env-var surface is already partially broken by the renames in #261, and the migration is a one-line shell change per option.
Additional information
Acceptance criteria
OptionsServicereads only from explicitly-set options (no env-var fallback).BuildSettings.csdescriptions no longer mention env-var fallbacks.CHANGELOG.mdentry under**BREAKING CHANGE**.dotnet bv packsucceeds with zero errors and zero warnings.dotnet dnx JetBrains.ReSharper.GlobalTools inspectcode --severity=WARNING …reports zero results.