Skip to content

Commit 7a01dbe

Browse files
Fix non-deterministic NuGet packages by enabling ContinuousIntegrationBuild for OneBranch builds (#4251)
1 parent d6e20fc commit 7a01dbe

3 files changed

Lines changed: 41 additions & 0 deletions

File tree

eng/pipelines/onebranch/sqlclient-non-official.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,14 @@ variables:
9696
parameters:
9797
isPreview: ${{ parameters.isPreview }}
9898

99+
# Drives ContinuousIntegrationBuild=true in src/Directory.Build.props so this
100+
# pipeline produces deterministic packages identical (modulo signing) to the
101+
# official pipeline. Keeping this enabled here ensures the deterministic
102+
# build path is exercised on every non-official run, catching regressions
103+
# before they reach the official release pipeline.
104+
- name: BuildForRelease
105+
value: true
106+
99107
resources:
100108
repositories:
101109
- repository: templates

eng/pipelines/onebranch/sqlclient-official.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,13 @@ variables:
118118
parameters:
119119
isPreview: ${{ parameters.isPreview }}
120120

121+
# Drives ContinuousIntegrationBuild=true in src/Directory.Build.props so the shipped
122+
# DLLs/PDBs embed portable /_/... source paths and the produced NuGet packages pass
123+
# NuGet Package Explorer's "Deterministic (build)" check. Set on both OneBranch
124+
# pipelines; PR/CI builds leave it unset (false).
125+
- name: BuildForRelease
126+
value: true
127+
121128
resources:
122129
repositories:
123130
- repository: templates

src/Directory.Build.props

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,32 @@
126126
<PublishRepositoryUrl>true</PublishRepositoryUrl>
127127
<EmbedUnTrackedSources>true</EmbedUnTrackedSources>
128128
<DisableSourceLinkTranslation Condition="'$(DisableSourceLinkTranslation)' == ''">false</DisableSourceLinkTranslation>
129+
130+
<!--
131+
BuildForRelease gates the release-only behaviors below. It defaults to false so that
132+
PR validation, scheduled CI, and local developer builds use the simpler dev-friendly
133+
behavior. Both OneBranch pipelines (official and non-official) set this to true via
134+
a pipeline variable so that release packages are built deterministically and the
135+
non-official pipeline exercises the same path as official before any release.
136+
-->
137+
<BuildForRelease Condition="'$(BuildForRelease)' == ''">false</BuildForRelease>
138+
139+
<!--
140+
Explicit deterministic build flag. This is also the SDK default, but we set it
141+
explicitly so the build does not silently regress if a future SDK changes the default.
142+
-->
143+
<Deterministic>true</Deterministic>
144+
145+
<!--
146+
ContinuousIntegrationBuild enables DeterministicSourcePaths, which remaps the source
147+
root to a portable form (/_/...) inside embedded PDB paths. Without this property
148+
set to true, NuGet Package Explorer's "Deterministic (build)" check fails because
149+
the PDBs embed absolute build-agent paths (e.g. C:\__w\1\s\...).
150+
151+
Gated on BuildForRelease so PR/CI/local builds keep their pre-#4204 behavior; both
152+
OneBranch pipelines (which set BuildForRelease=true) enable this.
153+
-->
154+
<ContinuousIntegrationBuild Condition="'$(ContinuousIntegrationBuild)' == ''">$(BuildForRelease)</ContinuousIntegrationBuild>
129155
</PropertyGroup>
130156

131157
<!-- Provides Build properties -->

0 commit comments

Comments
 (0)