Add CI/CD provider-specific loggers for GitHub Actions, Azure DevOps, and GitLab#12738
Add CI/CD provider-specific loggers for GitHub Actions, Azure DevOps, and GitLab#12738Copilot wants to merge 10 commits intotl-logger-basefrom
Conversation
…st cares about rendering
… and GitLab Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com>
…sive tests, refactor Azure DevOps logger to use ProjectTrackingLoggerBase Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com>
|
@copilot src/MSBuild/CICDLogger/AzureDevOps/AzureDevOpsLogger.cs:166-172 there are two separate questions to answer in 'OnMessageRaised' in these loggers:
for the first question, you check by comparing verbosity to the messageimportance. this is an either-or scenario - we should never both buffer a message and write it immediately |
…ctor GitHub Actions and GitLab loggers to use ProjectTrackingLoggerBase Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com>
Fixed in 689a282. The logic now properly implements the either-or pattern:
Also applied this same pattern consistently to GitHub Actions and GitLab loggers. |
|
@copilot src/MSBuild/CICDLogger/GitHubActions/GitHubActionsLogger.cs:55 for the github actions logger, the verbosity set by the user can be overridden to 'diagnostic' verbosity by the ACTIONS_STEP_DEBUG environment variable. If this variable is true, the logger verbosity must be set to diagnostic. src/MSBuild/CICDLogger/GitHubActions/GitHubActionsLogger.cs:272-309 much like in the azdo logger, there's a lot of duplication here. consolidate this so that diagnostics share code as much as possible. check if the gitlab logger is doing the same and update it accordingly. |
…plement timestamp-ordered events, and add GitHub Step Summary Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com>
Fixed in fbb6d24:
|
|
@copilot src/MSBuild/CICDLogger/GitLab/GitLabLogger.cs:303 |
…ibility Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com>
Fixed in a5ce9b1. The color reset ( |
|
@copilot these new loggers should moved into the |
Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com>
Fixed in 7847339. Moved all CI/CD loggers from
The loggers are now accessible through the MSBuild APIs in the Microsoft.Build assembly. |
|
@copilot many of the existing tests fail when run in Azure Devops on our own test pipelines. Run all of our tests but explicitly that that |
…o-detection Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com>
Fixed in 7df4cd9. Updated tests to explicitly use ConsoleLogger to prevent CI/CD logger auto-detection:
These changes ensure tests use the expected ConsoleLogger instead of the Azure DevOps logger when |
|
@copilot the Microsoft.Build.BuildCheck.UnitTests.EndToEndTests and Microsoft.Build.UnitTests.XMakeAppTests are failing for similar reasons - they are assuming console output. Update them as well. |
…gger auto-detection Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com>
Fixed in 7393fcb. Added The XMakeAppTests were already fixed in commit 7df4cd9 through the |
cf306ab to
7a55508
Compare
Fixes #10592
Context
MSBuild diagnostics are not formatted for CI/CD provider displays. Errors and warnings appear as plain text, missing provider-specific markup for collapsible sections, annotations, and workflow commands.
Changes Made
Logger Implementation
GitHubActionsLoggerextendingProjectTrackingLoggerBasewith workflow commands (::error,::warning,::group)AzureDevOpsLoggerextendingProjectTrackingLoggerBasewith Azure Pipelines logging commands (##vso[task.logissue],##[group])GitLabLoggerextendingProjectTrackingLoggerBasewith ANSI color codes and collapsible sectionssrc/Build/Logging/CICDLogger/and included inMicrosoft.Build.csprojfor API accessibilityMicrosoft.Build.Logging.CICDLogger.*pattern for public API accessProject Tracking
ProjectTrackingLoggerBaseto aggregate project data:##[group]instead of##[section]for better UXWriteDiagnosticmethod replaces separateWriteError/WriteWarningmethods across all three loggersGitHub Actions Enhancements
ACTIONS_STEP_DEBUGenvironment variable to force diagnostic verbosityGITHUB_STEP_SUMMARYfile with:Auto-Detection
XMake.csto detect CI/CD environments via environment variables (GITHUB_ACTIONS,TF_BUILD,GITLAB_CI)TryProcessCICDLoggerto auto-select provider logger when no explicit console/terminal logger specifiedCode Quality
#nullable enableTesting
CI/CD Logger Tests
Added comprehensive unit tests for each provider:
Test Suite Compatibility
Updated existing tests to explicitly use ConsoleLogger to prevent CI/CD logger auto-detection in CI environments:
XMake_Tests.ExecuteMSBuildExeto add-logger:ConsoleLoggerExecMSBuildWithConsoleLoggerhelper inMSBuildServer_Testsand updated all invocationsPerfLog_Teststo explicitly specify ConsoleLoggerExecBootstrapedMSBuildWithConsoleLoggerhelper inEndToEndTestsand updated all test methodsThese changes ensure tests use the expected ConsoleLogger instead of auto-detecting CI/CD loggers when environment variables like
TF_BUILDare present in CI pipelines.Notes
All three loggers are part of the
Microsoft.Buildassembly and accessible through the MSBuild APIs, not exclusive to the MSBuild command-line tool. This allows library consumers to use these loggers programmatically. The loggers use theProjectTrackingLoggerBaseinfrastructure for consistent project tracking and rich diagnostic output across all CI/CD providers. Events are tracked with timestamps and output in chronological order to maintain accurate build sequencing.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.