Skip to content

Support trackALAlertsInGitHub for workspace compilation build path - #2331

Open
aholstrup1 wants to merge 1 commit into
microsoft:mainfrom
aholstrup1:aholstrup1-track-al-alerts-workspace-compile
Open

Support trackALAlertsInGitHub for workspace compilation build path#2331
aholstrup1 wants to merge 1 commit into
microsoft:mainfrom
aholstrup1:aholstrup1-track-al-alerts-workspace-compile

Conversation

@aholstrup1

Copy link
Copy Markdown
Collaborator

❔What, Why & How

trackALAlertsInGitHub surfaces AL compiler diagnostics as GitHub code scanning alerts, but it only worked on the classic Run-AlPipeline build path. When workspaceCompilation (preview) was enabled, no *.errorLog.json files were produced, so no alerts appeared even with the setting turned on.

This wires the same behavior into the workspace compilation path. When both trackALAlertsInGitHub and workspaceCompilation are enabled, AL-Go passes --errorlogdirectory to altool workspace compile so each project emits an *.errorLog.json diagnostics file into its .buildartifacts/ErrorLogs/ folder. From there the existing upload + ProcessALCodeAnalysisLogs pipeline picks them up, converts them to SARIF, and publishes code scanning alerts, matching the classic build behavior.

The --errorlogdirectory argument is threaded through via a GenerateErrorLog switch driven by $settings.trackALAlertsInGitHub. If the consumed compiler version does not yet support --errorlogdirectory, the option is skipped and a warning is logged so the rest of the build is unaffected (no silent no-op, no hard failure).

✅ Checklist

  • Add tests (E2E, unit tests)
  • Update RELEASENOTES.md
  • Update documentation (e.g. for new settings or scenarios)
  • Add telemetry

@aholstrup1
aholstrup1 requested a review from a team as a code owner July 27, 2026 08:38
Copilot AI review requested due to automatic review settings July 27, 2026 08:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Extends GitHub AL alert tracking to workspace compilation.

Changes:

  • Adds compiler capability detection and --errorlogdirectory forwarding.
  • Connects alert settings to workspace builds.
  • Adds Pester coverage and release notes.

Reviewed changes

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

File Description
Actions/.Modules/CompileFromWorkspace.psm1 Adds error-log support and capability probing.
Actions/CompileApps/Compile.ps1 Configures the diagnostics output directory.
Tests/CompileFromWorkspace.Test.ps1 Tests error-log argument construction.
RELEASENOTES.md Announces workspace compilation alert support.

)

try {
$compileHelp = & $ALToolPath workspace compile --help 2>&1 | Out-String
.OUTPUTS
Boolean indicating whether the option is supported.
#>
function Test-ALToolWorkspaceCompileSupportsOption {
spetersenms
spetersenms previously approved these changes Jul 27, 2026
Thread an ErrorLogDirectory through Build-AppsInWorkspace and CompileAppsInWorkspace so that, when trackALAlertsInGitHub is enabled with workspaceCompilation, altool workspace compile writes per-project *.errorLog.json diagnostics into .buildartifacts/ErrorLogs (the same folder the classic Run-AlPipeline path uses). Defensively probes 'workspace compile --help' and only passes --errorlogdirectory when supported. Adds Pester coverage.

AB#641509
Copilot AI review requested due to automatic review settings July 27, 2026 09:11
@aholstrup1
aholstrup1 force-pushed the aholstrup1-track-al-alerts-workspace-compile branch from 9e442bc to 16c5653 Compare July 27, 2026 09:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 4 out of 4 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

Actions/.Modules/CompileFromWorkspace.psm1:476

  • A failed native executable does not throw solely because it exits nonzero, so this catch does not reliably detect a failed help probe. If the failed invocation emits usage text containing the option, this returns true and the subsequent compile can hard-fail instead of taking the promised warning/fallback path. Check $LASTEXITCODE before matching the output (or invoke through RunAndCheck, which already enforces this).
        $compileHelp = & $ALToolPath workspace compile --help 2>&1 | Out-String
        return ($compileHelp -match [regex]::Escape($Option))

}
Mock Copy-CompiledAppsToOutput { return @() }
# Simulate a compiler that advertises the --errorlogdirectory option in its help
Mock Test-ALToolWorkspaceCompileSupportsOption { return $true }
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.

3 participants