Skip to content

Conversation

@evgenyfedorov2
Copy link
Member

@evgenyfedorov2 evgenyfedorov2 commented Jul 17, 2025

Adding a brand new component - Build metadata, which automatically grabs build information from the CI/CD pipelines, deserializes it into a strong type BuildMetadata and registers it in Dependency Injection container as IOptions<BuildMetadata>.
The component uses source generation to collect build information and immediately express it via C# code.

Initially, only GitHub Actions and Azure DevOps are supported

Microsoft Reviewers: Open in CodeFlow

@dariusclay
Copy link
Member

I love porting until I realize my commit history is lost. 🤣

Copy link

@KalleOlaviNiemitalo KalleOlaviNiemitalo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the purpose of the empty src/Libraries/Microsoft.Extensions.AmbientMetadata.Build/Microsoft.Extensions.AmbientMetadata.Build.json file?

@evgenyfedorov2
Copy link
Member Author

What's the purpose of the empty src/Libraries/Microsoft.Extensions.AmbientMetadata.Build/Microsoft.Extensions.AmbientMetadata.Build.json file?

Removed :)

@evgenyfedorov2 evgenyfedorov2 marked this pull request as ready for review September 16, 2025 13:06
@evgenyfedorov2 evgenyfedorov2 requested a review from a team as a code owner September 16, 2025 13:06
Copilot AI review requested due to automatic review settings September 16, 2025 13:06
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new AmbientMetadata.Build component that provides automatic build metadata collection from CI/CD pipelines. The component uses source generation to extract build information at compile time and register it in the dependency injection container as IOptions.

Key changes:

  • New BuildMetadata class with properties for build ID, number, branch name, and source version
  • Source generator that reads MSBuild properties and generates configuration extensions
  • Support for both Azure DevOps and GitHub Actions CI environments

Reviewed Changes

Copilot reviewed 20 out of 24 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/Libraries/Microsoft.Extensions.AmbientMetadata.Build/BuildMetadata.cs Defines the core data model for build metadata
src/Generators/Microsoft.Gen.BuildMetadata/BuildMetadataGenerator.cs Main source generator that creates build metadata extensions
src/Libraries/Microsoft.Extensions.AmbientMetadata.Build/BuildMetadataServiceCollectionExtensions.cs Extension methods for registering BuildMetadata in DI container
src/Libraries/Microsoft.Extensions.AmbientMetadata.Build/buildTransitive/Microsoft.Extensions.AmbientMetadata.Build.props MSBuild properties file that maps CI environment variables to build properties
test/Libraries/Microsoft.Extensions.AmbientMetadata.Build.Tests/ Unit tests for the build metadata functionality

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

…s/ConfigurationBindingQuirkBehaviorTests.cs

Co-authored-by: Copilot <[email protected]>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 20 out of 24 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 20 out of 24 changed files in this pull request and generated 3 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@evgenyfedorov2 evgenyfedorov2 enabled auto-merge (squash) November 10, 2025 12:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants