Skip to content

Stamp the commit sha into the published image - #1400

Merged
ppXD merged 1 commit into
mainfrom
fix/stamp-the-commit-sha
Aug 14, 2026
Merged

ppXD merged 1 commit into
mainfrom
fix/stamp-the-commit-sha

Conversation

@ppXD

@ppXD ppXD commented Aug 14, 2026

Copy link
Copy Markdown
Owner

Summary

A deployed pod reported:

Running build 1.0.0 in Development; logging to console, searchable copy: https://…

1.0.0 cannot distinguish two deployments, which is the only job a build identity has. The publish never passed SourceRevisionId, so the SDK had nothing to append to AssemblyInformationalVersion.

  • Both Dockerfiles now pass it — from a SOURCE_REVISION_ID build arg when the pipeline knows the sha, from the copied .git otherwise, and unknown as the last resort rather than a version that looks meaningful and is not.
  • BuildIdentity no longer reads Assembly.GetEntryAssembly(). That is whatever launched the process; under dotnet test it is the VSTest host, which reported 17.12.0 — Microsoft's tooling version presented as ours. It now reads the assembly it is defined in.

Verified the attribute actually lands, rather than assuming it:

[assembly: AssemblyInformationalVersionAttribute("1.0.0+39b59e28527e1bfa1f2b498e334103a73104107a")]

Test plan

  • BuildIdentityTests — It_carries_the_source_revision reded on the real defect (Build identity is '17.12.0') before the entry-assembly fix
  • Confirmed -p:SourceRevisionId stamps 1.0.0+<sha> into the published assembly
  • Unit 6476/6476

A deployed pod reported "Running build 1.0.0" -- a version that cannot
tell two deployments apart, which is the only thing a build identity is
for. The publish never passed SourceRevisionId, so the SDK had nothing to
append.

Both Dockerfiles now pass it, from a build arg when the pipeline knows
the sha and from the copied .git otherwise, falling back to "unknown"
rather than to a version that looks meaningful and is not.

BuildIdentity also stops reading Assembly.GetEntryAssembly(). The entry
assembly is whatever launched the process: under dotnet test that is the
VSTest host, which reported 17.12.0 -- a Microsoft tooling version
presented as ours. It now reads the assembly it is defined in, which
every host ships and which is built from this repository.
@ppXD
ppXD merged commit f99f360 into main Aug 14, 2026
6 checks passed
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.

1 participant