From f3df3f78f6b91a006c833801d34c7001b7628841 Mon Sep 17 00:00:00 2001 From: jonaswre Date: Fri, 11 Sep 2026 12:46:10 +0200 Subject: [PATCH 1/7] Fix AL-Go bootstrap and public repository build configuration --- .AL-Go/NewBcContainer.ps1 | 30 --------- .AL-Go/tests/NewBcContainer.Tests.ps1 | 77 ++++++++++++++++++++++++ .github/AL-Go-Settings.json | 5 +- .github/workflows/TestContainerHook.yaml | 30 +++++++++ app/src/SentEmailsListPart.PageExt.al | 6 +- 5 files changed, 113 insertions(+), 35 deletions(-) create mode 100644 .AL-Go/tests/NewBcContainer.Tests.ps1 create mode 100644 .github/workflows/TestContainerHook.yaml diff --git a/.AL-Go/NewBcContainer.ps1 b/.AL-Go/NewBcContainer.ps1 index 5f3b85f..7db5838 100644 --- a/.AL-Go/NewBcContainer.ps1 +++ b/.AL-Go/NewBcContainer.ps1 @@ -6,35 +6,5 @@ Param( # Force BcContainerHelper to use docker exec instead of WinRM sessions $bcContainerHelperConfig.useWinRmSession = "never" -$secrets = $ENV:Secrets | ConvertFrom-Json | ConvertTo-HashTable -$gitHubPackagesContext = [Text.Encoding]::Utf8.GetString([Convert]::FromBase64String($secrets.gitHubPackagesContext)) -$gitHubPackagesCredential = $gitHubPackagesContext | ConvertFrom-Json - -$env:GITHUB_TOKEN = $gitHubPackagesCredential.token; -$ALGoPath = $PSScriptRoot; - -$ProjectRoot = Join-Path $ALGoPath ".."; -$PackageJsonPaths = Join-Path $ProjectRoot "*/package.json"; - -Write-Host "JS projects:" -$javascriptProjects = Get-ChildItem -Path $PackageJsonPaths | ForEach-Object { - $parent = Split-Path $_.FullName; - Write-Host $parent; - $parent; -} - -$javascriptProjects | ForEach-Object { - try { - Write-Host "Building" $_ "..."; - Push-Location $_; - Add-Content -Path .npmrc -Value "`n//npm.pkg.github.com/:_authToken=`${GITHUB_TOKEN}" - npm install --frozen-lockfile - npm run build:prod - } - finally { - Pop-Location; - } -} - New-BcContainer @parameters; Invoke-ScriptInBcContainer $parameters.ContainerName -scriptblock { $progressPreference = 'SilentlyContinue' } diff --git a/.AL-Go/tests/NewBcContainer.Tests.ps1 b/.AL-Go/tests/NewBcContainer.Tests.ps1 new file mode 100644 index 0000000..87b9d11 --- /dev/null +++ b/.AL-Go/tests/NewBcContainer.Tests.ps1 @@ -0,0 +1,77 @@ +BeforeAll { + $hookPath = Join-Path $PSScriptRoot '../NewBcContainer.ps1' + + # BcContainerHelper is the external boundary; execute the real repository hook. + function New-BcContainer { + param($ContainerName, $accept_eula, $artifactUrl) + } + function Invoke-ScriptInBcContainer { + param($ContainerName, $scriptblock) + } + function ConvertTo-HashTable { + param([Parameter(ValueFromPipeline)] $InputObject) + process { + $result = @{} + foreach ($property in $InputObject.PSObject.Properties) { + $result[$property.Name] = $property.Value + } + $result + } + } +} + +Describe 'AL-only build container initialization' { + BeforeEach { + $originalSecrets = $env:Secrets + $originalToken = $env:GITHUB_TOKEN + $env:GITHUB_TOKEN = 'existing-workflow-token' + $bcContainerHelperConfig = @{} + $parameters = @{ + ContainerName = 'mail-log-test' + accept_eula = $true + artifactUrl = 'https://example.invalid/bc-artifact' + } + Mock New-BcContainer {} + Mock Invoke-ScriptInBcContainer {} + } + + AfterEach { + $env:Secrets = $originalSecrets + $env:GITHUB_TOKEN = $originalToken + } + + It 'creates the container without package credentials: ' -ForEach @( + @{ Name = 'no secrets'; Secrets = $null } + @{ Name = 'empty secrets'; Secrets = '{}' } + @{ Name = 'empty package context'; Secrets = '{"gitHubPackagesContext":"e30="}' } + ) { + $env:Secrets = $Secrets + & { + $ErrorActionPreference = 'Stop' + Set-StrictMode -Version 2.0 + . $hookPath -parameters $parameters + } + + Should -Invoke New-BcContainer -Exactly 1 -ParameterFilter { + $ContainerName -eq 'mail-log-test' -and $accept_eula -and + $artifactUrl -eq 'https://example.invalid/bc-artifact' + } + Should -Invoke Invoke-ScriptInBcContainer -Exactly 1 -ParameterFilter { + $ContainerName -eq 'mail-log-test' + } + $bcContainerHelperConfig.useWinRmSession | Should -Be 'never' + $env:GITHUB_TOKEN | Should -Be 'existing-workflow-token' + } + + It 'reports container creation failures without running container setup' { + $env:Secrets = '{"gitHubPackagesContext":"e30="}' + Mock New-BcContainer { throw 'Container creation failed' } + + { + $ErrorActionPreference = 'Stop' + Set-StrictMode -Version 2.0 + . $hookPath -parameters $parameters + } | Should -Throw '*Container creation failed*' + Should -Invoke Invoke-ScriptInBcContainer -Exactly 0 + } +} diff --git a/.github/AL-Go-Settings.json b/.github/AL-Go-Settings.json index 0d80852..dcaec96 100644 --- a/.github/AL-Go-Settings.json +++ b/.github/AL-Go-Settings.json @@ -1,4 +1,5 @@ { "type": "PTE", - "templateUrl": "https://github.com/byndit/AL-Go-PTE@main" -} \ No newline at end of file + "githubRunner": "windows-2022", + "templateUrl": "https://github.com/microsoft/AL-Go-PTE@main" +} diff --git a/.github/workflows/TestContainerHook.yaml b/.github/workflows/TestContainerHook.yaml new file mode 100644 index 0000000..3d69d27 --- /dev/null +++ b/.github/workflows/TestContainerHook.yaml @@ -0,0 +1,30 @@ +name: Test container hook + +on: + push: + paths: + - '.AL-Go/NewBcContainer.ps1' + - '.AL-Go/tests/**' + - '.github/workflows/TestContainerHook.yaml' + pull_request: + paths: + - '.AL-Go/NewBcContainer.ps1' + - '.AL-Go/tests/**' + - '.github/workflows/TestContainerHook.yaml' + workflow_dispatch: + +permissions: + contents: read + +jobs: + test: + runs-on: windows-latest + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Run container hook regression tests + shell: powershell + run: | + $ErrorActionPreference = 'Stop' + Install-Module Pester -RequiredVersion 5.7.1 -Scope CurrentUser -Force -SkipPublisherCheck + Import-Module Pester -RequiredVersion 5.7.1 + Invoke-Pester -Path .AL-Go/tests -Output Detailed -CI diff --git a/app/src/SentEmailsListPart.PageExt.al b/app/src/SentEmailsListPart.PageExt.al index 0f1e1c1..a547330 100644 --- a/app/src/SentEmailsListPart.PageExt.al +++ b/app/src/SentEmailsListPart.PageExt.al @@ -7,10 +7,10 @@ pageextension 53061 "PTE Sent Emails List Part" extends "Sent Emails List Part" EmptyGuid: Guid; begin if Rec.IsTemporary() then - Rec.DeleteAll(); + Rec.DeleteAll(false); if not DataTypeManagement.GetRecordRef(Document, RecRef) then exit; - if GetSystemId(RecRef.Field(RecRef.SystemIdNo).Value) = EmptyGuid then begin + if GetSystemId(RecRef.Field(RecRef.SystemIdNo()).Value()) = EmptyGuid then begin CurrPage.Update(false); exit; end; @@ -23,4 +23,4 @@ pageextension 53061 "PTE Sent Emails List Part" extends "Sent Emails List Part" begin exit(SystemID); end; -} \ No newline at end of file +} From 715a99b396c6e11ec7365c0f5de91f0a1dad86ff Mon Sep 17 00:00:00 2001 From: jonaswre Date: Fri, 11 Sep 2026 13:04:34 +0200 Subject: [PATCH 2/7] Use the repository AL ruleset in CI --- .AL-Go/settings.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.AL-Go/settings.json b/.AL-Go/settings.json index afc78d3..2923e7d 100644 --- a/.AL-Go/settings.json +++ b/.AL-Go/settings.json @@ -1,5 +1,6 @@ { "country": "us", + "rulesetFile": "BEYONDIT.ruleset.json", "appFolders": [], "testFolders": [], "bcptTestFolders": [] From cf5a170cce64169ccd607b46179595093bb305cc Mon Sep 17 00:00:00 2001 From: jonaswre Date: Fri, 11 Sep 2026 13:08:25 +0200 Subject: [PATCH 3/7] Remove container hook test workflow --- .github/workflows/TestContainerHook.yaml | 30 ------------------------ 1 file changed, 30 deletions(-) delete mode 100644 .github/workflows/TestContainerHook.yaml diff --git a/.github/workflows/TestContainerHook.yaml b/.github/workflows/TestContainerHook.yaml deleted file mode 100644 index 3d69d27..0000000 --- a/.github/workflows/TestContainerHook.yaml +++ /dev/null @@ -1,30 +0,0 @@ -name: Test container hook - -on: - push: - paths: - - '.AL-Go/NewBcContainer.ps1' - - '.AL-Go/tests/**' - - '.github/workflows/TestContainerHook.yaml' - pull_request: - paths: - - '.AL-Go/NewBcContainer.ps1' - - '.AL-Go/tests/**' - - '.github/workflows/TestContainerHook.yaml' - workflow_dispatch: - -permissions: - contents: read - -jobs: - test: - runs-on: windows-latest - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Run container hook regression tests - shell: powershell - run: | - $ErrorActionPreference = 'Stop' - Install-Module Pester -RequiredVersion 5.7.1 -Scope CurrentUser -Force -SkipPublisherCheck - Import-Module Pester -RequiredVersion 5.7.1 - Invoke-Pester -Path .AL-Go/tests -Output Detailed -CI From 144c971a497ca188c07f8e59810441ca9dbed9c9 Mon Sep 17 00:00:00 2001 From: jonaswre Date: Fri, 11 Sep 2026 13:10:55 +0200 Subject: [PATCH 4/7] Remove container hook test script --- .AL-Go/tests/NewBcContainer.Tests.ps1 | 77 --------------------------- 1 file changed, 77 deletions(-) delete mode 100644 .AL-Go/tests/NewBcContainer.Tests.ps1 diff --git a/.AL-Go/tests/NewBcContainer.Tests.ps1 b/.AL-Go/tests/NewBcContainer.Tests.ps1 deleted file mode 100644 index 87b9d11..0000000 --- a/.AL-Go/tests/NewBcContainer.Tests.ps1 +++ /dev/null @@ -1,77 +0,0 @@ -BeforeAll { - $hookPath = Join-Path $PSScriptRoot '../NewBcContainer.ps1' - - # BcContainerHelper is the external boundary; execute the real repository hook. - function New-BcContainer { - param($ContainerName, $accept_eula, $artifactUrl) - } - function Invoke-ScriptInBcContainer { - param($ContainerName, $scriptblock) - } - function ConvertTo-HashTable { - param([Parameter(ValueFromPipeline)] $InputObject) - process { - $result = @{} - foreach ($property in $InputObject.PSObject.Properties) { - $result[$property.Name] = $property.Value - } - $result - } - } -} - -Describe 'AL-only build container initialization' { - BeforeEach { - $originalSecrets = $env:Secrets - $originalToken = $env:GITHUB_TOKEN - $env:GITHUB_TOKEN = 'existing-workflow-token' - $bcContainerHelperConfig = @{} - $parameters = @{ - ContainerName = 'mail-log-test' - accept_eula = $true - artifactUrl = 'https://example.invalid/bc-artifact' - } - Mock New-BcContainer {} - Mock Invoke-ScriptInBcContainer {} - } - - AfterEach { - $env:Secrets = $originalSecrets - $env:GITHUB_TOKEN = $originalToken - } - - It 'creates the container without package credentials: ' -ForEach @( - @{ Name = 'no secrets'; Secrets = $null } - @{ Name = 'empty secrets'; Secrets = '{}' } - @{ Name = 'empty package context'; Secrets = '{"gitHubPackagesContext":"e30="}' } - ) { - $env:Secrets = $Secrets - & { - $ErrorActionPreference = 'Stop' - Set-StrictMode -Version 2.0 - . $hookPath -parameters $parameters - } - - Should -Invoke New-BcContainer -Exactly 1 -ParameterFilter { - $ContainerName -eq 'mail-log-test' -and $accept_eula -and - $artifactUrl -eq 'https://example.invalid/bc-artifact' - } - Should -Invoke Invoke-ScriptInBcContainer -Exactly 1 -ParameterFilter { - $ContainerName -eq 'mail-log-test' - } - $bcContainerHelperConfig.useWinRmSession | Should -Be 'never' - $env:GITHUB_TOKEN | Should -Be 'existing-workflow-token' - } - - It 'reports container creation failures without running container setup' { - $env:Secrets = '{"gitHubPackagesContext":"e30="}' - Mock New-BcContainer { throw 'Container creation failed' } - - { - $ErrorActionPreference = 'Stop' - Set-StrictMode -Version 2.0 - . $hookPath -parameters $parameters - } | Should -Throw '*Container creation failed*' - Should -Invoke Invoke-ScriptInBcContainer -Exactly 0 - } -} From b3feffc55614e68c26e3308e3c3be8cd54410e97 Mon Sep 17 00:00:00 2001 From: jonaswre Date: Fri, 11 Sep 2026 13:15:41 +0200 Subject: [PATCH 5/7] Use the organization GitHub-hosted Windows runner --- .github/AL-Go-Settings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/AL-Go-Settings.json b/.github/AL-Go-Settings.json index dcaec96..4083a43 100644 --- a/.github/AL-Go-Settings.json +++ b/.github/AL-Go-Settings.json @@ -1,5 +1,5 @@ { "type": "PTE", - "githubRunner": "windows-2022", + "githubRunner": "windows-latest-8-cores", "templateUrl": "https://github.com/microsoft/AL-Go-PTE@main" } From 4cfc986d6c0705924d3dddfd2b3d72509fc9cc31 Mon Sep 17 00:00:00 2001 From: jonaswre Date: Fri, 11 Sep 2026 13:16:22 +0200 Subject: [PATCH 6/7] Inherit the organization self-hosted runner setting --- .github/AL-Go-Settings.json | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/AL-Go-Settings.json b/.github/AL-Go-Settings.json index 4083a43..8ee6946 100644 --- a/.github/AL-Go-Settings.json +++ b/.github/AL-Go-Settings.json @@ -1,5 +1,4 @@ { "type": "PTE", - "githubRunner": "windows-latest-8-cores", "templateUrl": "https://github.com/microsoft/AL-Go-PTE@main" } From 2d7ea2e0f53f4affbc83de22c012fe457f0c88a4 Mon Sep 17 00:00:00 2001 From: jonaswre Date: Fri, 11 Sep 2026 13:39:05 +0200 Subject: [PATCH 7/7] Disable app signing for BeyondMailLog --- .github/AL-Go-Settings.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/AL-Go-Settings.json b/.github/AL-Go-Settings.json index 8ee6946..25e4e82 100644 --- a/.github/AL-Go-Settings.json +++ b/.github/AL-Go-Settings.json @@ -1,4 +1,5 @@ { "type": "PTE", + "doNotSignApps": true, "templateUrl": "https://github.com/microsoft/AL-Go-PTE@main" }