Add NuGet package to write git.properties file - #1717
Merged
Conversation
bart-vmware
force-pushed
the
git-properties-msbuild
branch
2 times, most recently
from
July 13, 2026 15:09
6ded66c to
c2ae488
Compare
Contributor
Summary - All Code Coverage (ubuntu-latest)
|
bart-vmware
force-pushed
the
git-properties-msbuild
branch
3 times, most recently
from
July 15, 2026 13:41
a045fa7 to
5541b47
Compare
bart-vmware
force-pushed
the
git-properties-msbuild
branch
4 times, most recently
from
July 28, 2026 14:27
ea002dc to
4bde509
Compare
bart-vmware
force-pushed
the
git-properties-msbuild
branch
from
July 28, 2026 15:28
4bde509 to
5fe27dc
Compare
bart-vmware
marked this pull request as ready for review
July 28, 2026 15:39
TimHess
reviewed
Jul 29, 2026
…ple times while multiple TMFs are racing against the lock, each (re)generating the cache. This is by design.
|
5 tasks
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.



Description
Adds a new build-time-only package,
Steeltoe.Management.GitProperties.Build, that generates agit.propertiesfile compatible with the Spring Boot Actuator format, and wires it into the existingInfoactuator endpoint (GitInfoContributor) so the values are automatically exposed at runtime.How it works
src/Management/src/GitProperties.Build) hooks into the build pipeline, auto-detected when a project referencesSteeltoe.Management.Endpoint(configurable viaGenerateGitProperties/GitPropertiesConsumingPackageIds).obj/git.properties.cachefile at the repo root, reused by every project/TFM in a solution. The cache refreshes automatically via MSBuild incremental-build Inputs tracking (HEAD, config, packed-refs, refs/**) whenever something changes in the repo..gitalong (e.g.cf push),dotnet build -t:WriteGitPropertiesFallbackFilewrites a durable fallback copy that's used automatically whenever no live.gitis available.GitInfoContributor(runtime side) now checks next to the app's own assembly first, falling back to the current working directory, so it findsgit.propertiesregardless of how the app is launched.Diagnostics
Seven
GITPROPS00xcodes cover every place generation can be skipped or left partial (repository not found, invalid, git executable missing, incompatible version, no commits, shallow clone, dirty-state unknown) — see the package's Diagnostics table. All are forgiving by default: generation is skipped with a suppressible warning instead of failing the build, so it's safe to add this package to projects that aren't always built inside a git checkout (e.g. a Docker build stage).Known, documented limitations
Called out explicitly in the package readme's "Good to know" section:
.git(e.g.git tag -d,git fetch --unshallow) don't invalidate the shared cache by themselves — it catches up the next time something else changes.CI changes
dotnet build/publishsubprocesses per test, which fragments coverage data (ephemeral temp paths, duplicate<class>entries per subprocess);merge-subprocess-coverage.ps1repairs that before upload.Category=GitPropertiesxUnit trait (on the test project's shared base class) is used to run the tests isolated in cibuilds, which is needed because coverage is collected differently: Coverlet is unable to instrument subprocesses.COMMON_TEST_ARGS/SONAR_TEST_ARGSnow only contain flags genuinely shared by everydotnet testinvocation in each workflow; VSTest-coverage-collector-specific flags moved to their ownCOVERAGE_COLLECT_ARGSvar, since this suite collects coverage its own way and can't use them.Test plan
GitProperties.Build.Test, covering auto-detection, all 7 diagnostics (including both trigger paths for the 3 diagnostics that can fire for two different reasons), the shared cache (multi-project, multi-TFM, incremental build, build-time-vs-commit-time), the fallback file (including.gitignoreinteraction), worktrees, submodules, publish/push scenarios, and property-content correctness (branch env var fallback, non-ASCII data, multiple remotes, shallow clones).GitInfoContributorTest) for the runtime path-resolution change.Quality checklist
If your change affects other repositories, such as Documentation and/or Samples, add linked PRs here.