diff --git a/Actions/AL-Go-Helper.ps1 b/Actions/AL-Go-Helper.ps1
index a9dbe0f41..3c7fbdc03 100644
--- a/Actions/AL-Go-Helper.ps1
+++ b/Actions/AL-Go-Helper.ps1
@@ -19,7 +19,6 @@ $defaultCICDPushBranches = @( 'main', 'release/*', 'feature/*' )
$defaultCICDPullRequestBranches = @( 'main' )
$runningLocal = $local.IsPresent
$defaultBcContainerHelperVersion = "preview" # Must be double quotes. Will be replaced by BcContainerHelperVersion if necessary in the deploy step - ex. "https://github.com/organization/navcontainerhelper/archive/refs/heads/branch.zip"
-$microsoftTelemetryConnectionString = "InstrumentationKey=84bd9223-67d4-4378-8590-9e4a46023be2;IngestionEndpoint=https://westeurope-1.in.applicationinsights.azure.com/"
$notSecretProperties = @("Scopes","TenantId","BlobName","ContainerName","StorageAccountName","ServerUrl","ppUserName")
$runAlPipelineOverrides = @(
@@ -631,7 +630,7 @@ function ReadSettings {
"cacheImageName" = "my"
"cacheKeepDays" = 3
"alwaysBuildAllProjects" = $false
- "microsoftTelemetryConnectionString" = $microsoftTelemetryConnectionString
+ "microsoftTelemetryConnectionString" = "InstrumentationKey=cd2cc63e-0f37-4968-b99a-532411a314b8;IngestionEndpoint=https://northeurope-2.in.applicationinsights.azure.com/"
"partnerTelemetryConnectionString" = ""
"sendExtendedTelemetryToMicrosoft" = $false
"environments" = @()
diff --git a/Actions/AddExistingApp/AddExistingApp.ps1 b/Actions/AddExistingApp/AddExistingApp.ps1
index 559e4a7f5..b2876f98d 100644
--- a/Actions/AddExistingApp/AddExistingApp.ps1
+++ b/Actions/AddExistingApp/AddExistingApp.ps1
@@ -3,8 +3,6 @@
[string] $actor,
[Parameter(HelpMessage = "The GitHub token running the action", Mandatory = $false)]
[string] $token,
- [Parameter(HelpMessage = "Specifies the parent telemetry scope for the telemetry signal", Mandatory = $false)]
- [string] $parentTelemetryScopeJson = '7b7d',
[Parameter(HelpMessage = "Project name if the repository is setup for multiple projects", Mandatory = $false)]
[string] $project = '.',
[Parameter(HelpMessage = "Direct Download Url of .app or .zip file", Mandatory = $true)]
@@ -78,149 +76,135 @@ function expandfile {
}
}
-$telemetryScope = $null
+. (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve)
+$serverUrl, $branch = CloneIntoNewFolder -actor $actor -token $token -updateBranch $updateBranch -DirectCommit $directCommit -newBranchPrefix 'add-existing-app'
+$baseFolder = (Get-Location).path
+DownloadAndImportBcContainerHelper -baseFolder $baseFolder
-try {
- . (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve)
- $serverUrl, $branch = CloneIntoNewFolder -actor $actor -token $token -updateBranch $updateBranch -DirectCommit $directCommit -newBranchPrefix 'add-existing-app'
- $baseFolder = (Get-Location).path
- DownloadAndImportBcContainerHelper -baseFolder $baseFolder
- import-module (Join-Path -path $PSScriptRoot -ChildPath "..\TelemetryHelper.psm1" -Resolve)
- $telemetryScope = CreateScope -eventId 'DO0070' -parentTelemetryScopeJson $parentTelemetryScopeJson
-
- $type = "PTE"
- Write-Host "Reading $RepoSettingsFile"
- $settingsJson = Get-Content $RepoSettingsFile -Encoding UTF8 | ConvertFrom-Json
- if ($settingsJson.PSObject.Properties.Name -eq "type") {
- $type = $settingsJson.type
- }
+$type = "PTE"
+Write-Host "Reading $RepoSettingsFile"
+$settingsJson = Get-Content $RepoSettingsFile -Encoding UTF8 | ConvertFrom-Json
+if ($settingsJson.PSObject.Properties.Name -eq "type") {
+ $type = $settingsJson.type
+}
- CheckAndCreateProjectFolder -project $project
- $projectFolder = (Get-Location).path
+CheckAndCreateProjectFolder -project $project
+$projectFolder = (Get-Location).path
- $appNames = @()
- getfiles -url $url | ForEach-Object {
- $appFolder = $_
- "?Content_Types?.xml", "MediaIdListing.xml", "navigation.xml", "NavxManifest.xml", "DocComments.xml", "SymbolReference.json" | ForEach-Object {
- Remove-Item (Join-Path $appFolder $_) -Force -ErrorAction SilentlyContinue
- }
- $appJson = Get-Content (Join-Path $appFolder "app.json") -Encoding UTF8 | ConvertFrom-Json
- $appNames += @($appJson.Name)
+$appNames = @()
+getfiles -url $url | ForEach-Object {
+ $appFolder = $_
+ "?Content_Types?.xml", "MediaIdListing.xml", "navigation.xml", "NavxManifest.xml", "DocComments.xml", "SymbolReference.json" | ForEach-Object {
+ Remove-Item (Join-Path $appFolder $_) -Force -ErrorAction SilentlyContinue
+ }
+ $appJson = Get-Content (Join-Path $appFolder "app.json") -Encoding UTF8 | ConvertFrom-Json
+ $appNames += @($appJson.Name)
- $ranges = @()
- if ($appJson.PSObject.Properties.Name -eq "idRanges") {
- $ranges += $appJson.idRanges
- }
- if ($appJson.PSObject.Properties.Name -eq "idRange") {
- $ranges += @($appJson.idRange)
- }
+ $ranges = @()
+ if ($appJson.PSObject.Properties.Name -eq "idRanges") {
+ $ranges += $appJson.idRanges
+ }
+ if ($appJson.PSObject.Properties.Name -eq "idRange") {
+ $ranges += @($appJson.idRange)
+ }
- # Determine whether the app is PTE or AppSource App based on one of the id ranges (the first)
- if ($ranges[0].from -lt 100000 -and $ranges[0].to -lt 100000) {
- $ttype = "PTE"
- }
- else {
- $ttype = "AppSource App"
- }
+ # Determine whether the app is PTE or AppSource App based on one of the id ranges (the first)
+ if ($ranges[0].from -lt 100000 -and $ranges[0].to -lt 100000) {
+ $ttype = "PTE"
+ }
+ else {
+ $ttype = "AppSource App"
+ }
- if ($appJson.PSObject.Properties.Name -eq "dependencies") {
- foreach($dependency in $appJson.dependencies) {
- if ($dependency.PSObject.Properties.Name -eq "AppId") {
- $id = $dependency.AppId
- }
- else {
- $id = $dependency.Id
- }
- if ($testRunnerApps.Contains($id)) {
- $ttype = "Test App"
- }
+ if ($appJson.PSObject.Properties.Name -eq "dependencies") {
+ foreach($dependency in $appJson.dependencies) {
+ if ($dependency.PSObject.Properties.Name -eq "AppId") {
+ $id = $dependency.AppId
+ }
+ else {
+ $id = $dependency.Id
+ }
+ if ($testRunnerApps.Contains($id)) {
+ $ttype = "Test App"
}
}
+ }
- if ($ttype -ne "Test App") {
- foreach($appName in (Get-ChildItem -Path $appFolder -Filter "*.al" -Recurse).FullName) {
- $alContent = (Get-Content -Path $appName -Encoding UTF8) -join "`n"
- if ($alContent -like "*codeunit*subtype*=*test*[test]*") {
- $ttype = "Test App"
- }
+ if ($ttype -ne "Test App") {
+ foreach($appName in (Get-ChildItem -Path $appFolder -Filter "*.al" -Recurse).FullName) {
+ $alContent = (Get-Content -Path $appName -Encoding UTF8) -join "`n"
+ if ($alContent -like "*codeunit*subtype*=*test*[test]*") {
+ $ttype = "Test App"
}
}
+ }
- if ($ttype -ne "Test App" -and $ttype -ne $type) {
- OutputWarning -message "According to settings, repository is for apps of type $type. The app you are adding seams to be of type $ttype"
- }
+ if ($ttype -ne "Test App" -and $ttype -ne $type) {
+ OutputWarning -message "According to settings, repository is for apps of type $type. The app you are adding seams to be of type $ttype"
+ }
- $appFolders = Get-ChildItem -Path $appFolder | Where-Object { $_.PSIsContainer -and (Test-Path (Join-Path $_.FullName 'app.json')) }
- if (-not $appFolders) {
- $appFolders = @($appFolder)
- # TODO: What to do about the über app.json - another workspace? another setting?
- }
+ $appFolders = Get-ChildItem -Path $appFolder | Where-Object { $_.PSIsContainer -and (Test-Path (Join-Path $_.FullName 'app.json')) }
+ if (-not $appFolders) {
+ $appFolders = @($appFolder)
+ # TODO: What to do about the über app.json - another workspace? another setting?
+ }
- $orgfolderName = $appJson.name.Split([System.IO.Path]::getInvalidFileNameChars()) -join ""
- $folderName = GetUniqueFolderName -baseFolder $projectFolder -folderName $orgfolderName
- if ($folderName -ne $orgfolderName) {
- OutputWarning -message "$orgFolderName already exists as a folder in the repo, using $folderName instead"
- }
+ $orgfolderName = $appJson.name.Split([System.IO.Path]::getInvalidFileNameChars()) -join ""
+ $folderName = GetUniqueFolderName -baseFolder $projectFolder -folderName $orgfolderName
+ if ($folderName -ne $orgfolderName) {
+ OutputWarning -message "$orgFolderName already exists as a folder in the repo, using $folderName instead"
+ }
- Move-Item -Path $appFolder -Destination $projectFolder -Force
- Rename-Item -Path ([System.IO.Path]::GetFileName($appFolder)) -NewName $folderName
- $appFolder = Join-Path $projectFolder $folderName
+ Move-Item -Path $appFolder -Destination $projectFolder -Force
+ Rename-Item -Path ([System.IO.Path]::GetFileName($appFolder)) -NewName $folderName
+ $appFolder = Join-Path $projectFolder $folderName
- Get-ChildItem $appFolder -Filter '*.*' -Recurse | ForEach-Object {
- if ($_.Name.Contains('%20')) {
- Rename-Item -Path $_.FullName -NewName $_.Name.Replace('%20', ' ')
- }
+ Get-ChildItem $appFolder -Filter '*.*' -Recurse | ForEach-Object {
+ if ($_.Name.Contains('%20')) {
+ Rename-Item -Path $_.FullName -NewName $_.Name.Replace('%20', ' ')
}
+ }
- $appFolders | ForEach-Object {
- # Modify .AL-Go\settings.json
- try {
- $settingsJsonFile = Join-Path $projectFolder $ALGoSettingsFile
- $SettingsJson = Get-Content $settingsJsonFile -Encoding UTF8 | ConvertFrom-Json
- if (@($settingsJson.appFolders) + @($settingsJson.testFolders)) {
- if ($ttype -eq "Test App") {
- if ($SettingsJson.testFolders -notcontains $foldername) {
- $SettingsJson.testFolders += @($folderName)
- }
+ $appFolders | ForEach-Object {
+ # Modify .AL-Go\settings.json
+ try {
+ $settingsJsonFile = Join-Path $projectFolder $ALGoSettingsFile
+ $SettingsJson = Get-Content $settingsJsonFile -Encoding UTF8 | ConvertFrom-Json
+ if (@($settingsJson.appFolders) + @($settingsJson.testFolders)) {
+ if ($ttype -eq "Test App") {
+ if ($SettingsJson.testFolders -notcontains $foldername) {
+ $SettingsJson.testFolders += @($folderName)
}
- else {
- if ($SettingsJson.appFolders -notcontains $foldername) {
- $SettingsJson.appFolders += @($folderName)
- }
+ }
+ else {
+ if ($SettingsJson.appFolders -notcontains $foldername) {
+ $SettingsJson.appFolders += @($folderName)
}
- $SettingsJson | Set-JsonContentLF -Path $settingsJsonFile
}
+ $SettingsJson | Set-JsonContentLF -Path $settingsJsonFile
}
- catch {
- throw "$ALGoSettingsFile is malformed. Error: $($_.Exception.Message)"
- }
+ }
+ catch {
+ throw "$ALGoSettingsFile is malformed. Error: $($_.Exception.Message)"
+ }
- # Modify workspace
- Get-ChildItem -Path $projectFolder -Filter "*.code-workspace" | ForEach-Object {
- try {
- $workspaceFileName = $_.Name
- $workspaceFile = $_.FullName
- $workspace = Get-Content $workspaceFile -Encoding UTF8 | ConvertFrom-Json
- if (-not ($workspace.folders | Where-Object { $_.Path -eq $foldername })) {
- $workspace.folders += @(@{ "path" = $foldername })
- }
- $workspace | Set-JsonContentLF -Path $workspaceFile
- }
- catch {
- throw "$workspaceFileName is malformed.$([environment]::Newline) $($_.Exception.Message)"
+ # Modify workspace
+ Get-ChildItem -Path $projectFolder -Filter "*.code-workspace" | ForEach-Object {
+ try {
+ $workspaceFileName = $_.Name
+ $workspaceFile = $_.FullName
+ $workspace = Get-Content $workspaceFile -Encoding UTF8 | ConvertFrom-Json
+ if (-not ($workspace.folders | Where-Object { $_.Path -eq $foldername })) {
+ $workspace.folders += @(@{ "path" = $foldername })
}
+ $workspace | Set-JsonContentLF -Path $workspaceFile
+ }
+ catch {
+ throw "$workspaceFileName is malformed.$([environment]::Newline) $($_.Exception.Message)"
}
}
}
- Set-Location $baseFolder
- CommitFromNewFolder -serverUrl $serverUrl -commitMessage "Add existing apps ($($appNames -join ', '))" -branch $branch | Out-Null
-
- TrackTrace -telemetryScope $telemetryScope
-}
-catch {
- if (Get-Module BcContainerHelper) {
- TrackException -telemetryScope $telemetryScope -errorRecord $_
- }
- throw
}
+Set-Location $baseFolder
+CommitFromNewFolder -serverUrl $serverUrl -commitMessage "Add existing apps ($($appNames -join ', '))" -branch $branch | Out-Null
diff --git a/Actions/AddExistingApp/README.md b/Actions/AddExistingApp/README.md
index 2596a7245..112a10ab8 100644
--- a/Actions/AddExistingApp/README.md
+++ b/Actions/AddExistingApp/README.md
@@ -15,7 +15,6 @@ none
| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell |
| actor | | The GitHub actor running the action | github.actor |
| token | | The GitHub token running the action | github.token |
-| parentTelemetryScopeJson | | Specifies the parent telemetry scope for the telemetry signal | {} |
| project | | Project name if the repository is setup for multiple projects | . |
| url | Yes | Direct Download Url of .app or .zip file to add to the repository | |
| updateBranch | | Which branch should the app be added to | github.ref_name |
diff --git a/Actions/AddExistingApp/action.yaml b/Actions/AddExistingApp/action.yaml
index f320f7fd6..e0fde0fbb 100644
--- a/Actions/AddExistingApp/action.yaml
+++ b/Actions/AddExistingApp/action.yaml
@@ -16,10 +16,6 @@ inputs:
description: The GitHub token running the action
required: false
default: ${{ github.token }}
- parentTelemetryScopeJson:
- description: Specifies the parent telemetry scope for the telemetry signal
- required: false
- default: '7b7d'
project:
description: Project name if the repository is setup for multiple projects
required: false
@@ -43,19 +39,13 @@ runs:
env:
_actor: ${{ inputs.actor }}
_token: ${{ inputs.token }}
- _parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }}
_project: ${{ inputs.project }}
_url: ${{ inputs.url }}
_updateBranch: ${{ inputs.updateBranch }}
_directCommit: ${{ inputs.directCommit }}
run: |
- $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
- try {
- ${{ github.action_path }}/AddExistingApp.ps1 -actor $ENV:_actor -token $ENV:_token -parentTelemetryScopeJson $ENV:_parentTelemetryScopeJson -project $ENV:_project -url $ENV:_url -updateBranch $ENV:_updateBranch -directCommit ($ENV:_directCommit -eq 'true')
- }
- catch {
- Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
- exit 1
+ ${{ github.action_path }}/../Invoke-AlGoAction.ps1 -ActionName "AddExistingApp" -Action {
+ ${{ github.action_path }}/AddExistingApp.ps1 -actor $ENV:_actor -token $ENV:_token -project $ENV:_project -url $ENV:_url -updateBranch $ENV:_updateBranch -directCommit ($ENV:_directCommit -eq 'true')
}
branding:
icon: terminal
diff --git a/Actions/AnalyzeTests/AnalyzeTests.ps1 b/Actions/AnalyzeTests/AnalyzeTests.ps1
index 1b6589cca..6b2038acb 100644
--- a/Actions/AnalyzeTests/AnalyzeTests.ps1
+++ b/Actions/AnalyzeTests/AnalyzeTests.ps1
@@ -1,64 +1,45 @@
Param(
- [Parameter(HelpMessage = "Specifies the parent telemetry scope for the telemetry signal", Mandatory = $false)]
- [string] $parentTelemetryScopeJson = '7b7d',
[Parameter(HelpMessage = "Project to analyze", Mandatory = $false)]
[string] $project = '.'
)
-$telemetryScope = $null
+. (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve)
-try {
- . (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve)
- DownloadAndImportBcContainerHelper
+. (Join-Path -Path $PSScriptRoot 'TestResultAnalyzer.ps1')
- import-module (Join-Path -path $PSScriptRoot -ChildPath "..\TelemetryHelper.psm1" -Resolve)
- $telemetryScope = CreateScope -eventId 'DO0082' -parentTelemetryScopeJson $parentTelemetryScopeJson
+$testResultsFile = Join-Path $ENV:GITHUB_WORKSPACE "$project\TestResults.xml"
+$testResultsSummaryMD, $testResultsfailuresMD, $testResultsFailuresSummaryMD = GetTestResultSummaryMD -testResultsFile $testResultsFile
- . (Join-Path -Path $PSScriptRoot 'TestResultAnalyzer.ps1')
+$settings = $env:Settings | ConvertFrom-Json
+$bcptTestResultsFile = Join-Path $ENV:GITHUB_WORKSPACE "$project\bcptTestResults.json"
+$bcptBaseLineFile = Join-Path $ENV:GITHUB_WORKSPACE "$project\bcptBaseLine.json"
+$bcptThresholdsFile = Join-Path $ENV:GITHUB_WORKSPACE "$project\bcptThresholds.json"
+$bcptSummaryMD = GetBcptSummaryMD `
+ -bcptTestResultsFile $bcptTestResultsFile `
+ -baseLinePath $bcptBaseLineFile `
+ -thresholdsPath $bcptThresholdsFile `
+ -bcptThresholds ($settings.bcptThresholds | ConvertTo-HashTable)
- $testResultsFile = Join-Path $ENV:GITHUB_WORKSPACE "$project\TestResults.xml"
- $testResultsSummaryMD, $testResultsfailuresMD, $testResultsFailuresSummaryMD = GetTestResultSummaryMD -testResultsFile $testResultsFile
-
- $settings = $env:Settings | ConvertFrom-Json
- $bcptTestResultsFile = Join-Path $ENV:GITHUB_WORKSPACE "$project\bcptTestResults.json"
- $bcptBaseLineFile = Join-Path $ENV:GITHUB_WORKSPACE "$project\bcptBaseLine.json"
- $bcptThresholdsFile = Join-Path $ENV:GITHUB_WORKSPACE "$project\bcptThresholds.json"
- $bcptSummaryMD = GetBcptSummaryMD `
- -bcptTestResultsFile $bcptTestResultsFile `
- -baseLinePath $bcptBaseLineFile `
- -thresholdsPath $bcptThresholdsFile `
- -bcptThresholds ($settings.bcptThresholds | ConvertTo-HashTable)
-
- # If summary fits, we will display it in the GitHub summary
- if ($testResultsSummaryMD.Length -gt 65000) {
- # If Test results summary is too long, we will not display it in the GitHub summary, instead we will display a message to download the test results
- $testResultsSummaryMD = "Test results summary size exceeds GitHub summary capacity. Download **TestResults** artifact to see details."
- }
- # If summary AND BCPT summary fits, we will display both in the GitHub summary
- if ($testResultsSummaryMD.Length + $bcptSummaryMD.Length -gt 65000) {
- # If Combined Test Results and BCPT summary exceeds GitHub summary capacity, we will not display the BCPT summary
- $bcptSummaryMD = "Performance test results summary size exceeds GitHub summary capacity. Download **BcptTestResults** artifact to see details."
- }
- # If summary AND BCPT summary AND failures summary fits, we will display all in the GitHub summary
- if ($testResultsSummaryMD.Length + $testResultsfailuresMD.Length + $bcptSummaryMD.Length -gt 65000) {
- # If Combined Test Results, failures and BCPT summary exceeds GitHub summary capacity, we will not display the failures details, only the failures summary
- $testResultsfailuresMD = $testResultsFailuresSummaryMD
- }
-
- Add-Content -Encoding UTF8 -path $ENV:GITHUB_STEP_SUMMARY -value "## Test results`n`n"
- Add-Content -Encoding UTF8 -path $ENV:GITHUB_STEP_SUMMARY -value "$($testResultsSummaryMD.Replace("\n","`n"))`n`n"
- Add-Content -Encoding UTF8 -path $ENV:GITHUB_STEP_SUMMARY -value "$($testResultsfailuresMD.Replace("\n","`n"))`n`n"
- if ($bcptSummaryMD) {
- Add-Content -Encoding UTF8 -path $ENV:GITHUB_STEP_SUMMARY -value "## Performance test results`n`n"
- Add-Content -Encoding UTF8 -path $ENV:GITHUB_STEP_SUMMARY -value "$($bcptSummaryMD.Replace("\n","`n"))`n`n"
- }
-
- TrackTrace -telemetryScope $telemetryScope
+# If summary fits, we will display it in the GitHub summary
+if ($testResultsSummaryMD.Length -gt 65000) {
+ # If Test results summary is too long, we will not display it in the GitHub summary, instead we will display a message to download the test results
+ $testResultsSummaryMD = "Test results summary size exceeds GitHub summary capacity. Download **TestResults** artifact to see details."
+}
+# If summary AND BCPT summary fits, we will display both in the GitHub summary
+if ($testResultsSummaryMD.Length + $bcptSummaryMD.Length -gt 65000) {
+ # If Combined Test Results and BCPT summary exceeds GitHub summary capacity, we will not display the BCPT summary
+ $bcptSummaryMD = "Performance test results summary size exceeds GitHub summary capacity. Download **BcptTestResults** artifact to see details."
+}
+# If summary AND BCPT summary AND failures summary fits, we will display all in the GitHub summary
+if ($testResultsSummaryMD.Length + $testResultsfailuresMD.Length + $bcptSummaryMD.Length -gt 65000) {
+ # If Combined Test Results, failures and BCPT summary exceeds GitHub summary capacity, we will not display the failures details, only the failures summary
+ $testResultsfailuresMD = $testResultsFailuresSummaryMD
}
-catch {
- if (Get-Module BcContainerHelper) {
- TrackException -telemetryScope $telemetryScope -errorRecord $_
- }
- throw
+Add-Content -Encoding UTF8 -path $ENV:GITHUB_STEP_SUMMARY -value "## Test results`n`n"
+Add-Content -Encoding UTF8 -path $ENV:GITHUB_STEP_SUMMARY -value "$($testResultsSummaryMD.Replace("\n","`n"))`n`n"
+Add-Content -Encoding UTF8 -path $ENV:GITHUB_STEP_SUMMARY -value "$($testResultsfailuresMD.Replace("\n","`n"))`n`n"
+if ($bcptSummaryMD) {
+ Add-Content -Encoding UTF8 -path $ENV:GITHUB_STEP_SUMMARY -value "## Performance test results`n`n"
+ Add-Content -Encoding UTF8 -path $ENV:GITHUB_STEP_SUMMARY -value "$($bcptSummaryMD.Replace("\n","`n"))`n`n"
}
diff --git a/Actions/AnalyzeTests/README.md b/Actions/AnalyzeTests/README.md
index 48990379a..9dccef193 100644
--- a/Actions/AnalyzeTests/README.md
+++ b/Actions/AnalyzeTests/README.md
@@ -13,7 +13,6 @@ none
| Name | Required | Description | Default value |
| :-- | :-: | :-- | :-- |
| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell |
-| parentTelemetryScopeJson | | Specifies the parent telemetry scope for the telemetry signal | {} |
| project | Yes | Name of project to analyze or . if the repository is setup for single project | |
## OUTPUT
diff --git a/Actions/AnalyzeTests/action.yaml b/Actions/AnalyzeTests/action.yaml
index 17eb64b5f..4b96603aa 100644
--- a/Actions/AnalyzeTests/action.yaml
+++ b/Actions/AnalyzeTests/action.yaml
@@ -5,10 +5,6 @@ inputs:
description: Shell in which you want to run the action (powershell or pwsh)
required: false
default: powershell
- parentTelemetryScopeJson:
- description: Specifies the parent telemetry scope for the telemetry signal
- required: false
- default: '7b7d'
project:
description: Project to analyze
required: false
@@ -19,16 +15,10 @@ runs:
- name: run
shell: ${{ inputs.shell }}
env:
- _parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }}
_project: ${{ inputs.project }}
run: |
- $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
- try {
- ${{ github.action_path }}/AnalyzeTests.ps1 -parentTelemetryScopeJson $ENV:_parentTelemetryScopeJson -project $ENV:_project
- }
- catch {
- Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
- exit 1
+ ${{ github.action_path }}/../Invoke-AlGoAction.ps1 -ActionName "AnalyzeTests" -Action {
+ ${{ github.action_path }}/AnalyzeTests.ps1 -project $ENV:_project
}
branding:
icon: terminal
diff --git a/Actions/BuildPowerPlatform/action.yaml b/Actions/BuildPowerPlatform/action.yaml
index 3fef03051..67cb5df08 100644
--- a/Actions/BuildPowerPlatform/action.yaml
+++ b/Actions/BuildPowerPlatform/action.yaml
@@ -46,14 +46,9 @@ runs:
_appBuild: ${{ inputs.appBuild }}
_appRevision: ${{ inputs.appRevision }}
run: |
- $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
- try {
+ ${{ github.action_path }}/../Invoke-AlGoAction.ps1 -ActionName "BuildPowerPlatform" -Action {
${{ github.action_path }}/BuildPowerPlatform.ps1 -solutionFolder $ENV:_solutionFolder -companyId $ENV:_companyId -environmentName $ENV:_environmentName -appBuild $ENV:_appBuild -appRevision $ENV:_appRevision
}
- catch {
- Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
- exit 1
- }
- name: Test Pack (Not real - just workaround for https://github.com/microsoft/powerplatform-vscode/issues/412)
uses: microsoft/powerplatform-actions/pack-solution@v1
diff --git a/Actions/BuildReferenceDocumentation/action.yaml b/Actions/BuildReferenceDocumentation/action.yaml
index 0b8434fae..690cbd2d8 100644
--- a/Actions/BuildReferenceDocumentation/action.yaml
+++ b/Actions/BuildReferenceDocumentation/action.yaml
@@ -21,14 +21,9 @@ runs:
_token: ${{ inputs.token }}
_artifacts: ${{ inputs.artifacts }}
run: |
- $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
- try {
+ ${{ github.action_path }}/../Invoke-AlGoAction.ps1 -ActionName "BuildReferenceDocumentation" -Action {
${{ github.action_path }}/BuildReferenceDocumentation.ps1 -token $ENV:_token -artifacts $ENV:_artifacts
}
- catch {
- Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
- exit 1
- }
branding:
icon: terminal
color: blue
diff --git a/Actions/CalculateArtifactNames/action.yaml b/Actions/CalculateArtifactNames/action.yaml
index dd7e32c79..500b7507a 100644
--- a/Actions/CalculateArtifactNames/action.yaml
+++ b/Actions/CalculateArtifactNames/action.yaml
@@ -63,14 +63,9 @@ runs:
_buildMode: ${{ inputs.buildMode }}
_suffix: ${{ inputs.suffix }}
run: |
- $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
- try {
+ ${{ github.action_path }}/../Invoke-AlGoAction.ps1 -ActionName "CalculateArtifactNames" -Action {
${{ github.action_path }}/CalculateArtifactNames.ps1 -project $ENV:_project -buildMode $ENV:_buildMode -suffix $ENV:_suffix
}
- catch {
- Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
- exit 1
- }
branding:
icon: terminal
color: blue
diff --git a/Actions/CheckForUpdates/action.yaml b/Actions/CheckForUpdates/action.yaml
index d6747d4bd..4b12bc6f7 100644
--- a/Actions/CheckForUpdates/action.yaml
+++ b/Actions/CheckForUpdates/action.yaml
@@ -50,14 +50,9 @@ runs:
_updateBranch: ${{ inputs.updateBranch }}
_directCommit: ${{ inputs.directCommit }}
run: |
- $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
- try {
+ ${{ github.action_path }}/../Invoke-AlGoAction.ps1 -ActionName "CheckForUpdates" -Action {
${{ github.action_path }}/CheckForUpdates.ps1 -actor $ENV:_actor -token $ENV:_token -templateUrl $ENV:_templateUrl -downloadLatest ($ENV:_downloadLatest -eq 'true') -update $ENV:_update -updateBranch $ENV:_updateBranch -directCommit ($ENV:_directCommit -eq 'true')
}
- catch {
- Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
- exit 1
- }
branding:
icon: terminal
color: blue
diff --git a/Actions/CreateApp/CreateApp.ps1 b/Actions/CreateApp/CreateApp.ps1
index be43db4d0..f7e75e00a 100644
--- a/Actions/CreateApp/CreateApp.ps1
+++ b/Actions/CreateApp/CreateApp.ps1
@@ -3,8 +3,6 @@
[string] $actor,
[Parameter(HelpMessage = "The GitHub token running the action", Mandatory = $false)]
[string] $token,
- [Parameter(HelpMessage = "Specifies the parent telemetry scope for the telemetry signal", Mandatory = $false)]
- [string] $parentTelemetryScopeJson = '7b7d',
[Parameter(HelpMessage = "Project name if the repository is setup for multiple projects", Mandatory = $false)]
[string] $project = '.',
[ValidateSet("PTE", "AppSource App" , "Test App", "Performance Test App")]
@@ -26,7 +24,6 @@
[bool] $directCommit
)
-$telemetryScope = $null
$tmpFolder = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString())
try {
@@ -35,9 +32,6 @@ try {
$baseFolder = (Get-Location).Path
DownloadAndImportBcContainerHelper -baseFolder $baseFolder
- import-module (Join-Path -path $PSScriptRoot -ChildPath "..\TelemetryHelper.psm1" -Resolve)
- $telemetryScope = CreateScope -eventId 'DO0072' -parentTelemetryScopeJson $parentTelemetryScopeJson
-
import-module (Join-Path -path $PSScriptRoot -ChildPath "AppHelper.psm1" -Resolve)
Write-Host "Template type : $type"
@@ -130,14 +124,8 @@ try {
Set-Location $baseFolder
CommitFromNewFolder -serverUrl $serverUrl -commitMessage "New $type ($Name)" -branch $branch | Out-Null
-
- TrackTrace -telemetryScope $telemetryScope
-
}
catch {
- if (Get-Module BcContainerHelper) {
- TrackException -telemetryScope $telemetryScope -errorRecord $_
- }
throw
}
finally {
diff --git a/Actions/CreateApp/README.md b/Actions/CreateApp/README.md
index 56876142b..d0eca2cdd 100644
--- a/Actions/CreateApp/README.md
+++ b/Actions/CreateApp/README.md
@@ -15,7 +15,6 @@ none
| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell |
| actor | | The GitHub actor running the action | github.actor |
| token | | The GitHub token running the action | github.token |
-| parentTelemetryScopeJson | | Specifies the parent telemetry scope for the telemetry signal | {} |
| project | | Project name if the repository is setup for multiple projects | . |
| type | Yes | Type of app to add (PTE, AppSource App, Test App) | |
| name | Yes | App Name | |
diff --git a/Actions/CreateApp/action.yaml b/Actions/CreateApp/action.yaml
index 678ea1af0..df8c5e872 100644
--- a/Actions/CreateApp/action.yaml
+++ b/Actions/CreateApp/action.yaml
@@ -16,10 +16,6 @@ inputs:
description: The GitHub token running the action
required: false
default: ${{ github.token }}
- parentTelemetryScopeJson:
- description: Specifies the parent telemetry scope for the telemetry signal
- required: false
- default: '7b7d'
project:
description: Project name if the repository is setup for multiple projects
required: false
@@ -60,7 +56,6 @@ runs:
env:
_actor: ${{ inputs.actor }}
_token: ${{ inputs.token }}
- _parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }}
_project: ${{ inputs.project }}
_type: ${{ inputs.type }}
_name: ${{ inputs.name }}
@@ -71,13 +66,8 @@ runs:
_updateBranch: ${{ inputs.updateBranch }}
_directCommit: ${{ inputs.directCommit }}
run: |
- $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
- try {
- ${{ github.action_path }}/CreateApp.ps1 -actor $ENV:_actor -token $ENV:_token -parentTelemetryScopeJson $ENV:_parentTelemetryScopeJson -project $ENV:_project -type $ENV:_type -name $ENV:_name -publisher $ENV:_publisher -idrange $ENV:_idrange -sampleCode ($ENV:_sampleCode -eq 'true') -sampleSuite ($ENV:_sampleSuite -eq 'true') -updateBranch $ENV:_updateBranch -directCommit ($ENV:_directCommit -eq 'true')
- }
- catch {
- Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
- exit 1
+ ${{ github.action_path }}/../Invoke-AlGoAction.ps1 -ActionName "CreateApp" -Action {
+ ${{ github.action_path }}/CreateApp.ps1 -actor $ENV:_actor -token $ENV:_token -project $ENV:_project -type $ENV:_type -name $ENV:_name -publisher $ENV:_publisher -idrange $ENV:_idrange -sampleCode ($ENV:_sampleCode -eq 'true') -sampleSuite ($ENV:_sampleSuite -eq 'true') -updateBranch $ENV:_updateBranch -directCommit ($ENV:_directCommit -eq 'true')
}
branding:
icon: terminal
diff --git a/Actions/CreateDevelopmentEnvironment/CreateDevelopmentEnvironment.ps1 b/Actions/CreateDevelopmentEnvironment/CreateDevelopmentEnvironment.ps1
index ae528eb4f..08d15e90f 100644
--- a/Actions/CreateDevelopmentEnvironment/CreateDevelopmentEnvironment.ps1
+++ b/Actions/CreateDevelopmentEnvironment/CreateDevelopmentEnvironment.ps1
@@ -4,8 +4,6 @@ Param(
[string] $actor,
[Parameter(HelpMessage = "The GitHub token running the action", Mandatory = $false)]
[string] $token,
- [Parameter(HelpMessage = "Specifies the parent telemetry scope for the telemetry signal", Mandatory = $false)]
- [string] $parentTelemetryScopeJson = '7b7d',
[Parameter(HelpMessage = "Name of the online environment", Mandatory = $true)]
[string] $environmentName,
[Parameter(HelpMessage = "Project name if the repository is setup for multiple projects", Mandatory = $false)]
@@ -20,34 +18,19 @@ Param(
[bool] $directCommit
)
-$telemetryScope = $null
+. (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve)
+$serverUrl, $branch = CloneIntoNewFolder -actor $actor -token $token -updateBranch $updateBranch -DirectCommit $directCommit -newBranchPrefix 'create-development-environment'
+$baseFolder = (Get-Location).Path
+DownloadAndImportBcContainerHelper -baseFolder $baseFolder
-try {
- . (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve)
- $serverUrl, $branch = CloneIntoNewFolder -actor $actor -token $token -updateBranch $updateBranch -DirectCommit $directCommit -newBranchPrefix 'create-development-environment'
- $baseFolder = (Get-Location).Path
- DownloadAndImportBcContainerHelper -baseFolder $baseFolder
+$adminCenterApiCredentials = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($adminCenterApiCredentials))
+CreateDevEnv `
+ -kind cloud `
+ -caller GitHubActions `
+ -environmentName $environmentName `
+ -reUseExistingEnvironment:$reUseExistingEnvironment `
+ -baseFolder $baseFolder `
+ -project $project `
+ -adminCenterApiCredentials ($adminCenterApiCredentials | ConvertFrom-Json | ConvertTo-HashTable)
- import-module (Join-Path -path $PSScriptRoot -ChildPath "..\TelemetryHelper.psm1" -Resolve)
- $telemetryScope = CreateScope -eventId 'DO0073' -parentTelemetryScopeJson $parentTelemetryScopeJson
-
- $adminCenterApiCredentials = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($adminCenterApiCredentials))
- CreateDevEnv `
- -kind cloud `
- -caller GitHubActions `
- -environmentName $environmentName `
- -reUseExistingEnvironment:$reUseExistingEnvironment `
- -baseFolder $baseFolder `
- -project $project `
- -adminCenterApiCredentials ($adminCenterApiCredentials | ConvertFrom-Json | ConvertTo-HashTable)
-
- CommitFromNewFolder -serverUrl $serverUrl -commitMessage "Create a development environment $environmentName" -branch $branch | Out-Null
-
- TrackTrace -telemetryScope $telemetryScope
-}
-catch {
- if (Get-Module BcContainerHelper) {
- TrackException -telemetryScope $telemetryScope -errorRecord $_
- }
- throw
-}
+CommitFromNewFolder -serverUrl $serverUrl -commitMessage "Create a development environment $environmentName" -branch $branch | Out-Null
diff --git a/Actions/CreateDevelopmentEnvironment/README.md b/Actions/CreateDevelopmentEnvironment/README.md
index c26ebd2db..9edab8635 100644
--- a/Actions/CreateDevelopmentEnvironment/README.md
+++ b/Actions/CreateDevelopmentEnvironment/README.md
@@ -15,7 +15,6 @@ none
| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell |
| actor | | The GitHub actor running the action | github.actor |
| token | | The GitHub token running the action | github.token |
-| parentTelemetryScopeJson | | Specifies the parent telemetry scope for the telemetry signal | {} |
| environmentName | Yes | Name of the online environment to create |
| project | | Project name if the repository is setup for multiple projects | . |
| adminCenterApiCredentials | | ClientId/ClientSecret or Refresh token for Admin Center API authentication | |
diff --git a/Actions/CreateDevelopmentEnvironment/action.yaml b/Actions/CreateDevelopmentEnvironment/action.yaml
index 86dd7b9e6..b99e5d60d 100644
--- a/Actions/CreateDevelopmentEnvironment/action.yaml
+++ b/Actions/CreateDevelopmentEnvironment/action.yaml
@@ -16,10 +16,6 @@ inputs:
description: The GitHub token running the action
required: false
default: ${{ github.token }}
- parentTelemetryScopeJson:
- description: Specifies the parent telemetry scope for the telemetry signal
- required: false
- default: '7b7d'
environmentName:
description: Name of the online environment
required: true
@@ -51,7 +47,6 @@ runs:
env:
_actor: ${{ inputs.actor }}
_token: ${{ inputs.token }}
- _parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }}
_environmentName: ${{ inputs.environmentName }}
_project: ${{ inputs.project }}
_adminCenterApiCredentials: ${{ inputs.adminCenterApiCredentials }}
@@ -59,13 +54,8 @@ runs:
_updateBranch: ${{ inputs.updateBranch }}
_directCommit: ${{ inputs.directCommit }}
run: |
- $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
- try {
- ${{ github.action_path }}/CreateDevelopmentEnvironment.ps1 -actor $ENV:_actor -token $ENV:_token -parentTelemetryScopeJson $ENV:_parentTelemetryScopeJson -environmentName $ENV:_environmentName -project $ENV:_project -adminCenterApiCredentials $ENV:_adminCenterApiCredentials -reUseExistingEnvironment ($ENV:_reUseExistingEnvironment -eq 'true') -updateBranch $ENV:_updateBranch -directCommit ($ENV:_directCommit -eq 'true')
- }
- catch {
- Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
- exit 1
+ ${{ github.action_path }}/../Invoke-AlGoAction.ps1 -ActionName "CreateDevelopmentEnvironment" -Action {
+ ${{ github.action_path }}/CreateDevelopmentEnvironment.ps1 -actor $ENV:_actor -token $ENV:_token -environmentName $ENV:_environmentName -project $ENV:_project -adminCenterApiCredentials $ENV:_adminCenterApiCredentials -reUseExistingEnvironment ($ENV:_reUseExistingEnvironment -eq 'true') -updateBranch $ENV:_updateBranch -directCommit ($ENV:_directCommit -eq 'true')
}
branding:
icon: terminal
diff --git a/Actions/CreateReleaseNotes/CreateReleaseNotes.ps1 b/Actions/CreateReleaseNotes/CreateReleaseNotes.ps1
index 50d7ae6ee..d41207711 100644
--- a/Actions/CreateReleaseNotes/CreateReleaseNotes.ps1
+++ b/Actions/CreateReleaseNotes/CreateReleaseNotes.ps1
@@ -1,73 +1,56 @@
Param(
[Parameter(HelpMessage = "The GitHub token running the action", Mandatory = $false)]
[string] $token,
- [Parameter(HelpMessage = "Specifies the parent telemetry scope for the telemetry signal", Mandatory = $false)]
- [string] $parentTelemetryScopeJson = '7b7d',
[Parameter(HelpMessage = "Tag name", Mandatory = $true)]
[string] $tag_name,
[Parameter(HelpMessage = "Last commit to include in release notes", Mandatory = $false)]
[string] $target_commitish
)
-$telemetryScope = $null
+. (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1")
+DownloadAndImportBcContainerHelper
-try {
- . (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1")
- DownloadAndImportBcContainerHelper
-
- import-module (Join-Path -path $PSScriptRoot -ChildPath "..\TelemetryHelper.psm1" -Resolve)
- $telemetryScope = CreateScope -eventId 'DO0074' -parentTelemetryScopeJson $parentTelemetryScopeJson
+Import-Module (Join-Path $PSScriptRoot '..\Github-Helper.psm1' -Resolve)
- Import-Module (Join-Path $PSScriptRoot '..\Github-Helper.psm1' -Resolve)
+# Check that tag is SemVer
+$SemVerObj = SemVerStrToSemVerObj -semVerStr $tag_name
- # Check that tag is SemVer
- $SemVerObj = SemVerStrToSemVerObj -semVerStr $tag_name
-
- # Calculate release version
- $releaseVersion = "$($SemVerObj.Prefix)$($SemVerObj.Major).$($SemVerObj.Minor)"
- if ($SemVerObj.Patch -or $SemVerObj.addt0 -ne 'zzz') {
- $releaseVersion += ".$($SemVerObj.Patch)"
- if ($SemVerObj.addt0 -ne 'zzz') {
- $releaseVersion += "-$($SemVerObj.addt0)"
- 1..4 | ForEach-Object {
- if ($SemVerObj."addt$($_)" -ne 'zzz') {
- $releaseVersion += ".$($SemVerObj."addt$($_)")"
- }
+# Calculate release version
+$releaseVersion = "$($SemVerObj.Prefix)$($SemVerObj.Major).$($SemVerObj.Minor)"
+if ($SemVerObj.Patch -or $SemVerObj.addt0 -ne 'zzz') {
+ $releaseVersion += ".$($SemVerObj.Patch)"
+ if ($SemVerObj.addt0 -ne 'zzz') {
+ $releaseVersion += "-$($SemVerObj.addt0)"
+ 1..4 | ForEach-Object {
+ if ($SemVerObj."addt$($_)" -ne 'zzz') {
+ $releaseVersion += ".$($SemVerObj."addt$($_)")"
}
}
}
- Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "releaseVersion=$releaseVersion"
- Write-Host "releaseVersion=$releaseVersion"
-
- $latestRelease = GetLatestRelease -token $token -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY -ref $ENV:GITHUB_REF_NAME
- if ($latestRelease -and $latestRelease.PSobject.Properties.name -eq "target_commitish") {
- if ($latestRelease.target_commitish -eq $target_commitish) {
- throw "The latest release is based on the same commit as this release is targetting."
- }
- }
+}
+Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "releaseVersion=$releaseVersion"
+Write-Host "releaseVersion=$releaseVersion"
- $latestReleaseTag = ""
- if ($latestRelease -and $latestRelease.PSobject.Properties.name -eq "tag_name") {
- $latestReleaseTag = $latestRelease.tag_name
+$latestRelease = GetLatestRelease -token $token -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY -ref $ENV:GITHUB_REF_NAME
+if ($latestRelease -and $latestRelease.PSobject.Properties.name -eq "target_commitish") {
+ if ($latestRelease.target_commitish -eq $target_commitish) {
+ throw "The latest release is based on the same commit as this release is targetting."
}
+}
- try {
- $releaseNotes = GetReleaseNotes -token $token -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY -tag_name $tag_name -previous_tag_name $latestReleaseTag -target_commitish $target_commitish | ConvertFrom-Json
- $releaseNotes = $releaseNotes.body -replace '%','%25' -replace '\n','%0A' -replace '\r','%0D' # supports a multiline text
- }
- catch {
- OutputWarning -message "Couldn't create release notes.$([environment]::Newline)Error: $($_.Exception.Message)$([environment]::Newline)Stacktrace: $($_.scriptStackTrace)"
- OutputWarning -message "You can modify the release note from the release page later."
- $releaseNotes = ""
- }
- Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "releaseNotes=$releaseNotes"
- Write-Host "releaseNotes=$releaseNotes"
+$latestReleaseTag = ""
+if ($latestRelease -and $latestRelease.PSobject.Properties.name -eq "tag_name") {
+ $latestReleaseTag = $latestRelease.tag_name
+}
- TrackTrace -telemetryScope $telemetryScope
+try {
+ $releaseNotes = GetReleaseNotes -token $token -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY -tag_name $tag_name -previous_tag_name $latestReleaseTag -target_commitish $target_commitish | ConvertFrom-Json
+ $releaseNotes = $releaseNotes.body -replace '%','%25' -replace '\n','%0A' -replace '\r','%0D' # supports a multiline text
}
catch {
- if (Get-Module BcContainerHelper) {
- TrackException -telemetryScope $telemetryScope -errorRecord $_
- }
- throw
+ OutputWarning -message "Couldn't create release notes.$([environment]::Newline)Error: $($_.Exception.Message)$([environment]::Newline)Stacktrace: $($_.scriptStackTrace)"
+ OutputWarning -message "You can modify the release note from the release page later."
+ $releaseNotes = ""
}
+Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "releaseNotes=$releaseNotes"
+Write-Host "releaseNotes=$releaseNotes"
diff --git a/Actions/CreateReleaseNotes/README.md b/Actions/CreateReleaseNotes/README.md
index 7bc6f629b..e2d7cf840 100644
--- a/Actions/CreateReleaseNotes/README.md
+++ b/Actions/CreateReleaseNotes/README.md
@@ -14,7 +14,6 @@ none
| :-- | :-: | :-- | :-- |
| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell |
| token | | The GitHub token running the action | github.token |
-| parentTelemetryScopeJson | | Specifies the parent telemetry scope for the telemetry signal | {} |
| tag_name | Yes | This release tag name | |
| target_commitish | | Last commit to include in release notes | Latest |
diff --git a/Actions/CreateReleaseNotes/action.yaml b/Actions/CreateReleaseNotes/action.yaml
index 826c58392..427d353dd 100644
--- a/Actions/CreateReleaseNotes/action.yaml
+++ b/Actions/CreateReleaseNotes/action.yaml
@@ -12,10 +12,6 @@ inputs:
description: The GitHub token running the action
required: false
default: ${{ github.token }}
- parentTelemetryScopeJson:
- description: Specifies the parent telemetry scope for the telemetry signal
- required: false
- default: '7b7d'
tag_name:
description: Tag name
required: true
@@ -38,17 +34,11 @@ runs:
id: createreleasenotes
env:
_token: ${{ inputs.token }}
- _parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }}
_tag_name: ${{ inputs.tag_name }}
_target_commitish: ${{ inputs.target_commitish }}
run: |
- $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
- try {
- ${{ github.action_path }}/CreateReleaseNotes.ps1 -token $ENV:_token -parentTelemetryScopeJson $ENV:_parentTelemetryScopeJson -tag_name $ENV:_tag_name -target_commitish $ENV:_target_commitish
- }
- catch {
- Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
- exit 1
+ ${{ github.action_path }}/../Invoke-AlGoAction.ps1 -ActionName "CreateReleaseNotes" -Action {
+ ${{ github.action_path }}/CreateReleaseNotes.ps1 -token $ENV:_token -tag_name $ENV:_tag_name -target_commitish $ENV:_target_commitish
}
branding:
icon: terminal
diff --git a/Actions/Deliver/Deliver.ps1 b/Actions/Deliver/Deliver.ps1
index 0d22b793d..5c62254ff 100644
--- a/Actions/Deliver/Deliver.ps1
+++ b/Actions/Deliver/Deliver.ps1
@@ -3,8 +3,6 @@
[string] $actor,
[Parameter(HelpMessage = "The GitHub token running the action", Mandatory = $false)]
[string] $token,
- [Parameter(HelpMessage = "Specifies the parent telemetry scope for the telemetry signal", Mandatory = $false)]
- [string] $parentTelemetryScopeJson = '7b7d',
[Parameter(HelpMessage = "Projects to deliver (default is all)", Mandatory = $false)]
[string] $projects = "*",
[Parameter(HelpMessage = "Delivery target (AppSource or Storage)", Mandatory = $true)]
@@ -12,7 +10,7 @@
[Parameter(HelpMessage = "The artifacts to deliver or a folder in which the artifacts have been downloaded", Mandatory = $true)]
[string] $artifacts,
[Parameter(HelpMessage = "Type of delivery (CD or Release)", Mandatory = $false)]
- [ValidateSet('CD','Release')]
+ [ValidateSet('CD', 'Release')]
[string] $type = "CD",
[Parameter(HelpMessage = "Types of artifacts to deliver (Apps,Dependencies,TestApps)", Mandatory = $false)]
[string] $atypes = "Apps,Dependencies,TestApps",
@@ -61,450 +59,435 @@ function ConnectAzStorageAccount {
return $azStorageContext
}
-$telemetryScope = $null
+. (Join-Path -Path $PSScriptRoot -ChildPath "../AL-Go-Helper.ps1" -Resolve)
+DownloadAndImportBcContainerHelper
-try {
- . (Join-Path -Path $PSScriptRoot -ChildPath "../AL-Go-Helper.ps1" -Resolve)
- DownloadAndImportBcContainerHelper
+$refname = "$ENV:GITHUB_REF_NAME".Replace('/', '_')
- import-module (Join-Path -path $PSScriptRoot -ChildPath "../TelemetryHelper.psm1" -Resolve)
- $telemetryScope = CreateScope -eventId 'DO0081' -parentTelemetryScopeJson $parentTelemetryScopeJson
+$artifacts = $artifacts.Replace('/', ([System.IO.Path]::DirectorySeparatorChar)).Replace('\', ([System.IO.Path]::DirectorySeparatorChar))
- $refname = "$ENV:GITHUB_REF_NAME".Replace('/','_')
-
- $artifacts = $artifacts.Replace('/',([System.IO.Path]::DirectorySeparatorChar)).Replace('\',([System.IO.Path]::DirectorySeparatorChar))
-
- $baseFolder = $ENV:GITHUB_WORKSPACE
- $settings = ReadSettings -baseFolder $baseFolder
- $projectList = @(GetProjectsFromRepository -baseFolder $baseFolder -projectsFromSettings $settings.projects -selectProjects $projects)
- if ($deliveryTarget -eq "AppSource") {
- $atypes = "Apps,Dependencies"
+$baseFolder = $ENV:GITHUB_WORKSPACE
+$settings = ReadSettings -baseFolder $baseFolder
+$projectList = @(GetProjectsFromRepository -baseFolder $baseFolder -projectsFromSettings $settings.projects -selectProjects $projects)
+if ($deliveryTarget -eq "AppSource") {
+ $atypes = "Apps,Dependencies"
+}
+Write-Host "Artifacts $artifacts"
+Write-Host "Projects:"
+$projectList | Out-Host
+
+$secrets = $env:Secrets | ConvertFrom-Json
+foreach ($thisProject in $projectList) {
+ # $project should be the project part of the artifact name generated from the build
+ if ($thisProject -and ($thisProject -ne '.')) {
+ $project = $thisProject.Replace('\', '_').Replace('/', '_')
}
- Write-Host "Artifacts $artifacts"
- Write-Host "Projects:"
- $projectList | Out-Host
+ else {
+ $project = $settings.repoName
+ }
+ # projectName is the project name stripped for special characters
+ $projectName = $project -replace "[^a-z0-9]", "-"
+ Write-Host "ProjectName '$projectName'"
- $secrets = $env:Secrets | ConvertFrom-Json
- foreach($thisProject in $projectList) {
- # $project should be the project part of the artifact name generated from the build
- if ($thisProject -and ($thisProject -ne '.')) {
- $project = $thisProject.Replace('\','_').Replace('/','_')
- }
- else {
- $project = $settings.repoName
+ if ($artifacts -like "$($baseFolder)*") {
+ $artifactsFolder = $artifacts
+ }
+ else {
+ $artifactsFolder = Join-Path $baseFolder ".artifacts"
+ $artifactsFolderCreated = $false
+ if (!(Test-Path $artifactsFolder)) {
+ New-Item $artifactsFolder -ItemType Directory | Out-Null
+ $artifactsFolderCreated = $true
}
- # projectName is the project name stripped for special characters
- $projectName = $project -replace "[^a-z0-9]", "-"
- Write-Host "ProjectName '$projectName'"
-
- if ($artifacts -like "$($baseFolder)*") {
- $artifactsFolder = $artifacts
+ if ($artifacts -eq '.artifacts') {
+ # Artifacts from this build have been downloaded
}
- else {
- $artifactsFolder = Join-Path $baseFolder ".artifacts"
- $artifactsFolderCreated = $false
- if (!(Test-Path $artifactsFolder)) {
- New-Item $artifactsFolder -ItemType Directory | Out-Null
- $artifactsFolderCreated = $true
- }
- if ($artifacts -eq '.artifacts') {
- # Artifacts from this build have been downloaded
- }
- elseif ($artifacts -eq "current" -or $artifacts -eq "prerelease" -or $artifacts -eq "draft") {
- # project is the project name as used in release asset names
- $project = [Uri]::EscapeDataString($project.Replace(' ','.')).Replace('%','')
-
- # latest released version
- $releases = GetReleases -token $token -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY
- if ($artifacts -eq "current") {
- $release = $releases | Where-Object { -not ($_.prerelease -or $_.draft) } | Select-Object -First 1
- }
- elseif ($artifacts -eq "prerelease") {
- $release = $releases | Where-Object { -not ($_.draft) } | Select-Object -First 1
- }
- elseif ($artifacts -eq "draft") {
- $release = $releases | Select-Object -First 1
+ elseif ($artifacts -eq "current" -or $artifacts -eq "prerelease" -or $artifacts -eq "draft") {
+ # project is the project name as used in release asset names
+ $project = [Uri]::EscapeDataString($project.Replace(' ', '.')).Replace('%', '')
+
+ # latest released version
+ $releases = GetReleases -token $token -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY
+ if ($artifacts -eq "current") {
+ $release = $releases | Where-Object { -not ($_.prerelease -or $_.draft) } | Select-Object -First 1
+ }
+ elseif ($artifacts -eq "prerelease") {
+ $release = $releases | Where-Object { -not ($_.draft) } | Select-Object -First 1
+ }
+ elseif ($artifacts -eq "draft") {
+ $release = $releases | Select-Object -First 1
+ }
+ if (!($release)) {
+ throw "Unable to locate $artifacts release"
+ }
+ foreach ($mask in $atypes.Split(',')) {
+ $artifactFile = DownloadRelease -token $token -projects $project -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY -release $release -path $artifactsFolder -mask $mask
+ Write-Host "'$artifactFile'"
+ if (!$artifactFile -or !(Test-Path $artifactFile)) {
+ if ($mask -eq 'Apps') {
+ throw "Artifact $artifacts was not found on any release. Make sure that the artifact files exist and files are not corrupted."
+ }
}
- if (!($release)) {
- throw "Unable to locate $artifacts release"
+ else {
+ if ($artifactFile -notlike '*.zip') {
+ throw "Downloaded artifact is not a .zip file"
+ }
+ Expand-Archive -Path $artifactFile -DestinationPath ($artifactFile.SubString(0, $artifactFile.Length - 4))
+ Remove-Item $artifactFile -Force
}
- foreach($mask in $atypes.Split(',')) {
- $artifactFile = DownloadRelease -token $token -projects $project -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY -release $release -path $artifactsFolder -mask $mask
- Write-Host "'$artifactFile'"
- if (!$artifactFile -or !(Test-Path $artifactFile)) {
- if ($mask -eq 'Apps') {
- throw "Artifact $artifacts was not found on any release. Make sure that the artifact files exist and files are not corrupted."
+ }
+ }
+ else {
+ $atypes.Split(',') | ForEach-Object {
+ $atype = $_
+ $allArtifacts = GetArtifacts -token $token -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY -mask $atype -projects $project -version $artifacts -branch $ENV:GITHUB_REF_NAME
+ if ($allArtifacts) {
+ $allArtifacts | ForEach-Object {
+ $artifactFile = DownloadArtifact -token $token -artifact $_ -path $artifactsFolder
+ Write-Host $artifactFile
+ if (!(Test-Path $artifactFile)) {
+ throw "Unable to download artifact $($_.name)"
}
- }
- else {
if ($artifactFile -notlike '*.zip') {
throw "Downloaded artifact is not a .zip file"
}
- Expand-Archive -Path $artifactFile -DestinationPath ($artifactFile.SubString(0,$artifactFile.Length-4))
+ Expand-Archive -Path $artifactFile -DestinationPath ($artifactFile.SubString(0, $artifactFile.Length - 4))
Remove-Item $artifactFile -Force
}
}
- }
- else {
- $atypes.Split(',') | ForEach-Object {
- $atype = $_
- $allArtifacts = GetArtifacts -token $token -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY -mask $atype -projects $project -version $artifacts -branch $ENV:GITHUB_REF_NAME
- if ($allArtifacts) {
- $allArtifacts | ForEach-Object {
- $artifactFile = DownloadArtifact -token $token -artifact $_ -path $artifactsFolder
- Write-Host $artifactFile
- if (!(Test-Path $artifactFile)) {
- throw "Unable to download artifact $($_.name)"
- }
- if ($artifactFile -notlike '*.zip') {
- throw "Downloaded artifact is not a .zip file"
- }
- Expand-Archive -Path $artifactFile -DestinationPath ($artifactFile.SubString(0,$artifactFile.Length-4))
- Remove-Item $artifactFile -Force
- }
+ else {
+ if ($atype -eq "Apps") {
+ throw "ERROR: Could not find any $atype artifacts for projects $projects, version $artifacts"
}
else {
- if ($atype -eq "Apps") {
- throw "ERROR: Could not find any $atype artifacts for projects $projects, version $artifacts"
- }
- else {
- Write-Host "WARNING: Could not find any $atype artifacts for projects $projects, version $artifacts"
- }
+ Write-Host "WARNING: Could not find any $atype artifacts for projects $projects, version $artifacts"
}
}
}
}
+ }
- Write-Host "Project '$project'"
- Write-Host "Artifacts:"
- Get-ChildItem -Path $artifactsFolder | ForEach-Object {
- Write-Host "- $($_.Name)"
+ Write-Host "Project '$project'"
+ Write-Host "Artifacts:"
+ Get-ChildItem -Path $artifactsFolder | ForEach-Object {
+ Write-Host "- $($_.Name)"
+ }
+
+ # Check if there is a custom script to run for the delivery target
+ $customScript = Join-Path $baseFolder ".github/DeliverTo$deliveryTarget.ps1"
+
+ if (Test-Path $customScript -PathType Leaf) {
+ Write-Host "Found custom script $customScript for delivery target $deliveryTarget"
+
+ $projectSettings = ReadSettings -baseFolder $baseFolder -project $thisProject
+ $projectSettings = AnalyzeRepo -settings $projectSettings -baseFolder $baseFolder -project $thisProject -doNotCheckArtifactSetting -doNotIssueWarnings
+ $parameters = @{
+ "Project" = $thisProject
+ "ProjectName" = $projectName
+ "type" = $type
+ "Context" = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($secrets."$($deliveryTarget)Context"))
+ "RepoSettings" = $settings
+ "ProjectSettings" = $projectSettings
}
+ #Calculate the folders per artifact type
- # Check if there is a custom script to run for the delivery target
- $customScript = Join-Path $baseFolder ".github/DeliverTo$deliveryTarget.ps1"
+ #Calculate the folders per artifact type
+ 'Apps', 'TestApps', 'Dependencies' | ForEach-Object {
+ $artifactType = $_
+ $singleArtifactFilter = "$project-$refname-$artifactType-*.*.*.*";
- if (Test-Path $customScript -PathType Leaf) {
- Write-Host "Found custom script $customScript for delivery target $deliveryTarget"
+ # Get the folder holding the artifacts from the standard build
+ $artifactFolder = @(Get-ChildItem -Path (Join-Path $artifactsFolder $singleArtifactFilter) -Directory)
- $projectSettings = ReadSettings -baseFolder $baseFolder -project $thisProject
- $projectSettings = AnalyzeRepo -settings $projectSettings -baseFolder $baseFolder -project $thisProject -doNotCheckArtifactSetting -doNotIssueWarnings
- $parameters = @{
- "Project" = $thisProject
- "ProjectName" = $projectName
- "type" = $type
- "Context" = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($secrets."$($deliveryTarget)Context"))
- "RepoSettings" = $settings
- "ProjectSettings" = $projectSettings
+ # Verify that there is an apps folder
+ if ($artifactFolder.Count -eq 0 -and $artifactType -eq "Apps") {
+ throw "Internal error - unable to locate apps folder"
}
- #Calculate the folders per artifact type
- #Calculate the folders per artifact type
- 'Apps', 'TestApps', 'Dependencies' | ForEach-Object {
- $artifactType = $_
- $singleArtifactFilter = "$project-$refname-$artifactType-*.*.*.*";
-
- # Get the folder holding the artifacts from the standard build
- $artifactFolder = @(Get-ChildItem -Path (Join-Path $artifactsFolder $singleArtifactFilter) -Directory)
-
- # Verify that there is an apps folder
- if ($artifactFolder.Count -eq 0 -and $artifactType -eq "Apps") {
- throw "Internal error - unable to locate apps folder"
- }
-
- # Verify that there is only at most one artifact folder for the standard build
- if ($artifactFolder.Count -gt 1) {
- $artifactFolder | Out-Host
- throw "Internal error - multiple $artifactType folders located"
- }
+ # Verify that there is only at most one artifact folder for the standard build
+ if ($artifactFolder.Count -gt 1) {
+ $artifactFolder | Out-Host
+ throw "Internal error - multiple $artifactType folders located"
+ }
- # Add the artifact folder to the parameters
- if ($artifactFolder.Count -ne 0) {
- $parameters[$artifactType.ToLowerInvariant() + "Folder"] = $artifactFolder[0].FullName
- }
+ # Add the artifact folder to the parameters
+ if ($artifactFolder.Count -ne 0) {
+ $parameters[$artifactType.ToLowerInvariant() + "Folder"] = $artifactFolder[0].FullName
+ }
- # Get the folders holding the artifacts from all build modes
- $multipleArtifactFilter = "$project-$refname-*$artifactType-*.*.*.*";
- $artifactFolders = @(Get-ChildItem -Path (Join-Path $artifactsFolder $multipleArtifactFilter) -Directory)
- if ($artifactFolders.Count -gt 0) {
- $parameters[$artifactType.ToLowerInvariant() + "Folders"] = $artifactFolders.FullName
- }
+ # Get the folders holding the artifacts from all build modes
+ $multipleArtifactFilter = "$project-$refname-*$artifactType-*.*.*.*";
+ $artifactFolders = @(Get-ChildItem -Path (Join-Path $artifactsFolder $multipleArtifactFilter) -Directory)
+ if ($artifactFolders.Count -gt 0) {
+ $parameters[$artifactType.ToLowerInvariant() + "Folders"] = $artifactFolders.FullName
}
+ }
- Write-Host "Calling custom script: $customScript"
- . $customScript -parameters $parameters
- }
- elseif ($deliveryTarget -eq "GitHubPackages") {
- $githubPackagesCredential = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($secrets.githubPackagesContext)) | ConvertFrom-Json
- 'Apps' | ForEach-Object {
- $folder = @(Get-ChildItem -Path (Join-Path $artifactsFolder "$project-$refname-$($_)-*.*.*.*") | Where-Object { $_.PSIsContainer })
- if ($folder.Count -gt 1) {
- $folder | Out-Host
- throw "Internal error - multiple $_ folders located"
- }
- elseif ($folder.Count -eq 1) {
- Get-Item -Path (Join-Path $folder[0] "*.app") | ForEach-Object {
- $parameters = @{
- "gitHubRepository" = "$ENV:GITHUB_SERVER_URL/$ENV:GITHUB_REPOSITORY"
- "includeNuGetDependencies" = $true
- "dependencyIdTemplate" = "AL-Go-{id}"
- "packageId" = "AL-Go-{id}"
- }
- $parameters.appFiles = $_.FullName
- $package = New-BcNuGetPackage @parameters
- Push-BcNuGetPackage -nuGetServerUrl $gitHubPackagesCredential.serverUrl -nuGetToken $gitHubPackagesCredential.token -bcNuGetPackage $package
+ Write-Host "Calling custom script: $customScript"
+ . $customScript -parameters $parameters
+ }
+ elseif ($deliveryTarget -eq "GitHubPackages") {
+ $githubPackagesCredential = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($secrets.githubPackagesContext)) | ConvertFrom-Json
+ 'Apps' | ForEach-Object {
+ $folder = @(Get-ChildItem -Path (Join-Path $artifactsFolder "$project-$refname-$($_)-*.*.*.*") | Where-Object { $_.PSIsContainer })
+ if ($folder.Count -gt 1) {
+ $folder | Out-Host
+ throw "Internal error - multiple $_ folders located"
+ }
+ elseif ($folder.Count -eq 1) {
+ Get-Item -Path (Join-Path $folder[0] "*.app") | ForEach-Object {
+ $parameters = @{
+ "gitHubRepository" = "$ENV:GITHUB_SERVER_URL/$ENV:GITHUB_REPOSITORY"
+ "includeNuGetDependencies" = $true
+ "dependencyIdTemplate" = "AL-Go-{id}"
+ "packageId" = "AL-Go-{id}"
}
+ $parameters.appFiles = $_.FullName
+ $package = New-BcNuGetPackage @parameters
+ Push-BcNuGetPackage -nuGetServerUrl $gitHubPackagesCredential.serverUrl -nuGetToken $gitHubPackagesCredential.token -bcNuGetPackage $package
}
}
}
- elseif ($deliveryTarget -eq "NuGet") {
- try {
- $nuGetAccount = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($secrets.nuGetContext)) | ConvertFrom-Json | ConvertTo-HashTable
- $nuGetServerUrl = $nuGetAccount.ServerUrl
- $nuGetToken = $nuGetAccount.Token
- Write-Host "NuGetContext secret OK"
- }
- catch {
- throw "NuGetContext secret is malformed. Needs to be formatted as Json, containing serverUrl and token as a minimum."
- }
- $appsfolder = @(Get-ChildItem -Path (Join-Path $artifactsFolder "$project-$refname-Apps-*.*.*.*") | Where-Object { $_.PSIsContainer })
- if ($appsFolder.Count -eq 0) {
- throw "Internal error - unable to locate apps folder"
- }
- elseif ($appsFolder.Count -gt 1) {
- $appsFolder | Out-Host
- throw "Internal error - multiple apps folders located"
- }
- $testAppsFolder = @(Get-ChildItem -Path (Join-Path $artifactsFolder "$project-$refname-TestApps-*.*.*.*") | Where-Object { $_.PSIsContainer })
- if ($testAppsFolder.Count -gt 1) {
- $testAppsFolder | Out-Host
- throw "Internal error - multiple testApps folders located"
- }
- $dependenciesFolder = @(Get-ChildItem -Path (Join-Path $artifactsFolder "$project-$refname-Dependencies-*.*.*.*") | Where-Object { $_.PSIsContainer })
- if ($dependenciesFolder.Count -gt 1) {
- $dependenciesFolder | Out-Host
- throw "Internal error - multiple dependencies folders located"
- }
+ }
+ elseif ($deliveryTarget -eq "NuGet") {
+ try {
+ $nuGetAccount = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($secrets.nuGetContext)) | ConvertFrom-Json | ConvertTo-HashTable
+ $nuGetServerUrl = $nuGetAccount.ServerUrl
+ $nuGetToken = $nuGetAccount.Token
+ Write-Host "NuGetContext secret OK"
+ }
+ catch {
+ throw "NuGetContext secret is malformed. Needs to be formatted as Json, containing serverUrl and token as a minimum."
+ }
+ $appsfolder = @(Get-ChildItem -Path (Join-Path $artifactsFolder "$project-$refname-Apps-*.*.*.*") | Where-Object { $_.PSIsContainer })
+ if ($appsFolder.Count -eq 0) {
+ throw "Internal error - unable to locate apps folder"
+ }
+ elseif ($appsFolder.Count -gt 1) {
+ $appsFolder | Out-Host
+ throw "Internal error - multiple apps folders located"
+ }
+ $testAppsFolder = @(Get-ChildItem -Path (Join-Path $artifactsFolder "$project-$refname-TestApps-*.*.*.*") | Where-Object { $_.PSIsContainer })
+ if ($testAppsFolder.Count -gt 1) {
+ $testAppsFolder | Out-Host
+ throw "Internal error - multiple testApps folders located"
+ }
+ $dependenciesFolder = @(Get-ChildItem -Path (Join-Path $artifactsFolder "$project-$refname-Dependencies-*.*.*.*") | Where-Object { $_.PSIsContainer })
+ if ($dependenciesFolder.Count -gt 1) {
+ $dependenciesFolder | Out-Host
+ throw "Internal error - multiple dependencies folders located"
+ }
- $parameters = @{
- "gitHubRepository" = "$ENV:GITHUB_SERVER_URL/$ENV:GITHUB_REPOSITORY"
- }
- $parameters.appFiles = @(Get-Item -Path (Join-Path $appsFolder[0] "*.app") | ForEach-Object { $_.FullName })
- if ($testAppsFolder.Count -gt 0) {
- $parameters.testAppFiles = @(Get-Item -Path (Join-Path $testAppsFolder[0] "*.app") | ForEach-Object { $_.FullName })
- }
- if ($dependenciesFolder.Count -gt 0) {
- $parameters.dependencyAppFiles = @(Get-Item -Path (Join-Path $dependenciesFolder[0] "*.app") | ForEach-Object { $_.FullName })
- }
- if ($nuGetAccount.Keys -contains 'PackageName') {
- $parameters.packageId = $nuGetAccount.PackageName.replace('{project}',$projectName).replace('{owner}',$ENV:GITHUB_REPOSITORY_OWNER).replace('{repo}',$settings.repoName)
+ $parameters = @{
+ "gitHubRepository" = "$ENV:GITHUB_SERVER_URL/$ENV:GITHUB_REPOSITORY"
+ }
+ $parameters.appFiles = @(Get-Item -Path (Join-Path $appsFolder[0] "*.app") | ForEach-Object { $_.FullName })
+ if ($testAppsFolder.Count -gt 0) {
+ $parameters.testAppFiles = @(Get-Item -Path (Join-Path $testAppsFolder[0] "*.app") | ForEach-Object { $_.FullName })
+ }
+ if ($dependenciesFolder.Count -gt 0) {
+ $parameters.dependencyAppFiles = @(Get-Item -Path (Join-Path $dependenciesFolder[0] "*.app") | ForEach-Object { $_.FullName })
+ }
+ if ($nuGetAccount.Keys -contains 'PackageName') {
+ $parameters.packageId = $nuGetAccount.PackageName.replace('{project}', $projectName).replace('{owner}', $ENV:GITHUB_REPOSITORY_OWNER).replace('{repo}', $settings.repoName)
+ }
+ else {
+ if ($thisProject -and ($thisProject -eq '.')) {
+ $parameters.packageId = "$($ENV:GITHUB_REPOSITORY_OWNER)-$($settings.repoName)"
}
else {
- if ($thisProject -and ($thisProject -eq '.')) {
- $parameters.packageId = "$($ENV:GITHUB_REPOSITORY_OWNER)-$($settings.repoName)"
+ $parameters.packageId = "$($ENV:GITHUB_REPOSITORY_OWNER)-$($settings.repoName)-$ProjectName"
+ }
+ }
+ if ($type -eq 'CD') {
+ $parameters.packageId += "-preview"
+ }
+ $parameters.packageVersion = [System.Version]$appsFolder[0].Name.SubString($appsFolder[0].Name.IndexOf("-Apps-") + 6)
+ if ($nuGetAccount.Keys -contains 'PackageTitle') {
+ $parameters.packageTitle = $nuGetAccount.PackageTitle
+ }
+ else {
+ $parameters.packageTitle = $parameters.packageId
+ }
+ if ($nuGetAccount.Keys -contains 'PackageDescription') {
+ $parameters.packageDescription = $nuGetAccount.PackageDescription
+ }
+ else {
+ $parameters.packageDescription = $parameters.packageTitle
+ }
+ if ($nuGetAccount.Keys -contains 'PackageAuthors') {
+ $parameters.packageAuthors = $nuGetAccount.PackageAuthors
+ }
+ else {
+ $parameters.packageAuthors = $actor
+ }
+ $package = New-BcNuGetPackage @parameters
+ Push-BcNuGetPackage -nuGetServerUrl $nuGetServerUrl -nuGetToken $nuGetToken -bcNuGetPackage $package
+ }
+ elseif ($deliveryTarget -eq "Storage") {
+ InstallAzModuleIfNeeded -name 'Az.Storage'
+ try {
+ $storageAccountCredentials = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($secrets.storageContext)) | ConvertFrom-Json
+ $storageAccountCredentials.StorageAccountName | Out-Null
+ $storageContainerName = $storageAccountCredentials.ContainerName.ToLowerInvariant().replace('{project}', $projectName).replace('{branch}', $refname).ToLowerInvariant()
+ $storageBlobName = $storageAccountCredentials.BlobName.ToLowerInvariant()
+ }
+ catch {
+ throw "StorageContext secret is malformed. Needs to be formatted as Json, containing StorageAccountName, containerName, blobName.`nError was: $($_.Exception.Message)"
+ }
+ $azStorageContext = ConnectAzStorageAccount -storageAccountCredentials $storageAccountCredentials
+ Write-Host "Storage Container Name is $storageContainerName"
+ Write-Host "Storage Blob Name is $storageBlobName"
+
+ $containerExists = $true
+ try {
+ Get-AzStorageContainer -Context $azStorageContext -name $storageContainerName | Out-Null
+ }
+ catch {
+ $containerExists = $false
+ }
+
+ if (-not $containerExists -and $settings.Contains('DeliverToStorage') -and $settings."DeliverToStorage".Contains('CreateContainerIfNotExist') -and $settings."DeliverToStorage"."CreateContainerIfNotExist" -eq $true) {
+ Write-Host "Container $storageContainerName does not exist. Creating..."
+ New-AzStorageContainer -Context $azStorageContext -Name $storageContainerName | Out-Null
+ }
+
+ Write-Host "Delivering to $storageContainerName in $($storageAccountCredentials.StorageAccountName)"
+ $atypes.Split(',') | ForEach-Object {
+ $atype = $_
+ Write-Host "Looking for: $project-$refname-$atype-*.*.*.*"
+ $artfolder = @(Get-ChildItem -Path (Join-Path $artifactsFolder "$project-$refname-$atype-*.*.*.*") | Where-Object { $_.PSIsContainer })
+ if ($artFolder.Count -eq 0) {
+ if ($atype -eq "Apps") {
+ throw "Error - unable to locate apps"
}
else {
- $parameters.packageId = "$($ENV:GITHUB_REPOSITORY_OWNER)-$($settings.repoName)-$ProjectName"
+ Write-Host "WARNING: Unable to locate $atype"
}
}
- if ($type -eq 'CD') {
- $parameters.packageId += "-preview"
- }
- $parameters.packageVersion = [System.Version]$appsFolder[0].Name.SubString($appsFolder[0].Name.IndexOf("-Apps-")+6)
- if ($nuGetAccount.Keys -contains 'PackageTitle') {
- $parameters.packageTitle = $nuGetAccount.PackageTitle
- }
- else {
- $parameters.packageTitle = $parameters.packageId
- }
- if ($nuGetAccount.Keys -contains 'PackageDescription') {
- $parameters.packageDescription = $nuGetAccount.PackageDescription
+ elseif ($artFolder.Count -gt 1) {
+ $artFolder | Out-Host
+ throw "Internal error - multiple $atype folders located"
}
else {
- $parameters.packageDescription = $parameters.packageTitle
- }
- if ($nuGetAccount.Keys -contains 'PackageAuthors') {
- $parameters.packageAuthors = $nuGetAccount.PackageAuthors
+ $artfolder = $artfolder[0].FullName
+ $version = $artfolder.SubString($artfolder.IndexOf("-$refname-$atype-") + "-$refname-$atype-".Length)
+ Write-Host $artfolder
+ $versions = @("$version-preview", "preview")
+ if ($type -eq "Release") {
+ $versions += @($version, "latest")
+ }
+ $tempFile = Join-Path ([System.IO.Path]::GetTempPath()) "$([Guid]::newguid().ToString()).zip"
+ try {
+ Write-Host "Compressing"
+ Compress-Archive -Path (Join-Path $artfolder '*') -DestinationPath $tempFile -Force
+ $versions | ForEach-Object {
+ $version = $_
+ $blob = $storageBlobName.replace('{project}', $projectName).replace('{branch}', $refname).replace('{version}', $version).replace('{type}', $atype).ToLowerInvariant()
+ Write-Host "Delivering $blob"
+ Set-AzStorageBlobContent -Context $azStorageContext -Container $storageContainerName -File $tempFile -blob $blob -Force | Out-Null
+ }
+ }
+ finally {
+ Remove-Item $tempFile -Force -ErrorAction SilentlyContinue
+ }
}
- else {
- $parameters.packageAuthors = $actor
+ }
+ }
+ elseif ($deliveryTarget -eq "AppSource") {
+ $projectSettings = ReadSettings -baseFolder $baseFolder -project $thisProject
+ $projectSettings = AnalyzeRepo -settings $projectSettings -baseFolder $baseFolder -project $thisProject -doNotCheckArtifactSetting -doNotIssueWarnings
+ # Use old settings and issue warnings
+ 'continuousDelivery', 'mainAppFolder', 'productId' | ForEach-Object {
+ if ($projectSettings.Keys -contains "AppSource$_") {
+ OutputWarning "Using AppSource$_ in $thisProject/.AL-Go/settings.json is deprecated. Use deliverToAppSource.$_ instead. If both values are defined, the value in AppSource$_ is used (even if it is deprecated)."
+ $projectSettings.deliverToAppSource."$_" = $projectSettings."AppSource$_"
}
- $package = New-BcNuGetPackage @parameters
- Push-BcNuGetPackage -nuGetServerUrl $nuGetServerUrl -nuGetToken $nuGetToken -bcNuGetPackage $package
}
- elseif ($deliveryTarget -eq "Storage") {
+ # if type is Release, we only get here with the projects that needs to be delivered to AppSource
+ # if type is CD, we get here for all projects, but should only deliver to AppSource if AppSourceContinuousDelivery is set to true
+ if ($type -eq 'Release' -or $projectSettings.deliverToAppSource.continuousDelivery) {
+ # AppSource submission requires the Az.Storage module
InstallAzModuleIfNeeded -name 'Az.Storage'
- try {
- $storageAccountCredentials = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($secrets.storageContext)) | ConvertFrom-Json
- $storageAccountCredentials.StorageAccountName | Out-Null
- $storageContainerName = $storageAccountCredentials.ContainerName.ToLowerInvariant().replace('{project}',$projectName).replace('{branch}',$refname).ToLowerInvariant()
- $storageBlobName = $storageAccountCredentials.BlobName.ToLowerInvariant()
+ $appSourceContext = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($secrets.appSourceContext)) | ConvertFrom-Json | ConvertTo-HashTable
+ if (!$appSourceContext) {
+ throw "appSourceContext secret is missing"
}
- catch {
- throw "StorageContext secret is malformed. Needs to be formatted as Json, containing StorageAccountName, containerName, blobName.`nError was: $($_.Exception.Message)"
- }
- $azStorageContext = ConnectAzStorageAccount -storageAccountCredentials $storageAccountCredentials
- Write-Host "Storage Container Name is $storageContainerName"
- Write-Host "Storage Blob Name is $storageBlobName"
+ $authContext = New-BcAuthContext @appSourceContext
- $containerExists = $true
- try {
- Get-AzStorageContainer -Context $azStorageContext -name $storageContainerName | Out-Null
- }
- catch {
- $containerExists = $false
+ if ($projectSettings.deliverToAppSource.MainAppFolder) {
+ $AppSourceMainAppFolder = $projectSettings.deliverToAppSource.MainAppFolder
}
-
- if (-not $containerExists -and $settings.Contains('DeliverToStorage') -and $settings."DeliverToStorage".Contains('CreateContainerIfNotExist') -and $settings."DeliverToStorage"."CreateContainerIfNotExist" -eq $true) {
- Write-Host "Container $storageContainerName does not exist. Creating..."
- New-AzStorageContainer -Context $azStorageContext -Name $storageContainerName | Out-Null
- }
-
- Write-Host "Delivering to $storageContainerName in $($storageAccountCredentials.StorageAccountName)"
- $atypes.Split(',') | ForEach-Object {
- $atype = $_
- Write-Host "Looking for: $project-$refname-$atype-*.*.*.*"
- $artfolder = @(Get-ChildItem -Path (Join-Path $artifactsFolder "$project-$refname-$atype-*.*.*.*") | Where-Object { $_.PSIsContainer })
- if ($artFolder.Count -eq 0) {
- if ($atype -eq "Apps") {
- throw "Error - unable to locate apps"
- }
- else {
- Write-Host "WARNING: Unable to locate $atype"
- }
- }
- elseif ($artFolder.Count -gt 1) {
- $artFolder | Out-Host
- throw "Internal error - multiple $atype folders located"
+ else {
+ try {
+ $AppSourceMainAppFolder = $projectSettings.appFolders[0]
}
- else {
- $artfolder = $artfolder[0].FullName
- $version = $artfolder.SubString($artfolder.IndexOf("-$refname-$atype-")+"-$refname-$atype-".Length)
- Write-Host $artfolder
- $versions = @("$version-preview","preview")
- if ($type -eq "Release") {
- $versions += @($version,"latest")
- }
- $tempFile = Join-Path ([System.IO.Path]::GetTempPath()) "$([Guid]::newguid().ToString()).zip"
- try {
- Write-Host "Compressing"
- Compress-Archive -Path (Join-Path $artfolder '*') -DestinationPath $tempFile -Force
- $versions | ForEach-Object {
- $version = $_
- $blob = $storageBlobName.replace('{project}',$projectName).replace('{branch}',$refname).replace('{version}',$version).replace('{type}',$atype).ToLowerInvariant()
- Write-Host "Delivering $blob"
- Set-AzStorageBlobContent -Context $azStorageContext -Container $storageContainerName -File $tempFile -blob $blob -Force | Out-Null
- }
- }
- finally {
- Remove-Item $tempFile -Force -ErrorAction SilentlyContinue
- }
+ catch {
+ throw "Unable to determine main App folder"
}
}
- }
- elseif ($deliveryTarget -eq "AppSource") {
- $projectSettings = ReadSettings -baseFolder $baseFolder -project $thisProject
- $projectSettings = AnalyzeRepo -settings $projectSettings -baseFolder $baseFolder -project $thisProject -doNotCheckArtifactSetting -doNotIssueWarnings
- # Use old settings and issue warnings
- 'continuousDelivery','mainAppFolder','productId' | ForEach-Object {
- if ($projectSettings.Keys -contains "AppSource$_") {
- OutputWarning "Using AppSource$_ in $thisProject/.AL-Go/settings.json is deprecated. Use deliverToAppSource.$_ instead. If both values are defined, the value in AppSource$_ is used (even if it is deprecated)."
- $projectSettings.deliverToAppSource."$_" = $projectSettings."AppSource$_"
- }
+ if (!$projectSettings.deliverToAppSource.ProductId) {
+ throw "deliverToAppSource.ProductId needs to be specified in $thisProject/.AL-Go/settings.json in order to deliver to AppSource"
}
- # if type is Release, we only get here with the projects that needs to be delivered to AppSource
- # if type is CD, we get here for all projects, but should only deliver to AppSource if AppSourceContinuousDelivery is set to true
- if ($type -eq 'Release' -or $projectSettings.deliverToAppSource.continuousDelivery) {
- # AppSource submission requires the Az.Storage module
- InstallAzModuleIfNeeded -name 'Az.Storage'
- $appSourceContext = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($secrets.appSourceContext)) | ConvertFrom-Json | ConvertTo-HashTable
- if (!$appSourceContext) {
- throw "appSourceContext secret is missing"
- }
- $authContext = New-BcAuthContext @appSourceContext
+ Write-Host "AppSource MainAppFolder $AppSourceMainAppFolder"
- if ($projectSettings.deliverToAppSource.MainAppFolder) {
- $AppSourceMainAppFolder = $projectSettings.deliverToAppSource.MainAppFolder
- }
- else {
- try {
- $AppSourceMainAppFolder = $projectSettings.appFolders[0]
- }
- catch {
- throw "Unable to determine main App folder"
- }
- }
- if (!$projectSettings.deliverToAppSource.ProductId) {
- throw "deliverToAppSource.ProductId needs to be specified in $thisProject/.AL-Go/settings.json in order to deliver to AppSource"
- }
- Write-Host "AppSource MainAppFolder $AppSourceMainAppFolder"
+ $mainAppJson = Get-Content -Path (Join-Path $baseFolder "$thisProject/$AppSourceMainAppFolder/app.json") -Encoding UTF8 | ConvertFrom-Json
+ $mainAppFileName = ("$($mainAppJson.Publisher)_$($mainAppJson.Name)_".Split([System.IO.Path]::GetInvalidFileNameChars()) -join '') + "*.*.*.*.app"
+ $artfolder = @(Get-ChildItem -Path (Join-Path $artifactsFolder "$project-$refname-Apps-*.*.*.*") | Where-Object { $_.PSIsContainer })
+ if ($artFolder.Count -eq 0) {
+ throw "Internal error - unable to locate apps folder"
+ }
+ if ($artFolder.Count -gt 1) {
+ $artFolder | Out-Host
+ throw "Internal error - multiple apps folders located"
+ }
+ $artfolder = $artfolder[0].FullName
+ $appFile = Get-ChildItem -path $artFolder | Where-Object { $_.name -like $mainAppFileName } | ForEach-Object { $_.FullName }
+ $libraryAppFiles = @(Get-ChildItem -path $artFolder | Where-Object { $_.name -notlike $mainAppFileName } | ForEach-Object { $_.FullName })
- $mainAppJson = Get-Content -Path (Join-Path $baseFolder "$thisProject/$AppSourceMainAppFolder/app.json") -Encoding UTF8 | ConvertFrom-Json
- $mainAppFileName = ("$($mainAppJson.Publisher)_$($mainAppJson.Name)_".Split([System.IO.Path]::GetInvalidFileNameChars()) -join '') + "*.*.*.*.app"
- $artfolder = @(Get-ChildItem -Path (Join-Path $artifactsFolder "$project-$refname-Apps-*.*.*.*") | Where-Object { $_.PSIsContainer })
- if ($artFolder.Count -eq 0) {
- throw "Internal error - unable to locate apps folder"
+ $appSourceIncludeDependencies = $projectSettings.deliverToAppSource.includeDependencies
+ if ($appSourceIncludeDependencies -and $appSourceIncludeDependencies.count -gt 0) {
+ $depfolder = @(Get-ChildItem -Path (Join-Path $artifactsFolder "$project-$refname-Dependencies-*.*.*.*") | Where-Object { $_.PSIsContainer })
+ if ($depFolder.Count -eq 0) {
+ throw "Unable to locate dependencies. You need to set generateDependencyArtifact to true in $thisProject/.AL-Go/settings.json in order to deliver dependencies to AppSource"
}
- if ($artFolder.Count -gt 1) {
- $artFolder | Out-Host
- throw "Internal error - multiple apps folders located"
+ if ($depFolder.Count -gt 1) {
+ $depFolder | Out-Host
+ throw "Internal error - multiple dependencies folders located"
}
- $artfolder = $artfolder[0].FullName
- $appFile = Get-ChildItem -path $artFolder | Where-Object { $_.name -like $mainAppFileName } | ForEach-Object { $_.FullName }
- $libraryAppFiles = @(Get-ChildItem -path $artFolder | Where-Object { $_.name -notlike $mainAppFileName } | ForEach-Object { $_.FullName })
-
- $appSourceIncludeDependencies = $projectSettings.deliverToAppSource.includeDependencies
- if ($appSourceIncludeDependencies -and $appSourceIncludeDependencies.count -gt 0) {
- $depfolder = @(Get-ChildItem -Path (Join-Path $artifactsFolder "$project-$refname-Dependencies-*.*.*.*") | Where-Object { $_.PSIsContainer })
- if ($depFolder.Count -eq 0) {
- throw "Unable to locate dependencies. You need to set generateDependencyArtifact to true in $thisProject/.AL-Go/settings.json in order to deliver dependencies to AppSource"
- }
- if ($depFolder.Count -gt 1) {
- $depFolder | Out-Host
- throw "Internal error - multiple dependencies folders located"
- }
- $depfolder = $depfolder[0].FullName
- $libraryAppFiles += @(Get-ChildItem -path $depFolder | Where-Object {
+ $depfolder = $depfolder[0].FullName
+ $libraryAppFiles += @(Get-ChildItem -path $depFolder | Where-Object {
$name = $_.name
$appSourceIncludeDependencies | Where-Object { $name -like $_ }
} | ForEach-Object { $_.FullName })
- }
+ }
- Write-Host "Main App File:"
- Write-Host "- $([System.IO.Path]::GetFileName($appFile))"
- Write-Host "Library App Files:"
- if ($libraryAppFiles.Count -eq 0) {
- Write-Host "- None"
- }
- else {
- $libraryAppFiles | ForEach-Object { Write-Host "- $([System.IO.Path]::GetFileName($_))" }
- }
- if (-not $appFile) {
- throw "Unable to locate main app file ($mainAppFileName doesn't exist)"
- }
- Write-Host "Submitting to AppSource"
- $status = New-AppSourceSubmission -authContext $authContext -productId $projectSettings.deliverToAppSource.productId -appFile $appFile -libraryAppFiles $libraryAppFiles -doNotWait -autoPromote:$goLive -Force
- if ($goLive) {
- if ($status.state -ne 'Published' -or ($status.substate -ne 'ReadyToPublish' -and $status.substate -ne 'InStore')) {
- throw "AppSource submission failed. Status is $($status.state)/$($status.substate)"
- }
+ Write-Host "Main App File:"
+ Write-Host "- $([System.IO.Path]::GetFileName($appFile))"
+ Write-Host "Library App Files:"
+ if ($libraryAppFiles.Count -eq 0) {
+ Write-Host "- None"
+ }
+ else {
+ $libraryAppFiles | ForEach-Object { Write-Host "- $([System.IO.Path]::GetFileName($_))" }
+ }
+ if (-not $appFile) {
+ throw "Unable to locate main app file ($mainAppFileName doesn't exist)"
+ }
+ Write-Host "Submitting to AppSource"
+ $status = New-AppSourceSubmission -authContext $authContext -productId $projectSettings.deliverToAppSource.productId -appFile $appFile -libraryAppFiles $libraryAppFiles -doNotWait -autoPromote:$goLive -Force
+ if ($goLive) {
+ if ($status.state -ne 'Published' -or ($status.substate -ne 'ReadyToPublish' -and $status.substate -ne 'InStore')) {
+ throw "AppSource submission failed. Status is $($status.state)/$($status.substate)"
}
}
}
- else {
- throw "Internal error, no handler for $deliveryTarget"
- }
-
- if ($artifactsFolderCreated) {
- Remove-Item $artifactsFolder -Recurse -Force
- }
+ }
+ else {
+ throw "Internal error, no handler for $deliveryTarget"
}
- TrackTrace -telemetryScope $telemetryScope
-}
-catch {
- if (Get-Module BcContainerHelper) {
- TrackException -telemetryScope $telemetryScope -errorRecord $_
+ if ($artifactsFolderCreated) {
+ Remove-Item $artifactsFolder -Recurse -Force
}
- throw
}
diff --git a/Actions/Deliver/README.md b/Actions/Deliver/README.md
index aa9726e38..8f9881662 100644
--- a/Actions/Deliver/README.md
+++ b/Actions/Deliver/README.md
@@ -18,7 +18,6 @@ Deliver App to deliveryTarget (AppSource, Storage, or...)
| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell |
| actor | | The GitHub actor running the action | github.actor |
| token | | The GitHub token running the action | github.token |
-| parentTelemetryScopeJson | | Specifies the parent telemetry scope for the telemetry signal | {} |
| projects | | Comma-separated list of projects to deliver | * |
| deliveryTarget | Yes | Delivery target (AppSource, Storage, GitHubPackages,...) | |
| artifacts | Yes | The artifacts to deliver or a folder in which the artifacts have been downloaded | |
diff --git a/Actions/Deliver/action.yaml b/Actions/Deliver/action.yaml
index 9f33256e3..ee340afc5 100644
--- a/Actions/Deliver/action.yaml
+++ b/Actions/Deliver/action.yaml
@@ -13,10 +13,6 @@ inputs:
description: The GitHub token running the action
required: false
default: ${{ github.token }}
- parentTelemetryScopeJson:
- description: Specifies the parent telemetry scope for the telemetry signal
- required: false
- default: '7b7d'
projects:
description: Projects to deliver (default is all)
required: false
@@ -47,7 +43,6 @@ runs:
env:
_actor: ${{ inputs.actor }}
_token: ${{ inputs.token }}
- _parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }}
_projects: ${{ inputs.projects }}
_deliveryTarget: ${{ inputs.deliveryTarget }}
_artifacts: ${{ inputs.artifacts }}
@@ -55,13 +50,8 @@ runs:
_atypes: ${{ inputs.atypes }}
_goLive: ${{ inputs.goLive }}
run: |
- $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
- try {
- ${{ github.action_path }}/Deliver.ps1 -actor $ENV:_actor -token $ENV:_token -parentTelemetryScopeJson $ENV:_parentTelemetryScopeJson -projects $ENV:_projects -deliveryTarget $ENV:_deliveryTarget -artifacts $ENV:_artifacts -type $ENV:_type -atypes $ENV:_atypes -goLive ($ENV:_goLive -eq 'true')
- }
- catch {
- Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
- exit 1
+ ${{ github.action_path }}/../Invoke-AlGoAction.ps1 -ActionName "Deliver" -Action {
+ ${{ github.action_path }}/Deliver.ps1 -actor $ENV:_actor -token $ENV:_token -projects $ENV:_projects -deliveryTarget $ENV:_deliveryTarget -artifacts $ENV:_artifacts -type $ENV:_type -atypes $ENV:_atypes -goLive ($ENV:_goLive -eq 'true')
}
branding:
icon: terminal
diff --git a/Actions/Deploy/action.yaml b/Actions/Deploy/action.yaml
index f6243d9dc..c0d591eca 100644
--- a/Actions/Deploy/action.yaml
+++ b/Actions/Deploy/action.yaml
@@ -34,14 +34,9 @@ runs:
_type: ${{ inputs.type }}
_deploymentEnvironmentsJson: ${{ inputs.deploymentEnvironmentsJson }}
run: |
- $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
- try {
+ ${{ github.action_path }}/../Invoke-AlGoAction.ps1 -ActionName "Deploy" -Action {
${{ github.action_path }}/Deploy.ps1 -environmentName $ENV:_environmentName -artifactsFolder $ENV:_artifactsFolder -type $ENV:_type -deploymentEnvironmentsJson $ENV:_deploymentEnvironmentsJson
}
- catch {
- Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
- exit 1
- }
branding:
icon: terminal
color: blue
diff --git a/Actions/DeployPowerPlatform/action.yaml b/Actions/DeployPowerPlatform/action.yaml
index 88d0481b1..f04042156 100644
--- a/Actions/DeployPowerPlatform/action.yaml
+++ b/Actions/DeployPowerPlatform/action.yaml
@@ -31,14 +31,9 @@ runs:
actionsRepo: ${{ github.action_repository }}
actionsRef: ${{ github.action_ref }}
run: |
- $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
- try {
+ ${{ github.action_path }}/../Invoke-AlGoAction.ps1 -ActionName "SetActionsRepoAndRef" -SkipTelemetry -Action {
${{ github.action_path }}/../SetActionsRepoAndRef.ps1 -actionsRepo $ENV:actionsRepo -actionsRef $ENV:actionsRef
}
- catch {
- Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
- exit 1
- }
- name: Check out AL-Go Actions
uses: actions/checkout@v4
@@ -61,14 +56,9 @@ runs:
_artifactsFolder: ${{ inputs.artifactsFolder }}
_solutionFolder: ${{ inputs.solutionFolder }}
run: |
- $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
- try {
+ ${{ github.action_path }}/../Invoke-AlGoAction.ps1 -ActionName "DeterminePowerPlatformSolutionFolder" -Action {
${{ github.action_path }}/DeterminePowerPlatformSolutionFolder.ps1 -artifactsFolder $ENV:_artifactsFolder -solutionFolder $ENV:_solutionFolder
}
- catch {
- Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
- exit 1
- }
- name: Unpack solution artifact
if: env.powerPlatformSolutionFilePath != ''
diff --git a/Actions/DetermineArtifactUrl/DetermineArtifactUrl.ps1 b/Actions/DetermineArtifactUrl/DetermineArtifactUrl.ps1
index 87ee569d3..1888cdbc1 100644
--- a/Actions/DetermineArtifactUrl/DetermineArtifactUrl.ps1
+++ b/Actions/DetermineArtifactUrl/DetermineArtifactUrl.ps1
@@ -1,44 +1,27 @@
Param(
- [Parameter(HelpMessage = "Specifies the parent telemetry scope for the telemetry signal", Mandatory = $false)]
- [string] $parentTelemetryScopeJson = '7b7d',
[Parameter(HelpMessage = "Project folder", Mandatory = $false)]
[string] $project = "."
)
-$telemetryScope = $null
+#region Action: Setup
+. (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve)
+DownloadAndImportBcContainerHelper
+#endregion
-try {
- #region Action: Setup
- . (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve)
- DownloadAndImportBcContainerHelper
- Import-Module (Join-Path -Path $PSScriptRoot -ChildPath "..\TelemetryHelper.psm1" -Resolve) -DisableNameChecking
- #endregion
-
- #region Action: Determine artifacts to use
- $telemetryScope = CreateScope -eventId 'DO0084' -parentTelemetryScopeJson $parentTelemetryScopeJson
-
- $settings = $env:Settings | ConvertFrom-Json | ConvertTo-HashTable
- $settings = AnalyzeRepo -settings $settings -project $project -doNotCheckArtifactSetting -doNotIssueWarnings
- $artifactUrl = DetermineArtifactUrl -projectSettings $settings
- $artifactCacheKey = ''
- if ($settings.useCompilerFolder) {
- $artifactCacheKey = $artifactUrl.Split('?')[0]
- }
- #endregion
-
- #region Action: Output
- # Set output variables
- Add-Content -Encoding UTF8 -Path $env:GITHUB_ENV -Value "artifact=$artifactUrl"
- Write-Host "artifact=$artifactUrl"
- Add-Content -Encoding UTF8 -Path $env:GITHUB_ENV -Value "artifactCacheKey=$artifactCacheKey"
- Write-Host "artifactCacheKey=$artifactCacheKey"
- #endregion
-
- TrackTrace -telemetryScope $telemetryScope
-}
-catch {
- if (Get-Module BcContainerHelper) {
- TrackException -telemetryScope $telemetryScope -errorRecord $_
- }
- throw
+#region Action: Determine artifacts to use
+$settings = $env:Settings | ConvertFrom-Json | ConvertTo-HashTable
+$settings = AnalyzeRepo -settings $settings -project $project -doNotCheckArtifactSetting -doNotIssueWarnings
+$artifactUrl = DetermineArtifactUrl -projectSettings $settings
+$artifactCacheKey = ''
+if ($settings.useCompilerFolder) {
+ $artifactCacheKey = $artifactUrl.Split('?')[0]
}
+#endregion
+
+#region Action: Output
+# Set output variables
+Add-Content -Encoding UTF8 -Path $env:GITHUB_ENV -Value "artifact=$artifactUrl"
+Write-Host "artifact=$artifactUrl"
+Add-Content -Encoding UTF8 -Path $env:GITHUB_ENV -Value "artifactCacheKey=$artifactCacheKey"
+Write-Host "artifactCacheKey=$artifactCacheKey"
+#endregion
diff --git a/Actions/DetermineArtifactUrl/README.md b/Actions/DetermineArtifactUrl/README.md
index 21f7d77c9..955d1a7d7 100644
--- a/Actions/DetermineArtifactUrl/README.md
+++ b/Actions/DetermineArtifactUrl/README.md
@@ -15,7 +15,6 @@ Determines the artifactUrl to use for a given project
| Name | Required | Description | Default value |
| :-- | :-: | :-- | :-- |
| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell |
-| parentTelemetryScopeJson | | Specifies the parent telemetry scope for the telemetry signal | {} |
| project | | Project folder if repository is setup for multiple projects | . |
## OUTPUT
diff --git a/Actions/DetermineArtifactUrl/action.yaml b/Actions/DetermineArtifactUrl/action.yaml
index 936181bbe..b2151abc6 100644
--- a/Actions/DetermineArtifactUrl/action.yaml
+++ b/Actions/DetermineArtifactUrl/action.yaml
@@ -5,10 +5,6 @@ inputs:
description: Shell in which you want to run the action (powershell or pwsh)
required: false
default: powershell
- parentTelemetryScopeJson:
- description: Specifies the parent telemetry scope for the telemetry signal
- required: false
- default: '7b7d'
project:
description: Project folder
required: false
@@ -19,16 +15,10 @@ runs:
- name: run
shell: ${{ inputs.shell }}
env:
- _parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }}
_project: ${{ inputs.project }}
run: |
- $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
- try {
- ${{ github.action_path }}/DetermineArtifactUrl.ps1 -parentTelemetryScopeJson $env:_parentTelemetryScopeJson -project $ENV:_project
- }
- catch {
- Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
- exit 1
+ ${{ github.action_path }}/../Invoke-AlGoAction.ps1 -ActionName "DetermineArtifactUrl" -Action {
+ ${{ github.action_path }}/DetermineArtifactUrl.ps1 -project $ENV:_project
}
branding:
icon: terminal
diff --git a/Actions/DetermineDeliveryTargets/action.yaml b/Actions/DetermineDeliveryTargets/action.yaml
index af8d91867..6704dc70f 100644
--- a/Actions/DetermineDeliveryTargets/action.yaml
+++ b/Actions/DetermineDeliveryTargets/action.yaml
@@ -30,14 +30,9 @@ runs:
_projectsJson: ${{ inputs.projectsJson }}
_checkContextSecrets: ${{ inputs.checkContextSecrets }}
run: |
- $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
- try {
+ ${{ github.action_path }}/../Invoke-AlGoAction.ps1 -ActionName "DetermineDeliveryTargets" -Action {
${{ github.action_path }}/DetermineDeliveryTargets.ps1 -projectsJson $ENV:_projectsJson -checkContextSecrets ($ENV:_checkContextSecrets -eq 'true')
}
- catch {
- Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
- exit 1
- }
branding:
icon: terminal
color: blue
diff --git a/Actions/DetermineDeploymentEnvironments/action.yaml b/Actions/DetermineDeploymentEnvironments/action.yaml
index e4cef4203..d913710cb 100644
--- a/Actions/DetermineDeploymentEnvironments/action.yaml
+++ b/Actions/DetermineDeploymentEnvironments/action.yaml
@@ -40,14 +40,9 @@ runs:
_getEnvironments: ${{ inputs.getEnvironments }}
_type: ${{ inputs.type }}
run: |
- $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
- try {
+ ${{ github.action_path }}/../Invoke-AlGoAction.ps1 -ActionName "DetermineDeploymentEnvironments" -Action {
${{ github.action_path }}/DetermineDeploymentEnvironments.ps1 -getEnvironments $ENV:_getEnvironments -type $ENV:_type
}
- catch {
- Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
- exit 1
- }
branding:
icon: terminal
color: blue
diff --git a/Actions/DetermineProjectsToBuild/DetermineProjectsToBuild.Action.ps1 b/Actions/DetermineProjectsToBuild/DetermineProjectsToBuild.Action.ps1
index ca0a6135f..f320ccfd9 100644
--- a/Actions/DetermineProjectsToBuild/DetermineProjectsToBuild.Action.ps1
+++ b/Actions/DetermineProjectsToBuild/DetermineProjectsToBuild.Action.ps1
@@ -4,72 +4,54 @@
[Parameter(HelpMessage = "The maximum depth to build the dependency tree", Mandatory = $false)]
[int] $maxBuildDepth = 0,
[Parameter(HelpMessage = "The GitHub token to use to fetch the modified files", Mandatory = $true)]
- [string] $token,
- [Parameter(HelpMessage = "Specifies the parent telemetry scope for the telemetry signal", Mandatory = $false)]
- [string] $parentTelemetryScopeJson = '7b7d'
+ [string] $token
)
-$telemetryScope = $null
+#region Action: Setup
+. (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve)
-try {
- #region Action: Setup
- . (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve)
+DownloadAndImportBcContainerHelper -baseFolder $baseFolder
+Import-Module (Join-Path -Path $PSScriptRoot -ChildPath "DetermineProjectsToBuild.psm1" -Resolve) -DisableNameChecking
+#endregion
- DownloadAndImportBcContainerHelper -baseFolder $baseFolder
- Import-Module (Join-Path -Path $PSScriptRoot -ChildPath "..\TelemetryHelper.psm1" -Resolve) -DisableNameChecking
- Import-Module (Join-Path -Path $PSScriptRoot -ChildPath "DetermineProjectsToBuild.psm1" -Resolve) -DisableNameChecking
- #endregion
+#region Action: Determine projects to build
+Write-Host "::group::Get Modified Files"
+$modifiedFiles = @(Get-ModifiedFiles -token $token)
+Write-Host "$($modifiedFiles.Count) modified file(s): $($modifiedFiles -join ', ')"
+Write-Host "::endgroup::"
- $telemetryScope = CreateScope -eventId 'DO0085' -parentTelemetryScopeJson $parentTelemetryScopeJson
+Write-Host "::group::Determine Partial Build"
+$buildAllProjects = Get-BuildAllProjects -modifiedFiles $modifiedFiles -baseFolder $baseFolder
+Write-Host "::endgroup::"
- #region Action: Determine projects to build
- Write-Host "::group::Get Modified Files"
- $modifiedFiles = @(Get-ModifiedFiles -token $token)
- Write-Host "$($modifiedFiles.Count) modified file(s): $($modifiedFiles -join ', ')"
- Write-Host "::endgroup::"
-
- Write-Host "::group::Determine Partial Build"
- $buildAllProjects = Get-BuildAllProjects -modifiedFiles $modifiedFiles -baseFolder $baseFolder
- Write-Host "::endgroup::"
-
- Write-Host "::group::Determine Baseline Workflow ID"
- $baselineWorkflowRunId = 0 #default to 0, which means no baseline workflow run ID is set
- if(-not $buildAllProjects) {
- $baselineWorkflowRunId = FindLatestSuccessfulCICDRun -repository "$env:GITHUB_REPOSITORY" -branch "$env:GITHUB_BASE_REF" -token $token
- }
- Write-Host "::endgroup::"
-
- Write-Host "::group::Get Projects To Build"
- $allProjects, $projectsToBuild, $projectDependencies, $buildOrder = Get-ProjectsToBuild -baseFolder $baseFolder -buildAllProjects $buildAllProjects -modifiedFiles $modifiedFiles -maxBuildDepth $maxBuildDepth
- AddTelemetryProperty -telemetryScope $telemetryScope -key "projects" -value "$($allProjects -join ', ')"
- Write-Host "::endgroup::"
- #endregion
-
- #region Action: Output
- $projectsJson = ConvertTo-Json $projectsToBuild -Depth 99 -Compress
- $projectDependenciesJson = ConvertTo-Json $projectDependencies -Depth 99 -Compress
- $buildOrderJson = ConvertTo-Json $buildOrder -Depth 99 -Compress
-
- # Set output variables
- Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "ProjectsJson=$projectsJson"
- Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "ProjectDependenciesJson=$projectDependenciesJson"
- Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "BuildOrderJson=$buildOrderJson"
- Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "BuildAllProjects=$([int] $buildAllProjects)"
- Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "BaselineWorkflowRunId=$baselineWorkflowRunId"
-
-
- Write-Host "ProjectsJson=$projectsJson"
- Write-Host "ProjectDependenciesJson=$projectDependenciesJson"
- Write-Host "BuildOrderJson=$buildOrderJson"
- Write-Host "BuildAllProjects=$buildAllProjects"
- Write-Host "BaselineWorkflowRunId=$baselineWorkflowRunId"
- #endregion
-
- TrackTrace -telemetryScope $telemetryScope
-}
-catch {
- if (Get-Module BcContainerHelper) {
- TrackException -telemetryScope $telemetryScope -errorRecord $_
- }
- throw
+Write-Host "::group::Determine Baseline Workflow ID"
+$baselineWorkflowRunId = 0 #default to 0, which means no baseline workflow run ID is set
+if(-not $buildAllProjects) {
+ $baselineWorkflowRunId = FindLatestSuccessfulCICDRun -repository "$env:GITHUB_REPOSITORY" -branch "$env:GITHUB_BASE_REF" -token $token
}
+Write-Host "::endgroup::"
+
+Write-Host "::group::Get Projects To Build"
+$allProjects, $projectsToBuild, $projectDependencies, $buildOrder = Get-ProjectsToBuild -baseFolder $baseFolder -buildAllProjects $buildAllProjects -modifiedFiles $modifiedFiles -maxBuildDepth $maxBuildDepth
+Write-Host "::endgroup::"
+#endregion
+
+#region Action: Output
+$projectsJson = ConvertTo-Json $projectsToBuild -Depth 99 -Compress
+$projectDependenciesJson = ConvertTo-Json $projectDependencies -Depth 99 -Compress
+$buildOrderJson = ConvertTo-Json $buildOrder -Depth 99 -Compress
+
+# Set output variables
+Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "ProjectsJson=$projectsJson"
+Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "ProjectDependenciesJson=$projectDependenciesJson"
+Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "BuildOrderJson=$buildOrderJson"
+Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "BuildAllProjects=$([int] $buildAllProjects)"
+Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "BaselineWorkflowRunId=$baselineWorkflowRunId"
+
+
+Write-Host "ProjectsJson=$projectsJson"
+Write-Host "ProjectDependenciesJson=$projectDependenciesJson"
+Write-Host "BuildOrderJson=$buildOrderJson"
+Write-Host "BuildAllProjects=$buildAllProjects"
+Write-Host "BaselineWorkflowRunId=$baselineWorkflowRunId"
+#endregion
diff --git a/Actions/DetermineProjectsToBuild/README.md b/Actions/DetermineProjectsToBuild/README.md
index 8304dc16d..e391cd116 100644
--- a/Actions/DetermineProjectsToBuild/README.md
+++ b/Actions/DetermineProjectsToBuild/README.md
@@ -15,7 +15,6 @@ none
| Name | Required | Description | Default value |
| :-- | :-: | :-- | :-- |
| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell |
-| parentTelemetryScopeJson | | Specifies the parent telemetry scope for the telemetry signal | {} |
| maxBuildDepth | | Specifies the maximum build depth suppored by the workflow running the action | 0 |
## OUTPUT
diff --git a/Actions/DetermineProjectsToBuild/action.yaml b/Actions/DetermineProjectsToBuild/action.yaml
index be7e770f9..8f48f5d04 100644
--- a/Actions/DetermineProjectsToBuild/action.yaml
+++ b/Actions/DetermineProjectsToBuild/action.yaml
@@ -6,10 +6,6 @@ inputs:
description: Shell in which you want to run the action (powershell or pwsh)
required: false
default: powershell
- parentTelemetryScopeJson:
- description: Specifies the parent telemetry scope for the telemetry signal
- required: false
- default: '7b7d'
maxBuildDepth:
description: Specifies the maximum build depth suppored by the workflow running the action
required: false
@@ -37,16 +33,10 @@ runs:
shell: ${{ inputs.shell }}
id: determineProjectsToBuild
env:
- _parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }}
_maxBuildDepth: ${{ inputs.maxBuildDepth }}
run: |
- $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
- try {
- ${{ github.action_path }}/DetermineProjectsToBuild.Action.ps1 -baseFolder ${{ github.workspace }} -maxBuildDepth $env:_maxBuildDepth -parentTelemetryScopeJson $env:_parentTelemetryScopeJson -token ${{ github.token }}
- }
- catch {
- Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
- exit 1
+ ${{ github.action_path }}/../Invoke-AlGoAction.ps1 -ActionName "DetermineProjectsToBuild" -Action {
+ ${{ github.action_path }}/DetermineProjectsToBuild.Action.ps1 -baseFolder ${{ github.workspace }} -maxBuildDepth $env:_maxBuildDepth -token ${{ github.token }}
}
branding:
icon: terminal
diff --git a/Actions/DownloadProjectDependencies/action.yaml b/Actions/DownloadProjectDependencies/action.yaml
index d21fbcd01..51cf13901 100644
--- a/Actions/DownloadProjectDependencies/action.yaml
+++ b/Actions/DownloadProjectDependencies/action.yaml
@@ -46,14 +46,9 @@ runs:
_gitHubToken: ${{ github.token }}
_baselineWorkflowRunId: ${{ inputs.baselineWorkflowRunId }}
run: |
- $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
- try {
+ ${{ github.action_path }}/../Invoke-AlGoAction.ps1 -ActionName "DownloadProjectDependencies" -Action {
${{ github.action_path }}/DownloadProjectDependencies.Action.ps1 -project $ENV:_project -buildMode $ENV:_buildMode -projectsDependenciesJson $ENV:_projectsDependenciesJson -baselineWorkflowRunId $ENV:_baselineWorkflowRunId -baseFolder $ENV:_baseFolder -destinationPath $ENV:_destinationPath -token $ENV:_gitHubToken
}
- catch {
- Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))"
- exit 1
- }
branding:
icon: terminal
color: blue
diff --git a/Actions/DumpWorkflowInfo/action.yaml b/Actions/DumpWorkflowInfo/action.yaml
index 414cfcdba..4ffbd5828 100644
--- a/Actions/DumpWorkflowInfo/action.yaml
+++ b/Actions/DumpWorkflowInfo/action.yaml
@@ -11,14 +11,9 @@ runs:
- name: run
shell: ${{ inputs.shell }}
run: |
- $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
- try {
+ ${{ github.action_path }}/../Invoke-AlGoAction.ps1 -ActionName "DumpWorkflowInfo" -Action {
${{ github.action_path }}/DumpWorkflowInfo.ps1
}
- catch {
- Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
- exit 1
- }
branding:
icon: terminal
color: blue
diff --git a/Actions/GetArtifactsForDeployment/action.yaml b/Actions/GetArtifactsForDeployment/action.yaml
index 4230f728f..67e157812 100644
--- a/Actions/GetArtifactsForDeployment/action.yaml
+++ b/Actions/GetArtifactsForDeployment/action.yaml
@@ -25,14 +25,9 @@ runs:
_artifactsVersion: ${{ inputs.artifactsVersion }}
_artifactsFolder: ${{ inputs.artifactsFolder }}
run: |
- $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
- try {
+ ${{ github.action_path }}/../Invoke-AlGoAction.ps1 -ActionName "GetArtifactsForDeployment" -Action {
${{ github.action_path }}/GetArtifactsForDeployment.ps1 -token $ENV:_token -artifactsVersion $ENV:_artifactsVersion -artifactsFolder $ENV:_artifactsFolder
}
- catch {
- Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
- exit 1
- }
branding:
icon: terminal
color: blue
diff --git a/Actions/IncrementVersionNumber/IncrementVersionNumber.ps1 b/Actions/IncrementVersionNumber/IncrementVersionNumber.ps1
index bae14ff3c..63cb68dc1 100644
--- a/Actions/IncrementVersionNumber/IncrementVersionNumber.ps1
+++ b/Actions/IncrementVersionNumber/IncrementVersionNumber.ps1
@@ -3,8 +3,6 @@
[string] $actor,
[Parameter(HelpMessage = "The GitHub token running the action", Mandatory = $false)]
[string] $token,
- [Parameter(HelpMessage = "Specifies the parent telemetry scope for the telemetry signal", Mandatory = $false)]
- [string] $parentTelemetryScopeJson = '7b7d',
[Parameter(HelpMessage = "List of project names if the repository is setup for multiple projects (* for all projects)", Mandatory = $false)]
[string] $projects = '*',
[Parameter(HelpMessage = "The version to update to. Use Major.Minor for absolute change, use +1 to bump to the next major version, use +0.1 to bump to the next minor version", Mandatory = $true)]
@@ -15,112 +13,99 @@
[bool] $directCommit
)
-$telemetryScope = $null
+. (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve)
+Import-Module (Join-Path -path $PSScriptRoot -ChildPath "IncrementVersionNumber.psm1" -Resolve)
-try {
- . (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve)
- Import-Module (Join-Path -path $PSScriptRoot -ChildPath "IncrementVersionNumber.psm1" -Resolve)
+$serverUrl, $branch = CloneIntoNewFolder -actor $actor -token $token -updateBranch $updateBranch -DirectCommit $directCommit -newBranchPrefix 'increment-version-number'
+$baseFolder = (Get-Location).path
+DownloadAndImportBcContainerHelper -baseFolder $baseFolder
- $serverUrl, $branch = CloneIntoNewFolder -actor $actor -token $token -updateBranch $updateBranch -DirectCommit $directCommit -newBranchPrefix 'increment-version-number'
- $baseFolder = (Get-Location).path
- DownloadAndImportBcContainerHelper -baseFolder $baseFolder
-
- Import-Module (Join-Path -path $PSScriptRoot -ChildPath "..\TelemetryHelper.psm1" -Resolve)
- $telemetryScope = CreateScope -eventId 'DO0076' -parentTelemetryScopeJson $parentTelemetryScopeJson
-
- $settings = $env:Settings | ConvertFrom-Json
- if ($versionNumber.StartsWith('+')) {
- # Handle incremental version number
- $allowedIncrementalVersionNumbers = @('+1', '+0.1')
- if (-not $allowedIncrementalVersionNumbers.Contains($versionNumber)) {
- throw "Incremental version number $versionNumber is not allowed. Allowed incremental version numbers are: $($allowedIncrementalVersionNumbers -join ', ')"
- }
+$settings = $env:Settings | ConvertFrom-Json
+if ($versionNumber.StartsWith('+')) {
+ # Handle incremental version number
+ $allowedIncrementalVersionNumbers = @('+1', '+0.1')
+ if (-not $allowedIncrementalVersionNumbers.Contains($versionNumber)) {
+ throw "Incremental version number $versionNumber is not allowed. Allowed incremental version numbers are: $($allowedIncrementalVersionNumbers -join ', ')"
}
- else {
- # Handle absolute version number
- $versionNumberFormat = '^\d+\.\d+$' # Major.Minor
- if (-not ($versionNumber -match $versionNumberFormat)) {
- throw "Version number $versionNumber is not in the correct format. The version number must be in the format Major.Minor (e.g. 1.0 or 1.2)"
- }
- }
-
- # Collect all projects (AL and PowerPlatform Solution)
- $projectList = @(GetProjectsFromRepository -baseFolder $baseFolder -projectsFromSettings $settings.projects -selectProjects $projects)
- $PPprojects = @(GetMatchingProjects -projects @($settings.powerPlatformSolutionFolder) -selectProjects $projects)
- if ($projectList.Count -eq 0 -and $PPprojects.Count -eq 0) {
- throw "No projects matches '$projects'"
+}
+else {
+ # Handle absolute version number
+ $versionNumberFormat = '^\d+\.\d+$' # Major.Minor
+ if (-not ($versionNumber -match $versionNumberFormat)) {
+ throw "Version number $versionNumber is not in the correct format. The version number must be in the format Major.Minor (e.g. 1.0 or 1.2)"
}
+}
- $repositorySettingsPath = Join-Path $baseFolder $RepoSettingsFile # $RepoSettingsFile is defined in AL-Go-Helper.ps1
-
- # Increment version number in AL Projects
- if ($projectList.Count -gt 0) {
- $allAppFolders = @()
- $repoVersionExistsInRepoSettings = Test-SettingExists -settingsFilePath $repositorySettingsPath -settingName 'repoVersion'
- $repoVersionInRepoSettingsWasUpdated = $false
- foreach($project in $projectList) {
- $projectPath = Join-Path $baseFolder $project
- $projectSettingsPath = Join-Path $projectPath $ALGoSettingsFile # $ALGoSettingsFile is defined in AL-Go-Helper.ps1
-
- if (Test-SettingExists -settingsFilePath $projectSettingsPath -settingName 'repoVersion') {
- # If 'repoVersion' exists in the project settings, update it there
- Set-VersionInSettingsFile -settingsFilePath $projectSettingsPath -settingName 'repoVersion' -newValue $versionNumber
- } elseif ($repoVersionExistsInRepoSettings) {
- # If 'repoVersion' is not found in project settings but it exists in repo settings, update it there instead
- if (-not $repoVersionInRepoSettingsWasUpdated) {
- Write-Host "Setting 'repoVersion' not found in $projectSettingsPath. Updating it on repo level instead"
- Set-VersionInSettingsFile -settingsFilePath $repositorySettingsPath -settingName 'repoVersion' -newValue $versionNumber
- $repoVersionInRepoSettingsWasUpdated = $true
- }
- } else {
- # If 'repoVersion' is neither found in project settings nor in repo settings, force create it in project settings
- # Ensure the repoVersion setting exists in the project settings. Defaults to 1.0 if it doesn't exist.
- $settings = ReadSettings -baseFolder $baseFolder -project $project
- Set-VersionInSettingsFile -settingsFilePath $projectSettingsPath -settingName 'repoVersion' -newValue $settings.repoVersion -Force
- Set-VersionInSettingsFile -settingsFilePath $projectSettingsPath -settingName 'repoVersion' -newValue $versionNumber
- }
+# Collect all projects (AL and PowerPlatform Solution)
+$projectList = @(GetProjectsFromRepository -baseFolder $baseFolder -projectsFromSettings $settings.projects -selectProjects $projects)
+$PPprojects = @(GetMatchingProjects -projects @($settings.powerPlatformSolutionFolder) -selectProjects $projects)
+if ($projectList.Count -eq 0 -and $PPprojects.Count -eq 0) {
+ throw "No projects matches '$projects'"
+}
- # Resolve project folders to get all app folders that contain an app.json file
- $projectSettings = ReadSettings -baseFolder $baseFolder -project $project
- ResolveProjectFolders -baseFolder $baseFolder -project $project -projectSettings ([ref] $projectSettings)
+$repositorySettingsPath = Join-Path $baseFolder $RepoSettingsFile # $RepoSettingsFile is defined in AL-Go-Helper.ps1
- # Set version in app manifests (app.json files)
- Set-VersionInAppManifests -projectPath $projectPath -projectSettings $projectSettings -newValue $versionNumber
+# Increment version number in AL Projects
+if ($projectList.Count -gt 0) {
+ $allAppFolders = @()
+ $repoVersionExistsInRepoSettings = Test-SettingExists -settingsFilePath $repositorySettingsPath -settingName 'repoVersion'
+ $repoVersionInRepoSettingsWasUpdated = $false
+ foreach ($project in $projectList) {
+ $projectPath = Join-Path $baseFolder $project
+ $projectSettingsPath = Join-Path $projectPath $ALGoSettingsFile # $ALGoSettingsFile is defined in AL-Go-Helper.ps1
- # Collect all project's app folders
- $allAppFolders += $projectSettings.appFolders | ForEach-Object { Join-Path $projectPath $_ -Resolve }
- $allAppFolders += $projectSettings.testFolders | ForEach-Object { Join-Path $projectPath $_ -Resolve }
- $allAppFolders += $projectSettings.bcptTestFolders | ForEach-Object { Join-Path $projectPath $_ -Resolve }
+ if (Test-SettingExists -settingsFilePath $projectSettingsPath -settingName 'repoVersion') {
+ # If 'repoVersion' exists in the project settings, update it there
+ Set-VersionInSettingsFile -settingsFilePath $projectSettingsPath -settingName 'repoVersion' -newValue $versionNumber
}
-
- # Set dependencies in app manifests
- if($allAppFolders.Count -eq 0) {
- Write-Host "No App folders found for projects $projects"
+ elseif ($repoVersionExistsInRepoSettings) {
+ # If 'repoVersion' is not found in project settings but it exists in repo settings, update it there instead
+ if (-not $repoVersionInRepoSettingsWasUpdated) {
+ Write-Host "Setting 'repoVersion' not found in $projectSettingsPath. Updating it on repo level instead"
+ Set-VersionInSettingsFile -settingsFilePath $repositorySettingsPath -settingName 'repoVersion' -newValue $versionNumber
+ $repoVersionInRepoSettingsWasUpdated = $true
+ }
}
else {
- # Set dependencies in app manifests
- Set-DependenciesVersionInAppManifests -appFolders $allAppFolders
+ # If 'repoVersion' is neither found in project settings nor in repo settings, force create it in project settings
+ # Ensure the repoVersion setting exists in the project settings. Defaults to 1.0 if it doesn't exist.
+ $settings = ReadSettings -baseFolder $baseFolder -project $project
+ Set-VersionInSettingsFile -settingsFilePath $projectSettingsPath -settingName 'repoVersion' -newValue $settings.repoVersion -Force
+ Set-VersionInSettingsFile -settingsFilePath $projectSettingsPath -settingName 'repoVersion' -newValue $versionNumber
}
- }
- # Increment version number in PowerPlatform Solution
- foreach($PPproject in $PPprojects) {
- $projectPath = Join-Path $baseFolder $PPproject
- Set-PowerPlatformSolutionVersion -powerPlatformSolutionPath $projectPath -newValue $versionNumber
- }
+ # Resolve project folders to get all app folders that contain an app.json file
+ $projectSettings = ReadSettings -baseFolder $baseFolder -project $project
+ ResolveProjectFolders -baseFolder $baseFolder -project $project -projectSettings ([ref] $projectSettings)
- $commitMessage = "New Version number $versionNumber"
- if ($versionNumber.StartsWith('+')) {
- $commitMessage = "Incremented Version number by $versionNumber"
+ # Set version in app manifests (app.json files)
+ Set-VersionInAppManifests -projectPath $projectPath -projectSettings $projectSettings -newValue $versionNumber
+
+ # Collect all project's app folders
+ $allAppFolders += $projectSettings.appFolders | ForEach-Object { Join-Path $projectPath $_ -Resolve }
+ $allAppFolders += $projectSettings.testFolders | ForEach-Object { Join-Path $projectPath $_ -Resolve }
+ $allAppFolders += $projectSettings.bcptTestFolders | ForEach-Object { Join-Path $projectPath $_ -Resolve }
}
- CommitFromNewFolder -serverUrl $serverUrl -commitMessage $commitMessage -branch $branch | Out-Null
+ # Set dependencies in app manifests
+ if ($allAppFolders.Count -eq 0) {
+ Write-Host "No App folders found for projects $projects"
+ }
+ else {
+ # Set dependencies in app manifests
+ Set-DependenciesVersionInAppManifests -appFolders $allAppFolders
+ }
+}
- TrackTrace -telemetryScope $telemetryScope
+# Increment version number in PowerPlatform Solution
+foreach ($PPproject in $PPprojects) {
+ $projectPath = Join-Path $baseFolder $PPproject
+ Set-PowerPlatformSolutionVersion -powerPlatformSolutionPath $projectPath -newValue $versionNumber
}
-catch {
- if (Get-Module BcContainerHelper) {
- TrackException -telemetryScope $telemetryScope -errorRecord $_
- }
- throw
+
+$commitMessage = "New Version number $versionNumber"
+if ($versionNumber.StartsWith('+')) {
+ $commitMessage = "Incremented Version number by $versionNumber"
}
+
+CommitFromNewFolder -serverUrl $serverUrl -commitMessage $commitMessage -branch $branch | Out-Null
diff --git a/Actions/IncrementVersionNumber/README.md b/Actions/IncrementVersionNumber/README.md
index c5145fd3e..017ff2460 100644
--- a/Actions/IncrementVersionNumber/README.md
+++ b/Actions/IncrementVersionNumber/README.md
@@ -17,7 +17,6 @@ Increment version number in AL-Go repository
| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell |
| actor | | The GitHub actor running the action | github.actor |
| token | | The GitHub token running the action | github.token |
-| parentTelemetryScopeJson | | Specifies the parent telemetry scope for the telemetry signal | {} |
| projects | | List of project names if the repository is setup for multiple projects (\* for all projects) | * |
| versionNumber | Yes | The version to update to. Use Major.Minor for absolute change, use +1 to bump to the next major version, use +0.1 to bump to the next minor version | |
| updateBranch | | Which branch should the app be added to | github.ref_name |
diff --git a/Actions/IncrementVersionNumber/action.yaml b/Actions/IncrementVersionNumber/action.yaml
index 58866ff22..888dd12ff 100644
--- a/Actions/IncrementVersionNumber/action.yaml
+++ b/Actions/IncrementVersionNumber/action.yaml
@@ -16,10 +16,6 @@ inputs:
description: The GitHub token running the action
required: false
default: ${{ github.token }}
- parentTelemetryScopeJson:
- description: Specifies the parent telemetry scope for the telemetry signal
- required: false
- default: '7b7d'
projects:
description: List of project names if the repository is setup for multiple projects (* for all projects)
required: false
@@ -43,19 +39,13 @@ runs:
env:
_actor: ${{ inputs.actor }}
_token: ${{ inputs.token }}
- _parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }}
_projects: ${{ inputs.projects }}
_versionNumber: ${{ inputs.versionNumber }}
_updateBranch: ${{ inputs.updateBranch }}
_directCommit: ${{ inputs.directCommit }}
run: |
- $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
- try {
- ${{ github.action_path }}/IncrementVersionNumber.ps1 -actor $ENV:_actor -token $ENV:_token -parentTelemetryScopeJson $ENV:_parentTelemetryScopeJson -projects $ENV:_projects -versionNumber $ENV:_versionNumber -updateBranch $ENV:_updateBranch -directCommit ($ENV:_directCommit -eq 'true')
- }
- catch {
- Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
- exit 1
+ ${{ github.action_path }}/../Invoke-AlGoAction.ps1 -ActionName "IncrementVersionNumber" -Action {
+ ${{ github.action_path }}/IncrementVersionNumber.ps1 -actor $ENV:_actor -token $ENV:_token -projects $ENV:_projects -versionNumber $ENV:_versionNumber -updateBranch $ENV:_updateBranch -directCommit ($ENV:_directCommit -eq 'true')
}
branding:
icon: terminal
diff --git a/Actions/Invoke-AlGoAction.ps1 b/Actions/Invoke-AlGoAction.ps1
new file mode 100644
index 000000000..7cfd29c0a
--- /dev/null
+++ b/Actions/Invoke-AlGoAction.ps1
@@ -0,0 +1,30 @@
+param(
+ [Parameter(Mandatory = $true)]
+ [string] $ActionName,
+ [Parameter(Mandatory = $true)]
+ [scriptblock]$Action,
+ [Parameter(Mandatory = $false)]
+ [switch]$SkipTelemetry
+)
+
+$errorActionPreference = "Stop"
+$progressPreference = "SilentlyContinue"
+Set-StrictMode -Version 2.0
+
+Import-Module (Join-Path -Path $PSScriptRoot -ChildPath "TelemetryHelper.psm1" -Resolve)
+
+try {
+ Invoke-Command -ScriptBlock $Action
+
+ if (-not $SkipTelemetry) {
+ Trace-Information -ActionName $ActionName
+ }
+}
+catch {
+ if (-not $SkipTelemetry) {
+ Trace-Exception -ActionName $ActionName -ErrorRecord $_
+ }
+
+ Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
+ exit 1
+}
diff --git a/Actions/Packages.json b/Actions/Packages.json
index feb8783e3..3eeff0daf 100644
--- a/Actions/Packages.json
+++ b/Actions/Packages.json
@@ -1,5 +1,6 @@
{
"sign": "0.9.1-beta.24123.2",
+ "Microsoft.ApplicationInsights": "2.20.0",
"Az.Accounts": "2.15.1",
"Az.Storage": "6.1.1",
"Az.KeyVault": "5.2.0"
diff --git a/Actions/PipelineCleanup/PipelineCleanup.ps1 b/Actions/PipelineCleanup/PipelineCleanup.ps1
index a7a348fad..81209b175 100644
--- a/Actions/PipelineCleanup/PipelineCleanup.ps1
+++ b/Actions/PipelineCleanup/PipelineCleanup.ps1
@@ -1,29 +1,12 @@
Param(
[Parameter(HelpMessage = "Project folder", Mandatory = $false)]
- [string] $project = ".",
- [Parameter(HelpMessage = "Specifies the parent telemetry scope for the telemetry signal", Mandatory = $false)]
- [string] $parentTelemetryScopeJson = '7b7d'
+ [string] $project = "."
)
-$telemetryScope = $null
+. (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve)
+DownloadAndImportBcContainerHelper
-try {
- . (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve)
- DownloadAndImportBcContainerHelper
+if ($project -eq ".") { $project = "" }
- import-module (Join-Path -path $PSScriptRoot -ChildPath "..\TelemetryHelper.psm1" -Resolve)
- $telemetryScope = CreateScope -eventId 'DO0077' -parentTelemetryScopeJson $parentTelemetryScopeJson
-
- if ($project -eq ".") { $project = "" }
-
- $containerName = GetContainerName($project)
- Remove-Bccontainer $containerName
-
- TrackTrace -telemetryScope $telemetryScope
-}
-catch {
- if (Get-Module BcContainerHelper) {
- TrackException -telemetryScope $telemetryScope -errorRecord $_
- }
- throw
-}
+$containerName = GetContainerName($project)
+Remove-Bccontainer $containerName
diff --git a/Actions/PipelineCleanup/README.md b/Actions/PipelineCleanup/README.md
index 3aebd268f..b9e525f8b 100644
--- a/Actions/PipelineCleanup/README.md
+++ b/Actions/PipelineCleanup/README.md
@@ -13,7 +13,6 @@ none
| Name | Required | Description | Default value |
| :-- | :-: | :-- | :-- |
| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell |
-| parentTelemetryScopeJson | | Specifies the parent telemetry scope for the telemetry signal | {} |
| project | | Project name if the repository is setup for multiple projects | . |
## OUTPUT
diff --git a/Actions/PipelineCleanup/action.yaml b/Actions/PipelineCleanup/action.yaml
index fb085fd58..411d7bd7f 100644
--- a/Actions/PipelineCleanup/action.yaml
+++ b/Actions/PipelineCleanup/action.yaml
@@ -9,10 +9,6 @@ inputs:
description: Project folder
required: false
default: '.'
- parentTelemetryScopeJson:
- description: Specifies the parent telemetry scope for the telemetry signal
- required: false
- default: '7b7d'
runs:
using: composite
steps:
@@ -20,15 +16,9 @@ runs:
shell: ${{ inputs.shell }}
env:
_project: ${{ inputs.project }}
- _parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }}
run: |
- $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
- try {
- ${{ github.action_path }}/PipelineCleanup.ps1 -project $ENV:_project -parentTelemetryScopeJson $ENV:_parentTelemetryScopeJson
- }
- catch {
- Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
- exit 1
+ ${{ github.action_path }}/../Invoke-AlGoAction.ps1 -ActionName "PipelineCleanup" -Action {
+ ${{ github.action_path }}/PipelineCleanup.ps1 -project $ENV:_project
}
branding:
icon: terminal
diff --git a/Actions/PullPowerPlatformChanges/action.yaml b/Actions/PullPowerPlatformChanges/action.yaml
index 5d928e109..dc8118d99 100644
--- a/Actions/PullPowerPlatformChanges/action.yaml
+++ b/Actions/PullPowerPlatformChanges/action.yaml
@@ -43,14 +43,9 @@ runs:
actionsRepo: ${{ github.action_repository }}
actionsRef: ${{ github.action_ref }}
run: |
- $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
- try {
+ ${{ github.action_path }}/../Invoke-AlGoAction.ps1 -ActionName "SetActionsRepoAndRef" -SkipTelemetry -Action {
${{ github.action_path }}/../SetActionsRepoAndRef.ps1 -actionsRepo $ENV:actionsRepo -actionsRef $ENV:actionsRef
}
- catch {
- Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
- exit 1
- }
- name: Check out AL-Go Actions
uses: actions/checkout@v4
@@ -75,14 +70,9 @@ runs:
_updateBranch: ${{ inputs.updateBranch }}
_directCommit: ${{ inputs.directCommit }}
run: |
- $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
- try {
+ ${{ github.action_path }}/../Invoke-AlGoAction.ps1 -ActionName "GitCloneReponsitory" -Action {
${{ github.action_path }}/GitCloneReponsitory.ps1 -actor $ENV:_actor -token $ENV:_token -updateBranch $ENV:_updateBranch -directCommit ($ENV:_directCommit -eq 'true')
}
- catch {
- Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
- exit 1
- }
- name: Export Solution (username)
if: steps.ReadPowerPlatformSettings.outputs.ppUserName != ''
@@ -128,14 +118,9 @@ runs:
_solutionFolder: ${{ inputs.solutionFolder }}
_environmentName: ${{ inputs.environmentName }}
run: |
- $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
- try {
+ ${{ github.action_path }}/../Invoke-AlGoAction.ps1 -ActionName "GitCommitChanges" -Action {
${{ github.action_path }}/GitCommitChanges.ps1 -Actor $ENV:_actor -Token $ENV:_token -PowerPlatformSolutionName $ENV:_solutionFolder -EnvironmentName $ENV:_environmentName -Location $ENV:clonedRepoPath -ServerUrl $ENV:serverUrl -GitHubBranch $ENV:gitHubBranch
}
- catch {
- Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
- exit 1
- }
branding:
icon: terminal
diff --git a/Actions/PullRequestStatusCheck/PullRequestStatusCheck.ps1 b/Actions/PullRequestStatusCheck/PullRequestStatusCheck.ps1
index 0ddeadab4..0225aae7c 100644
--- a/Actions/PullRequestStatusCheck/PullRequestStatusCheck.ps1
+++ b/Actions/PullRequestStatusCheck/PullRequestStatusCheck.ps1
@@ -8,7 +8,7 @@
)
Write-Host "Checking PR Build status for run $RunId in repository $Repository"
- $workflowJobs = gh api /repos/$Repository/actions/runs/$RunId/jobs -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" | ConvertFrom-Json
+ $workflowJobs = gh api /repos/$Repository/actions/runs/$RunId/jobs --paginate -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" | ConvertFrom-Json
$failedJobs = $workflowJobs.jobs | Where-Object { $_.conclusion -eq "failure" }
if ($failedJobs) {
diff --git a/Actions/PullRequestStatusCheck/action.yaml b/Actions/PullRequestStatusCheck/action.yaml
index e579d73c3..859b0b364 100644
--- a/Actions/PullRequestStatusCheck/action.yaml
+++ b/Actions/PullRequestStatusCheck/action.yaml
@@ -11,14 +11,9 @@ runs:
- name: run
shell: ${{ inputs.shell }}
run: |
- $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
- try {
+ ${{ github.action_path }}/../Invoke-AlGoAction.ps1 -ActionName "PullRequestStatusCheck" -Action {
${{ github.action_path }}/PullRequestStatusCheck.ps1
}
- catch {
- Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
- exit 1
- }
branding:
icon: terminal
color: blue
diff --git a/Actions/ReadPowerPlatformSettings/action.yaml b/Actions/ReadPowerPlatformSettings/action.yaml
index 5b5b0a537..bbfabe923 100644
--- a/Actions/ReadPowerPlatformSettings/action.yaml
+++ b/Actions/ReadPowerPlatformSettings/action.yaml
@@ -46,14 +46,9 @@ runs:
_deploymentEnvironmentsJson: ${{ inputs.deploymentEnvironmentsJson }}
_environmentName: ${{ inputs.environmentName }}
run: |
- $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
- try {
+ ${{ github.action_path }}/../Invoke-AlGoAction.ps1 -ActionName "ReadPowerPlatformSettings" -Action {
${{ github.action_path }}/ReadPowerPlatformSettings.ps1 -deploymentEnvironmentsJson $ENV:_deploymentEnvironmentsJson -environmentName $ENV:_environmentName
}
- catch {
- Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
- exit 1
- }
branding:
icon: terminal
color: blue
diff --git a/Actions/ReadSecrets/action.yaml b/Actions/ReadSecrets/action.yaml
index a4343b2ba..0626e4c6c 100644
--- a/Actions/ReadSecrets/action.yaml
+++ b/Actions/ReadSecrets/action.yaml
@@ -32,14 +32,9 @@ runs:
_getSecrets: ${{ inputs.getSecrets }}
_useGhTokenWorkflowForPush: ${{ inputs.useGhTokenWorkflowForPush }}
run: |
- $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
- try {
+ ${{ github.action_path }}/../Invoke-AlGoAction.ps1 -ActionName "ReadSecrets" -Action {
${{ github.action_path }}/ReadSecrets.ps1 -gitHubSecrets '${{ inputs.gitHubSecrets }}' -getSecrets $ENV:_getSecrets -useGhTokenWorkflowForPush $ENV:_useGhTokenWorkflowForPush
}
- catch {
- Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
- exit 1
- }
branding:
icon: terminal
color: blue
diff --git a/Actions/ReadSettings/action.yaml b/Actions/ReadSettings/action.yaml
index 1f0230912..63dfc8eac 100644
--- a/Actions/ReadSettings/action.yaml
+++ b/Actions/ReadSettings/action.yaml
@@ -30,14 +30,9 @@ runs:
_project: ${{ inputs.project }}
_get: ${{ inputs.get }}
run: |
- $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
- try {
+ ${{ github.action_path }}/../Invoke-AlGoAction.ps1 -ActionName "ReadSettings" -Action {
${{ github.action_path }}/ReadSettings.ps1 -project $ENV:_project -get $ENV:_get
}
- catch {
- Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
- exit 1
- }
branding:
icon: terminal
color: blue
diff --git a/Actions/RunPipeline/README.md b/Actions/RunPipeline/README.md
index 6eec53766..ceeb21626 100644
--- a/Actions/RunPipeline/README.md
+++ b/Actions/RunPipeline/README.md
@@ -17,7 +17,6 @@ Run pipeline in AL-Go repository
| :-- | :-: | :-- | :-- |
| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell |
| token | | The GitHub token running the action | github.token |
-| parentTelemetryScopeJson | | Specifies the parent telemetry scope for the telemetry signal | {} |
| artifact | | ArtifactUrl to use for the build | settings.artifact |
| project | | Project name if the repository is setup for multiple projects | . |
| buildMode | | Specifies a mode to use for the build steps | Default |
diff --git a/Actions/RunPipeline/RunPipeline.ps1 b/Actions/RunPipeline/RunPipeline.ps1
index ed3613ca9..b102a3a91 100644
--- a/Actions/RunPipeline/RunPipeline.ps1
+++ b/Actions/RunPipeline/RunPipeline.ps1
@@ -1,8 +1,6 @@
Param(
[Parameter(HelpMessage = "The GitHub token running the action", Mandatory = $false)]
[string] $token,
- [Parameter(HelpMessage = "Specifies the parent telemetry scope for the telemetry signal", Mandatory = $false)]
- [string] $parentTelemetryScopeJson = '7b7d',
[Parameter(HelpMessage = "ArtifactUrl to use for the build", Mandatory = $false)]
[string] $artifact = "",
[Parameter(HelpMessage = "Project folder", Mandatory = $false)]
@@ -15,7 +13,6 @@
[string] $installTestAppsJson = '[]'
)
-$telemetryScope = $null
$containerBaseFolder = $null
$projectPath = $null
@@ -23,9 +20,6 @@ try {
. (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve)
DownloadAndImportBcContainerHelper
- import-module (Join-Path -path $PSScriptRoot -ChildPath "..\TelemetryHelper.psm1" -Resolve)
- $telemetryScope = CreateScope -eventId 'DO0080' -parentTelemetryScopeJson $parentTelemetryScopeJson
-
if ($isWindows) {
# Pull docker image in the background
$genericImageName = Get-BestGenericImageName
@@ -400,7 +394,6 @@ try {
-uninstallRemovedApps
if ($containerBaseFolder) {
-
Write-Host "Copy artifacts and build output back from build container"
$destFolder = Join-Path $ENV:GITHUB_WORKSPACE $project
Copy-Item -Path (Join-Path $projectPath ".buildartifacts") -Destination $destFolder -Recurse -Force
@@ -410,13 +403,8 @@ try {
Copy-Item -Path $buildOutputFile -Destination $destFolder -Force -ErrorAction SilentlyContinue
Copy-Item -Path $containerEventLogFile -Destination $destFolder -Force -ErrorAction SilentlyContinue
}
-
- TrackTrace -telemetryScope $telemetryScope
}
catch {
- if (Get-Module BcContainerHelper) {
- TrackException -telemetryScope $telemetryScope -errorRecord $_
- }
throw
}
finally {
diff --git a/Actions/RunPipeline/action.yaml b/Actions/RunPipeline/action.yaml
index 65448da9c..5e137d4d6 100644
--- a/Actions/RunPipeline/action.yaml
+++ b/Actions/RunPipeline/action.yaml
@@ -9,10 +9,6 @@ inputs:
description: The GitHub token running the action
required: false
default: ${{ github.token }}
- parentTelemetryScopeJson:
- description: Specifies the parent telemetry scope for the telemetry signal
- required: false
- default: '7b7d'
artifact:
description: ArtifactUrl to use for the build
required: false
@@ -40,20 +36,14 @@ runs:
shell: ${{ inputs.shell }}
env:
_token: ${{ inputs.token }}
- _parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }}
_artifact: ${{ inputs.artifact }}
_project: ${{ inputs.project }}
_buildMode: ${{ inputs.buildMode }}
_installAppsJson: ${{ inputs.installAppsJson }}
_installTestAppsJson: ${{ inputs.installTestAppsJson }}
run: |
- $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
- try {
- ${{ github.action_path }}/RunPipeline.ps1 -token $ENV:_token -parentTelemetryScopeJson $ENV:_parentTelemetryScopeJson -artifact $ENV:_artifact -project $ENV:_project -buildMode $ENV:_buildMode -installAppsJson $ENV:_installAppsJson -installTestAppsJson $ENV:_installTestAppsJson
- }
- catch {
- Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
- exit 1
+ ${{ github.action_path }}/../Invoke-AlGoAction.ps1 -ActionName "RunPipeline" -Action {
+ ${{ github.action_path }}/RunPipeline.ps1 -token $ENV:_token -artifact $ENV:_artifact -project $ENV:_project -buildMode $ENV:_buildMode -installAppsJson $ENV:_installAppsJson -installTestAppsJson $ENV:_installTestAppsJson
}
branding:
icon: terminal
diff --git a/Actions/Sign/README.md b/Actions/Sign/README.md
index 34b04d445..192786396 100644
--- a/Actions/Sign/README.md
+++ b/Actions/Sign/README.md
@@ -15,7 +15,6 @@ Sign apps with a certificate stored in Azure Key Vault
| Name | Required | Description | Default value |
| :-- | :-: | :-- | :-- |
| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell |
-| parentTelemetryScopeJson | | Specifies the parent telemetry scope for the telemetry signal | {} |
| azureCredentialsJson | Yes | Azure Credentials secret (Base 64 encoded) | |
| timestampService | | The URI of the timestamp server | http://timestamp.digicert.com |
| digestAlgorithm | | The digest algorithm to use for signing and timestamping | SHA256 |
diff --git a/Actions/Sign/Sign.ps1 b/Actions/Sign/Sign.ps1
index 7600e8f20..4e3a0f3b7 100644
--- a/Actions/Sign/Sign.ps1
+++ b/Actions/Sign/Sign.ps1
@@ -7,75 +7,59 @@ param(
[Parameter(HelpMessage = "The URI of the timestamp server", Mandatory = $false)]
[string] $TimestampService = "http://timestamp.digicert.com",
[Parameter(HelpMessage = "The digest algorithm to use for signing and timestamping", Mandatory = $false)]
- [string] $digestAlgorithm = "sha256",
- [Parameter(HelpMessage = "Specifies the parent telemetry scope for the telemetry signal", Mandatory = $false)]
- [string] $ParentTelemetryScopeJson = '7b7d'
+ [string] $digestAlgorithm = "sha256"
)
-$telemetryScope = $null
+. (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve)
+Import-Module (Join-Path -Path $PSScriptRoot -ChildPath "Sign.psm1" -Resolve)
-try {
- . (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve)
- Import-Module (Join-Path -path $PSScriptRoot -ChildPath "..\TelemetryHelper.psm1" -Resolve)
- Import-Module (Join-Path -Path $PSScriptRoot -ChildPath "Sign.psm1" -Resolve)
- DownloadAndImportBcContainerHelper
- $telemetryScope = CreateScope -eventId 'DO0083' -parentTelemetryScopeJson $ParentTelemetryScopeJson
-
- $Files = Get-ChildItem -Path $PathToFiles -File | Select-Object -ExpandProperty FullName
- if (-not $Files) {
- Write-Host "No files to sign. Exiting."
- return
- }
-
- Write-Host "::group::Files to be signed"
- $Files | ForEach-Object {
- Write-Host "- $_"
- }
- Write-Host "::endgroup::"
-
- # Get parameters for signing
- $AzureCredentials = ConvertFrom-Json ([System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($AzureCredentialsJson)))
- $settings = $env:Settings | ConvertFrom-Json
- if ($settings.keyVaultName) {
- $AzureKeyVaultName = $settings.keyVaultName
- }
- elseif ($AzureCredentials.PSobject.Properties.name -eq "keyVaultName") {
- $AzureKeyVaultName = $AzureCredentials.keyVaultName
- }
- else {
- throw "KeyVaultName is not specified in AzureCredentials nor in settings. Please specify it in one of them."
- }
+$Files = Get-ChildItem -Path $PathToFiles -File | Select-Object -ExpandProperty FullName
+if (-not $Files) {
+ Write-Host "No files to sign. Exiting."
+ return
+}
- $AzureCredentialParams = @{
- "ClientId" = $AzureCredentials.clientId
- "TenantId" = $AzureCredentials.tenantId
- }
- if ($AzureCredentials.PSobject.Properties.name -eq "clientSecret") {
- $AzureCredentialParams += @{
- "ClientSecret" = $AzureCredentials.clientSecret
- }
- }
- InstallAzModuleIfNeeded -name 'Az.Accounts'
- ConnectAz -azureCredentials $AzureCredentials
+Write-Host "::group::Files to be signed"
+$Files | ForEach-Object {
+ Write-Host "- $_"
+}
+Write-Host "::endgroup::"
- $description = "Signed with AL-Go for GitHub"
- $descriptionUrl = "$ENV:GITHUB_SERVER_URL/$ENV:GITHUB_REPOSITORY"
+# Get parameters for signing
+$AzureCredentials = ConvertFrom-Json ([System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($AzureCredentialsJson)))
+$settings = $env:Settings | ConvertFrom-Json
+if ($settings.keyVaultName) {
+ $AzureKeyVaultName = $settings.keyVaultName
+}
+elseif ($AzureCredentials.PSobject.Properties.name -eq "keyVaultName") {
+ $AzureKeyVaultName = $AzureCredentials.keyVaultName
+}
+else {
+ throw "KeyVaultName is not specified in AzureCredentials nor in settings. Please specify it in one of them."
+}
- Write-Host "::group::Signing files"
- Invoke-SigningTool @AzureCredentialParams -KeyVaultName $AzureKeyVaultName `
- -CertificateName $settings.keyVaultCodesignCertificateName `
- -FilesToSign $PathToFiles `
- -Description $description `
- -DescriptionUrl $descriptionUrl `
- -TimestampService $TimestampService `
- -DigestAlgorithm $digestAlgorithm `
- -Verbosity "Information"
- Write-Host "::endgroup::"
- TrackTrace -telemetryScope $telemetryScope
+$AzureCredentialParams = @{
+ "ClientId" = $AzureCredentials.clientId
+ "TenantId" = $AzureCredentials.tenantId
}
-catch {
- if (Get-Module BcContainerHelper) {
- TrackException -telemetryScope $telemetryScope -errorRecord $_
+if ($AzureCredentials.PSobject.Properties.name -eq "clientSecret") {
+ $AzureCredentialParams += @{
+ "ClientSecret" = $AzureCredentials.clientSecret
}
- throw
}
+InstallAzModuleIfNeeded -name 'Az.Accounts'
+ConnectAz -azureCredentials $AzureCredentials
+
+$description = "Signed with AL-Go for GitHub"
+$descriptionUrl = "$ENV:GITHUB_SERVER_URL/$ENV:GITHUB_REPOSITORY"
+
+Write-Host "::group::Signing files"
+Invoke-SigningTool @AzureCredentialParams -KeyVaultName $AzureKeyVaultName `
+ -CertificateName $settings.keyVaultCodesignCertificateName `
+ -FilesToSign $PathToFiles `
+ -Description $description `
+ -DescriptionUrl $descriptionUrl `
+ -TimestampService $TimestampService `
+ -DigestAlgorithm $digestAlgorithm `
+ -Verbosity "Information"
+Write-Host "::endgroup::"
diff --git a/Actions/Sign/action.yaml b/Actions/Sign/action.yaml
index 27b2ab997..01d984014 100644
--- a/Actions/Sign/action.yaml
+++ b/Actions/Sign/action.yaml
@@ -19,10 +19,6 @@ inputs:
description: The digest algorithm to use for signing and timestamping
required: false
default: SHA256
- parentTelemetryScopeJson:
- description: Specifies the parent telemetry scope for the telemetry signal
- required: false
- default: '7b7d'
runs:
using: composite
steps:
@@ -33,15 +29,9 @@ runs:
_pathToFiles: ${{ inputs.pathToFiles }}
_timestampService: ${{ inputs.timestampService }}
_digestAlgorithm: ${{ inputs.digestAlgorithm }}
- _parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }}
run: |
- $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
- try {
- ${{ github.action_path }}/Sign.ps1 -AzureCredentialsJson $ENV:_azureCredentialsJson -PathToFiles $ENV:_pathToFiles -TimestampService $ENV:_timestampService -digestAlgorithm $ENV:_digestAlgorithm -ParentTelemetryScopeJson $ENV:_parentTelemetryScopeJson
- }
- catch {
- Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
- exit 1
+ ${{ github.action_path }}/../Invoke-AlGoAction.ps1 -ActionName "Sign" -Action {
+ ${{ github.action_path }}/Sign.ps1 -AzureCredentialsJson $ENV:_azureCredentialsJson -PathToFiles $ENV:_pathToFiles -TimestampService $ENV:_timestampService -digestAlgorithm $ENV:_digestAlgorithm
}
branding:
icon: terminal
diff --git a/Actions/TelemetryHelper.psm1 b/Actions/TelemetryHelper.psm1
index 83feaaf74..1e4e8b117 100644
--- a/Actions/TelemetryHelper.psm1
+++ b/Actions/TelemetryHelper.psm1
@@ -1,87 +1,208 @@
-$signals = @{
- "DO0070" = "AL-Go action ran: AddExistingApp"
- "DO0071" = "AL-Go action ran: CheckForUpdates"
- "DO0072" = "AL-Go action ran: CreateApp"
- "DO0073" = "AL-Go action ran: CreateDevelopmentEnvironment"
- "DO0074" = "AL-Go action ran: CreateReleaseNotes"
- "DO0075" = "AL-Go action ran: Deploy"
- "DO0076" = "AL-Go action ran: IncrementVersionNumber"
- "DO0077" = "AL-Go action ran: PipelineCleanup"
- "DO0078" = "AL-Go action ran: ReadSecrets"
- "DO0079" = "AL-Go action ran: ReadSettings"
- "DO0080" = "AL-Go action ran: RunPipeline"
- "DO0081" = "AL-Go action ran: Deliver"
- "DO0082" = "AL-Go action ran: AnalyzeTests"
- "DO0083" = "AL-Go action ran: Sign"
-
- "DO0084" = "AL-Go action ran: DetermineArtifactUrl"
- "DO0085" = "AL-Go action ran: DetermineProjectsToBuild"
-
- "DO0090" = "AL-Go workflow ran: AddExistingAppOrTestApp"
- "DO0091" = "AL-Go workflow ran: CICD"
- "DO0092" = "AL-Go workflow ran: CreateApp"
- "DO0093" = "AL-Go workflow ran: CreateOnlineDevelopmentEnvironment"
- "DO0094" = "AL-Go workflow ran: CreateRelease"
- "DO0095" = "AL-Go workflow ran: CreateTestApp"
- "DO0096" = "AL-Go workflow ran: IncrementVersionNumber"
- "DO0097" = "AL-Go workflow ran: PublishToEnvironment"
- "DO0098" = "AL-Go workflow ran: UpdateGitHubGoSystemFiles"
- "DO0099" = "AL-Go workflow ran: NextMajor"
- "DO0100" = "AL-Go workflow ran: NextMinor"
- "DO0101" = "AL-Go workflow ran: Current"
- "DO0102" = "AL-Go workflow ran: CreatePerformanceTestApp"
- "DO0103" = "AL-Go workflow ran: PublishToAppSource"
- "DO0104" = "AL-Go workflow ran: PullRequestHandler"
+. (Join-Path -Path $PSScriptRoot -ChildPath ".\AL-Go-Helper.ps1" -Resolve)
+Import-Module (Join-Path $PSScriptRoot '.\Github-Helper.psm1' -Resolve)
+
+#region Loading telemetry helper
+function DownloadNugetPackage($PackageName, $PackageVersion) {
+ $nugetPackagePath = Join-Path "$ENV:GITHUB_WORKSPACE" "/.nuget/packages/$PackageName/$PackageVersion/"
+
+ if (-not (Test-Path -Path $nugetPackagePath)) {
+ $url = "https://www.nuget.org/api/v2/package/$PackageName/$PackageVersion"
+
+ Write-Host "Downloading Nuget package $PackageName $PackageVersion..."
+ New-Item -ItemType Directory -Path $nugetPackagePath | Out-Null
+ Invoke-WebRequest -Uri $Url -OutFile "$nugetPackagePath/$PackageName.$PackageVersion.zip"
+
+ # Unzip the package
+ Expand-Archive -Path "$nugetPackagePath/$PackageName.$PackageVersion.zip" -DestinationPath "$nugetPackagePath"
+
+ # Remove the zip file
+ Remove-Item -Path "$nugetPackagePath/$PackageName.$PackageVersion.zip"
+ }
+
+ return $nugetPackagePath
+}
+
+function LoadApplicationInsightsDll() {
+ $packagePath = DownloadNugetPackage -PackageName "Microsoft.ApplicationInsights" -PackageVersion (GetPackageVersion -PackageName "Microsoft.ApplicationInsights")
+ $AppInsightsDllPath = "$packagePath/lib/net46/Microsoft.ApplicationInsights.dll"
+
+ if (-not (Test-Path -Path $AppInsightsDllPath)) {
+ throw "Failed to download Application Insights DLL"
+ }
+
+ [Reflection.Assembly]::LoadFile($AppInsightsDllPath) | Out-Null
}
-Function strToHexStr {
- Param(
- [string] $str
+function Get-ApplicationInsightsTelemetryClient($TelemetryConnectionString)
+{
+ # Load the Application Insights DLL
+ LoadApplicationInsightsDll
+
+ $TelemetryClient = [Microsoft.ApplicationInsights.TelemetryClient]::new()
+ $TelemetryClient.TelemetryConfiguration.ConnectionString = $TelemetryConnectionString
+
+ return $TelemetryClient
+}
+#endregion
+
+function AddTelemetryEvent()
+{
+ param(
+ [Parameter(Mandatory = $true)]
+ [String] $Message,
+ [Parameter(Mandatory = $false)]
+ [System.Collections.Generic.Dictionary[[System.String], [System.String]]] $Data = @{},
+ [Parameter(Mandatory = $false)]
+ [ValidateSet("Information", "Error")]
+ [String] $Severity = 'Information'
)
- $bytes = [System.Text.Encoding]::UTF8.GetBytes($str)
- $hexStr = [System.Text.StringBuilder]::new($Bytes.Length * 2)
- ForEach($byte in $Bytes){
- $hexStr.AppendFormat("{0:x2}", $byte) | Out-Null
+
+ try {
+ # Add powershell version
+ Add-TelemetryProperty -Hashtable $Data -Key 'PowerShellVersion' -Value ($PSVersionTable.PSVersion.ToString())
+
+ $module = Get-Module BcContainerHelper
+ if ($module) {
+ $versionNoFile = Join-Path -Path (Split-Path $module.Path -Parent) -ChildPath 'Version.txt'
+ Add-TelemetryProperty -Hashtable $Data -Key 'BcContainerHelperVersion' -Value (Get-Content -Path $versionNoFile -Encoding UTF8)
+ }
+
+ Add-TelemetryProperty -Hashtable $Data -Key 'WorkflowName' -Value $ENV:GITHUB_WORKFLOW
+ Add-TelemetryProperty -Hashtable $Data -Key 'RunnerOs' -Value $ENV:RUNNER_OS
+ Add-TelemetryProperty -Hashtable $Data -Key 'RunId' -Value $ENV:GITHUB_RUN_ID
+ Add-TelemetryProperty -Hashtable $Data -Key 'RunNumber' -Value $ENV:GITHUB_RUN_NUMBER
+ Add-TelemetryProperty -Hashtable $Data -Key 'RunAttempt' -Value $ENV:GITHUB_RUN_ATTEMPT
+
+ ### Add GitHub Repository information
+ Add-TelemetryProperty -Hashtable $Data -Key 'Repository' -Value $ENV:GITHUB_REPOSITORY_ID
+
+ $repoSettings = ReadSettings
+ if ($repoSettings.microsoftTelemetryConnectionString -ne '') {
+ Write-Host "Enabling Microsoft telemetry..."
+ $MicrosoftTelemetryClient = Get-ApplicationInsightsTelemetryClient -TelemetryConnectionString $repoSettings.microsoftTelemetryConnectionString
+ $MicrosoftTelemetryClient.TrackTrace($Message, [Microsoft.ApplicationInsights.DataContracts.SeverityLevel]::$Severity, $Data)
+ $MicrosoftTelemetryClient.Flush()
+ }
+
+ if ($repoSettings.partnerTelemetryConnectionString -ne '') {
+ Write-Host "Enabling partner telemetry..."
+ $PartnerTelemetryClient = Get-ApplicationInsightsTelemetryClient -TelemetryConnectionString $repoSettings.partnerTelemetryConnectionString
+ $PartnerTelemetryClient.TrackTrace($Message, [Microsoft.ApplicationInsights.DataContracts.SeverityLevel]::$Severity, $Data)
+ $PartnerTelemetryClient.Flush()
+ }
+ } catch {
+ Write-Host "Failed to log telemetry event: $_"
}
- $hexStr.ToString()
}
-Function hexStrToStr {
- Param(
- [String] $hexStr
+<#
+ .SYNOPSIS
+ Logs an information message to telemetry
+
+ .DESCRIPTION
+ Logs an information message to telemetry
+
+ .PARAMETER Message
+ The message to log to telemetry
+
+ .PARAMETER ActionName
+ The name of the action to log to telemetry
+
+ .PARAMETER AdditionalData
+ Additional data to log to telemetry
+
+ .EXAMPLE
+ Trace-Information -Message "AL-Go action ran: $actionName"
+#>
+function Trace-Information() {
+ param(
+ [Parameter(ParameterSetName = 'Message', Mandatory = $true)]
+ [String] $Message,
+ [Parameter(ParameterSetName = 'ActionName', Mandatory = $true)]
+ [String] $ActionName,
+ [Parameter(Mandatory = $false)]
+ [System.Collections.Generic.Dictionary[[System.String], [System.String]]] $AdditionalData = @{}
)
- $Bytes = [byte[]]::new($hexStr.Length / 2)
- For($i=0; $i -lt $hexStr.Length; $i+=2){
- $Bytes[$i/2] = [convert]::ToByte($hexStr.Substring($i, 2), 16)
+
+ if (-not $Message) {
+ $Message = "AL-Go action ran: $ActionName"
}
- [System.Text.Encoding]::UTF8.GetString($Bytes)
+
+ AddTelemetryEvent -Message $Message -Severity 'Information' -Data $AdditionalData
}
-function CreateScope {
- param (
- [string] $eventId,
- [string] $parentTelemetryScopeJson = '7b7d'
+<#
+ .SYNOPSIS
+ Logs an exception message to telemetry
+
+ .DESCRIPTION
+ Logs an exception message to telemetry
+
+ .PARAMETER Message
+ The message to log to telemetry
+
+ .PARAMETER ActionName
+ The name of the action to log to telemetry
+
+ .PARAMETER ErrorRecord
+ The error record to log to telemetry
+
+ .PARAMETER AdditionalData
+ Additional data to log to telemetry
+
+ .EXAMPLE
+ Trace-Exception -ErrorRecord $ErrorRecord
+#>
+function Trace-Exception() {
+ param(
+ [Parameter(ParameterSetName = 'Message', Mandatory = $true)]
+ [String] $Message,
+ [Parameter(ParameterSetName = 'ActionName', Mandatory = $true)]
+ [String] $ActionName,
+ [Parameter(Mandatory = $false)]
+ [System.Management.Automation.ErrorRecord] $ErrorRecord = $null,
+ [Parameter(Mandatory = $false)]
+ [System.Collections.Generic.Dictionary[[System.String], [System.String]]] $AdditionalData = @{}
)
- $signalName = $signals[$eventId]
- if (-not $signalName) {
- throw "Invalid event id ($eventId) is enountered."
+ if ($ErrorRecord -ne $null) {
+ Add-TelemetryProperty -Hashtable $AdditionalData -Key 'ErrorMessage' -Value $ErrorRecord.Exception.Message
}
- if ($parentTelemetryScopeJson -and $parentTelemetryScopeJson -ne '7b7d') {
- RegisterTelemetryScope (hexStrToStr -hexStr $parentTelemetryScopeJson) | Out-Null
+ if (-not $Message) {
+ $Message = "AL-Go action failed: $ActionName"
}
+ AddTelemetryEvent -Message $Message -Severity 'Error' -Data $AdditionalData
+}
- $telemetryScope = InitTelemetryScope -name $signalName -eventId $eventId -parameterValues @() -includeParameters @()
+<#
+ .SYNOPSIS
+ Adds a key-value pair to a hashtable if the key does not already exist
- return $telemetryScope
-}
+ .DESCRIPTION
+ Adds a key-value pair to a hashtable if the key does not already exist
+
+ .PARAMETER Hashtable
+ The hashtable to add the key-value pair to
-function GetHash {
+ .PARAMETER Key
+ The key to add to the hashtable
+
+ .PARAMETER Value
+ The value to add to the hashtable
+
+ .EXAMPLE
+ Add-TelemetryProperty -Hashtable $AdditionalData -Key 'RepoType' -Value 'PTE'
+#>
+function Add-TelemetryProperty() {
param(
- [string] $str
+ [System.Collections.Generic.Dictionary[[System.String], [System.String]]] $Hashtable,
+ [String] $Key,
+ [String] $Value
)
-
- $stream = [IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($str))
- (Get-FileHash -InputStream $stream -Algorithm SHA256).Hash
+ if (-not $Hashtable.ContainsKey($Key) -and ($Value -ne '')) {
+ $Hashtable.Add($Key, $Value)
+ }
}
+
+Export-ModuleMember -Function Trace-Information, Trace-Exception, Add-TelemetryProperty
diff --git a/Actions/Troubleshooting/action.yaml b/Actions/Troubleshooting/action.yaml
index c491ea431..5fc6b62a2 100644
--- a/Actions/Troubleshooting/action.yaml
+++ b/Actions/Troubleshooting/action.yaml
@@ -19,14 +19,9 @@ runs:
env:
_displayNameOfSecrets: ${{ inputs.displayNameOfSecrets }}
run: |
- $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
- try {
+ ${{ github.action_path }}/../Invoke-AlGoAction.ps1 -ActionName "Troubleshooting" -Action {
${{ github.action_path }}/Troubleshooting.ps1 -gitHubSecrets '${{ inputs.gitHubSecrets }}' -displayNameOfSecrets ($ENV:_displayNameOfSecrets -eq 'true')
}
- catch {
- Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
- exit 1
- }
branding:
icon: terminal
color: blue
diff --git a/Actions/VerifyPRChanges/action.yaml b/Actions/VerifyPRChanges/action.yaml
index af1cb8b61..871513cb1 100644
--- a/Actions/VerifyPRChanges/action.yaml
+++ b/Actions/VerifyPRChanges/action.yaml
@@ -27,14 +27,9 @@ runs:
_prBaseRepository: ${{ inputs.prBaseRepository }}
_pullRequestId: ${{ inputs.pullRequestId }}
run: |
- $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
- try {
+ ${{ github.action_path }}/../Invoke-AlGoAction.ps1 -ActionName "VerifyPRChanges" -Action {
${{ github.action_path }}/VerifyPRChanges.ps1 -token $ENV:_token -prBaseRepository $ENV:_prBaseRepository -pullRequestId $ENV:_pullRequestId
}
- catch {
- Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
- exit 1
- }
branding:
icon: terminal
color: blue
diff --git a/Actions/WorkflowInitialize/README.md b/Actions/WorkflowInitialize/README.md
index 3c14fe539..d3e6b88aa 100644
--- a/Actions/WorkflowInitialize/README.md
+++ b/Actions/WorkflowInitialize/README.md
@@ -13,7 +13,6 @@ none
| Name | Required | Description | Default value |
| :-- | :-: | :-- | :-- |
| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell |
-| eventId | Yes | The event id of the initiating workflow | |
| actionsRepo | No | The repository of the action | github.action_repository |
| actionsRef | No | The ref of the action | github.action_ref |
@@ -27,5 +26,4 @@ none
| Name | Description |
| :-- | :-- |
-| correlationId | A correlation Id for the workflow |
| telemetryScopeJson | A telemetryScope that covers the workflow |
diff --git a/Actions/WorkflowInitialize/WorkflowInitialize.ps1 b/Actions/WorkflowInitialize/WorkflowInitialize.ps1
index 4903d8609..5629ea421 100644
--- a/Actions/WorkflowInitialize/WorkflowInitialize.ps1
+++ b/Actions/WorkflowInitialize/WorkflowInitialize.ps1
@@ -1,82 +1,37 @@
-Param(
- [Parameter(HelpMessage = "The event id of the initiating workflow", Mandatory = $true)]
- [string] $eventId,
+Param(
[Parameter(HelpMessage = "The repository of the action", Mandatory = $false)]
[string] $actionsRepo,
[Parameter(HelpMessage = "The ref of the action", Mandatory = $false)]
[string] $actionsRef
)
-$telemetryScope = $null
+. (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve)
+. (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-TestRepoHelper.ps1" -Resolve)
-try {
- . (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve)
- . (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-TestRepoHelper.ps1" -Resolve)
-
- if ($actionsRepo -eq 'microsoft/AL-Go-Actions') {
- Write-Host "Using AL-Go for GitHub $actionsRef"
- $verstr = $actionsRef
- }
- elseif ($actionsRepo -eq 'microsoft/AL-Go') {
- Write-Host "Using AL-Go for GitHub Preview ($actionsRef)"
- $verstr = "p"
- }
- else {
- Write-Host "Using direct AL-Go development ($($actionsRepo)@$actionsRef)"
- $verstr = "d"
- }
-
- Write-Big -str "a$verstr"
-
- TestALGoRepository
-
- DownloadAndImportBcContainerHelper
+if ($actionsRepo -eq 'microsoft/AL-Go-Actions') {
+ Write-Host "Using AL-Go for GitHub $actionsRef"
+ $verstr = $actionsRef
+}
+elseif ($actionsRepo -eq 'microsoft/AL-Go') {
+ Write-Host "Using AL-Go for GitHub Preview ($actionsRef)"
+ $verstr = "p"
+}
+else {
+ Write-Host "Using direct AL-Go development ($($actionsRepo)@$actionsRef)"
+ $verstr = "d"
+}
- TestRunnerPrerequisites
+Write-Big -str "a$verstr"
- import-module (Join-Path -path $PSScriptRoot -ChildPath "..\TelemetryHelper.psm1" -Resolve)
- $telemetryScope = CreateScope -eventId $eventId
- if ($telemetryScope) {
- $repoSettings = Get-Content -Path (Join-Path $ENV:GITHUB_WORKSPACE '.github/AL-Go-Settings.json') -Raw -Encoding UTF8 | ConvertFrom-Json | ConvertTo-HashTable
- $type = 'PTE'
- if ($repoSettings.Keys -contains 'type') {
- $type = $repoSettings.type
- }
- $templateUrl = 'Not set'
- if ($repoSettings.Keys -contains 'templateUrl') {
- $templateUrl = $repoSettings.templateUrl
- }
- if ($verstr -eq "d") {
- $verstr = "Developer/Private"
- }
- elseif ($verstr -eq "p") {
- $verstr = "Preview"
- }
- AddTelemetryProperty -telemetryScope $telemetryScope -key "ALGoVersion" -value $verstr
- AddTelemetryProperty -telemetryScope $telemetryScope -key "type" -value $type
- AddTelemetryProperty -telemetryScope $telemetryScope -key "templateUrl" -value $templateUrl
- AddTelemetryProperty -telemetryScope $telemetryScope -key "repository" -value $ENV:GITHUB_REPOSITORY
- AddTelemetryProperty -telemetryScope $telemetryScope -key "runAttempt" -value $ENV:GITHUB_RUN_ATTEMPT
- AddTelemetryProperty -telemetryScope $telemetryScope -key "runNumber" -value $ENV:GITHUB_RUN_NUMBER
- AddTelemetryProperty -telemetryScope $telemetryScope -key "runId" -value $ENV:GITHUB_RUN_ID
+# Test the AL-Go repository is set up correctly
+TestALGoRepository
- $scopeJson = strToHexStr -str ($telemetryScope | ConvertTo-Json -Compress)
- $correlationId = ($telemetryScope.CorrelationId).ToString()
- }
- else {
- $scopeJson = '7b7d'
- $correlationId = [guid]::Empty.ToString()
- }
+# Test the prerequisites for the test runner
+TestRunnerPrerequisites
- Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "telemetryScopeJson=$scopeJson"
- Write-Host "telemetryScopeJson=$scopeJson"
+# Create a json object that contains an entry for the workflowstarttime
+$scopeJson = @{
+ "workflowStartTime" = [DateTime]::UtcNow
+} | ConvertTo-Json -Compress
- Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "correlationId=$correlationId"
- Write-Host "correlationId=$correlationId"
-}
-catch {
- if (Get-Module BcContainerHelper) {
- TrackException -telemetryScope $telemetryScope -errorRecord $_
- }
- throw
-}
+Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "telemetryScopeJson=$scopeJson"
diff --git a/Actions/WorkflowInitialize/action.yaml b/Actions/WorkflowInitialize/action.yaml
index 3bcb93a5f..0e3c1227d 100644
--- a/Actions/WorkflowInitialize/action.yaml
+++ b/Actions/WorkflowInitialize/action.yaml
@@ -5,9 +5,6 @@ inputs:
description: Shell in which you want to run the action (powershell or pwsh)
required: false
default: powershell
- eventId:
- description: The event id of the initiating workflow
- required: true
actionsRepo:
description: The repository of the action
required: false
@@ -17,9 +14,6 @@ inputs:
required: false
default: ${{ github.action_ref }}
outputs:
- correlationId:
- description: A correlation Id for the workflow
- value: ${{ steps.workflowinitialize.outputs.correlationId }}
telemetryScopeJson:
description: A telemetryScope that covers the workflow
value: ${{ steps.workflowinitialize.outputs.telemetryScopeJson }}
@@ -30,17 +24,11 @@ runs:
shell: ${{ inputs.shell }}
id: workflowinitialize
env:
- _eventId: ${{ inputs.eventId }}
_actionsRepo: ${{ inputs.actionsRepo }}
_actionsRef: ${{ inputs.actionsRef }}
run: |
- $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
- try {
- ${{ github.action_path }}/WorkflowInitialize.ps1 -eventId $ENV:_eventId -actionsRepo $ENV:_actionsRepo -actionsRef $ENV:_actionsRef
- }
- catch {
- Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
- exit 1
+ ${{ github.action_path }}/../Invoke-AlGoAction.ps1 -ActionName "WorkflowInitialize" -Action {
+ ${{ github.action_path }}/WorkflowInitialize.ps1 -actionsRepo $ENV:_actionsRepo -actionsRef $ENV:_actionsRef
}
branding:
icon: terminal
diff --git a/Actions/WorkflowPostProcess/README.md b/Actions/WorkflowPostProcess/README.md
index 1a150b940..ae66baf56 100644
--- a/Actions/WorkflowPostProcess/README.md
+++ b/Actions/WorkflowPostProcess/README.md
@@ -13,8 +13,8 @@ none
| Name | Required | Description | Default value |
| :-- | :-: | :-- | :-- |
| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell |
-| eventId | Yes | The event id of the initiating workflow | |
| telemetryScopeJson | | Telemetry scope generated during the workflow initialization | {} |
+| currentJobContext | | The current job context | '' |
## OUTPUT
diff --git a/Actions/WorkflowPostProcess/WorkflowPostProcess.ps1 b/Actions/WorkflowPostProcess/WorkflowPostProcess.ps1
index c31ec6bc2..64a3a35c8 100644
--- a/Actions/WorkflowPostProcess/WorkflowPostProcess.ps1
+++ b/Actions/WorkflowPostProcess/WorkflowPostProcess.ps1
@@ -1,26 +1,110 @@
Param(
- [Parameter(HelpMessage = "The event Id of the initiating workflow", Mandatory = $true)]
- [string] $eventId,
[Parameter(HelpMessage = "Telemetry scope generated during the workflow initialization", Mandatory = $false)]
- [string] $telemetryScopeJson = '7b7d'
+ [string] $telemetryScopeJson = '',
+ [Parameter(HelpMessage = "The current job context", Mandatory = $false)]
+ [string] $currentJobContext = '',
+ [Parameter(HelpMessage = "The ref of the action", Mandatory = $false)]
+ [string] $actionsRef
)
-$telemetryScope = $null
+function GetWorkflowConclusion($JobContext) {
+ # Check the conclusion for the current job
+ if ($JobContext -ne '') {
+ $jobContext = $JobContext | ConvertFrom-Json
+ if ($jobContext.status -eq 'failure') {
+ return "Failure"
+ }
+ if ($jobContext.status -eq 'timed_out') {
+ return "TimedOut"
+ }
+ if ($jobContext.status -eq 'cancelled') {
+ return "Cancelled"
+ }
+ }
-try {
- . (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve)
- DownloadAndImportBcContainerHelper
- import-module (Join-Path -path $PSScriptRoot -ChildPath "..\TelemetryHelper.psm1" -Resolve)
+ # Check the conclusion for the past jobs in the workflow
+ $workflowJobs = gh api /repos/$ENV:GITHUB_REPOSITORY/actions/runs/$ENV:GITHUB_RUN_ID/jobs --paginate -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" | ConvertFrom-Json
+ if ($null -ne $workflowJobs) {
+ $failedJobs = $workflowJobs.jobs | Where-Object { $_.conclusion -eq "failure" }
+ if ($null -ne $failedJobs) {
+ return "Failure"
+ }
+ $timedOutJobs = $workflowJobs.jobs | Where-Object { $_.conclusion -eq "timed_out" }
+ if ($null -ne $timedOutJobs) {
+ return "TimedOut"
+ }
+ $cancelledJobs = $workflowJobs.jobs | Where-Object { $_.conclusion -eq "cancelled" }
+ if ($null -ne $cancelledJobs) {
+ return "Cancelled"
+ }
+ }
- Write-Host "Post-processing workflow $eventId"
- if ($telemetryScopeJson -and $telemetryScopeJson -ne '7b7d') {
- $telemetryScope = RegisterTelemetryScope (hexStrToStr -hexStr $telemetryScopeJson)
- TrackTrace -telemetryScope $telemetryScope
+ return "Success"
+}
+
+function GetAlGoVersion($ActionRef) {
+ if ($ENV:GITHUB_REPOSITORY -eq "microsoft/AL-Go") {
+ return "Preview"
+ } elseif($ENV:GITHUB_REPOSITORY -notlike "microsoft/*") {
+ return "Developer/Private"
+ } else {
+ return $ActionRef
}
}
-catch {
- if (Get-Module BcContainerHelper) {
- TrackException -telemetryScope $telemetryScope -errorRecord $_
+
+function LogWorkflowEnd($TelemetryScopeJson, $JobContext, $AlGoVersion) {
+ [System.Collections.Generic.Dictionary[[System.String], [System.String]]] $AdditionalData = @{}
+ $telemetryScope = $null
+ if ($TelemetryScopeJson -ne '') {
+ $telemetryScope = $TelemetryScopeJson | ConvertFrom-Json
+ }
+
+ # Get the workflow conclusion
+ $workflowConclusion = GetWorkflowConclusion -JobContext $JobContext
+ Add-TelemetryProperty -Hashtable $AdditionalData -Key 'WorkflowConclusion' -Value $workflowConclusion
+
+ # Calculate the workflow duration using the github api
+ if ($telemetryScope -and ($null -ne $telemetryScope.workflowStartTime)) {
+ Write-Host "Calculating workflow duration..."
+ $workflowTiming= [DateTime]::UtcNow.Subtract([DateTime]::Parse($telemetryScope.workflowStartTime)).TotalSeconds
+ Add-TelemetryProperty -Hashtable $AdditionalData -Key 'WorkflowDuration' -Value $workflowTiming
+ }
+
+ # Log additional telemetry from AL-Go settings
+ $alGoSettingsPath = "$ENV:GITHUB_WORKSPACE/.github/AL-Go-Settings.json"
+ if (Test-Path -Path $alGoSettingsPath) {
+ $repoSettings = Get-Content -Path $alGoSettingsPath -Raw -Encoding UTF8 | ConvertFrom-Json
+
+ if ($repoSettings.PSObject.Properties.Name -contains 'type') {
+ Add-TelemetryProperty -Hashtable $AdditionalData -Key 'RepoType' -Value $repoSettings.type
+ }
+
+ if ($repoSettings.PSObject.Properties.Name -contains 'githubRunner') {
+ Add-TelemetryProperty -Hashtable $AdditionalData -Key 'GitHubRunner' -Value $repoSettings.githubRunner
+ }
+
+ if ($repoSettings.PSObject.Properties.Name -contains 'runs-on') {
+ Add-TelemetryProperty -Hashtable $AdditionalData -Key 'RunsOn' -Value $repoSettings.'runs-on'
+ }
}
- throw
+
+ if ($AlGoVersion -ne '') {
+ Add-TelemetryProperty -Hashtable $AdditionalData -Key 'ALGoVersion' -Value $AlGoVersion
+ }
+
+ if ($workflowConclusion -in @("Failure", "TimedOut")) {
+ Trace-Exception -Message "AL-Go workflow failed: $($ENV:GITHUB_WORKFLOW.Trim())" -AdditionalData $AdditionalData
+ } else {
+ Trace-Information -Message "AL-Go workflow ran: $($ENV:GITHUB_WORKFLOW.Trim())" -AdditionalData $AdditionalData
+ }
+}
+
+Import-Module (Join-Path -Path $PSScriptRoot -ChildPath "..\TelemetryHelper.psm1" -Resolve)
+
+try {
+ LogWorkflowEnd -TelemetryScopeJson $telemetryScopeJson -JobContext $currentJobContext -AlGoVersion (GetAlGoVersion -ActionRef $actionsRef)
+} catch {
+ # Log the exception to telemetry but don't fail the action if gathering telemetry fails
+ Write-Host "::Warning::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
+ Trace-Exception -ActionName "WorkflowPostProcess" -ErrorRecord $_
}
diff --git a/Actions/WorkflowPostProcess/action.yaml b/Actions/WorkflowPostProcess/action.yaml
index d1a30a3b4..84816e812 100644
--- a/Actions/WorkflowPostProcess/action.yaml
+++ b/Actions/WorkflowPostProcess/action.yaml
@@ -5,29 +5,30 @@ inputs:
description: Shell in which you want to run the action (powershell or pwsh)
required: false
default: powershell
- eventId:
- description: The event Id of the initiating workflow
- required: true
telemetryScopeJson:
description: Telemetry scope generated during the workflow initialization
required: false
default: '7b7d'
+ currentJobContext:
+ description: The current job context
+ required: false
+ default: ''
+ actionsRef:
+ description: The ref of the action
+ required: false
+ default: ${{ github.action_ref }}
runs:
using: composite
steps:
- name: run
shell: ${{ inputs.shell }}
env:
- _eventId: ${{ inputs.eventId }}
_telemetryScopeJson: ${{ inputs.telemetryScopeJson }}
+ _currentJobContext: ${{ inputs.currentJobContext }}
+ _actionsRef: ${{ inputs.actionsRef }}
run: |
- $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
- try {
- ${{ github.action_path }}/WorkflowPostProcess.ps1 -eventId $ENV:_eventId -telemetryScopeJson $ENV:_telemetryScopeJson
- }
- catch {
- Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
- exit 1
+ ${{ github.action_path }}/../Invoke-AlGoAction.ps1 -ActionName "WorkflowPostProcess" -Action {
+ ${{ github.action_path }}/WorkflowPostProcess.ps1 -telemetryScopeJson $ENV:_telemetryScopeJson -currentJobContext $ENV:_currentJobContext -actionsRef $ENV:_actionsRef
}
branding:
icon: terminal
diff --git a/Scenarios/EnablingTelemetry.md b/Scenarios/EnablingTelemetry.md
index 3d0f0c9e7..f9ac88adb 100644
--- a/Scenarios/EnablingTelemetry.md
+++ b/Scenarios/EnablingTelemetry.md
@@ -1,58 +1,94 @@
# 15. Enabling telemetry
-If you want to enable partner telemetry add your Application Insights connection string to the AL-Go settings file. the settings structure is:
+If you want to enable partner telemetry add your Application Insights connection string to the AL-Go settings file. Simply add the following setting to your settings file:
```
"PartnerTelemetryConnectionString": ""
```
-You can also decide to send extended telelmetry to Microsoft. This would be helpful to investigate an issue. To enable the extended telemetry add the following property to the AL-Go settings file:
+Per default, AL-Go logs some basic telemetry to Microsoft. If you want to opt-out of sending telemetry to Microsoft you can add the following setting to your settings file:
+
+```
+"microsoftTelemetryConnectionString": ""
+```
+
+By setting the Microsoft telemetry connection string to be an empty string you opt-out of sending basic telemetry to Microsoft. If on the other hand you want to send extended telemetry to Microsoft you can do that with the following setting.
```
"SendExtendedTelemetryToMicrosoft" : true
```
-Each workflow starts with initialization task and ends with a postprocess task. During the initialization an operation Id(Guid) is generated and added to all the tasks in the workflow as ParentID. This property can be used to see all the signals sent for a workflow. The postprocess task sends the signal and duration of a workflow. Additionally, each task has its own signal and operationId. This could be used to investigate a task.
-
-Here is a list of the telemetry signals for different tasks:
-| Event ID | Description |
-| :-- | :-- |
-| DO0070 | AL-Go action ran: AddExistingApp |
-| DO0071 | AL-Go action ran: CheckForUpdates |
-| DO0072 | AL-Go action ran: CreateApp |
-| DO0073 | AL-Go action ran: CreateDevelopmentEnvironment |
-| DO0074 | AL-Go action ran: CreateReleaseNotes |
-| DO0075 | AL-Go action ran: Deploy |
-| DO0076 | AL-Go action ran: IncrementVersionNumber |
-| DO0077 | AL-Go action ran: PipelineCleanup |
-| DO0078 | AL-Go action ran: ReadSecrets |
-| DO0079 | AL-Go action ran: ReadSettings |
-| DO0080 | AL-Go action ran: RunPipeline |
-| DO0081 | AL-Go action ran: Deliver |
-| DO0082 | AL-Go action ran: AnalyzeTests |
-| DO0083 | AL-Go action ran: Sign |
-| DO0084 | AL-Go action ran: DetermineArtifactUrl |
-| DO0085 | AL-Go action ran: DetermineProjectsToBuild |
-
-Here is a list of the telemetry signals for different workflows:
-
-| Event ID | Description |
-| :-- | :-- |
-| DO0090 | AL-Go workflow ran: AddExistingAppOrTestApp |
-| DO0091 | AL-Go workflow ran: CICD |
-| DO0092 | AL-Go workflow ran: CreateApp |
-| DO0093 | AL-Go workflow ran: CreateOnlineDevelopmentEnvironment |
-| DO0094 | AL-Go workflow ran: CreateRelease |
-| DO0095 | AL-Go workflow ran: CreateTestApp |
-| DO0096 | AL-Go workflow ran: IncrementVersionNumber |
-| DO0097 | AL-Go workflow ran: PublishToEnvironment |
-| DO0098 | AL-Go workflow ran: UpdateGitHubGoSystemFiles |
-| DO0099 | AL-Go workflow ran: NextMajor |
-| DO0100 | AL-Go workflow ran: NextMinor |
-| DO0101 | AL-Go workflow ran: Current |
-| DO0102 | AL-Go workflow ran: CreatePerformanceTestApp |
-| DO0103 | AL-Go workflow ran: PublishToAppSource |
-| DO0104 | AL-Go workflow ran: PullRequestHandler |
+Sending extended telemetry to Microsoft is helpful for when we need to help investigate an issue in your repository.
+
+## Telemetry events and data
+
+AL-Go logs four different types of telemetry events: AL-Go action ran/failed and AL-Go workflow ran/failed. Each of those telemetry events provide slightly different telemetry but common dimensions for all of them are:
+
+**Common Dimensions**
+| Dimension | Description |
+|-----------|-------------|
+| PowerShellVersion | The version of powershell used to run the action |
+| BcContainerHelperVersion | The version of BcContainerHelper used to run the action (if imported) |
+| WorkflowName | The name of the workflow |
+| RunnerOs | The operating system of the runner |
+| RunId | The Run Id |
+| RunNumber | The Run Number |
+| RunAttempt | The attempt number |
+| Repository | The repository Id |
+
+### AL-Go action ran
+
+Telemetry message: AL-Go action ran
+
+SeverityLevel: 1
+
+Additional Dimensions: None
+
+### AL-Go action failed
+
+Telemetry message: AL-Go action failed
+
+SeverityLevel: 3
+
+Additional Dimensions:
+
+| Dimension | Description |
+|-----------|-------------|
+| ErrorMessage | The error message thrown |
+
+### AL-Go workflow ran
+
+Telemetry message: AL-Go workflow ran
+
+SeverityLevel: 1
+
+Additional Dimensions:
+
+| Dimension | Description |
+|-----------|-------------|
+| WorkflowConclusion | Success or Cancelled |
+| WorkflowDuration | The duration of the workflow run |
+| RepoType | AppSource or PTE |
+| GitHubRunner | Value of the GitHubRunner setting |
+| RunsOn | Value of the RunsOn setting |
+| ALGoVersion | The AL-Go version used for the workflow run |
+
+### AL-Go workflow failed
+
+Telemetry message: AL-Go workflow failed
+
+SeverityLevel: 3
+
+Additional Dimensions:
+
+| Dimension | Description |
+|-----------|-------------|
+| WorkflowConclusion | Failure or TimedOut |
+| WorkflowDuration | The duration of the workflow run |
+| RepoType | AppSource or PTE |
+| GitHubRunner | Value of the GitHubRunner setting |
+| RunsOn | Value of the RunsOn setting |
+| ALGoVersion | The AL-Go version used for the workflow run |
______________________________________________________________________
diff --git a/Templates/AppSource App/.github/workflows/AddExistingAppOrTestApp.yaml b/Templates/AppSource App/.github/workflows/AddExistingAppOrTestApp.yaml
index bd23d3700..b3311ca13 100644
--- a/Templates/AppSource App/.github/workflows/AddExistingAppOrTestApp.yaml
+++ b/Templates/AppSource App/.github/workflows/AddExistingAppOrTestApp.yaml
@@ -22,9 +22,10 @@ on:
default: false
permissions:
+ actions: read
contents: write
- pull-requests: write
id-token: write
+ pull-requests: write
defaults:
run:
@@ -52,7 +53,6 @@ jobs:
uses: microsoft/AL-Go-Actions/WorkflowInitialize@main
with:
shell: powershell
- eventId: "DO0090"
- name: Read settings
uses: microsoft/AL-Go-Actions/ReadSettings@main
@@ -73,7 +73,6 @@ jobs:
with:
shell: powershell
token: ${{ steps.ReadSecrets.outputs.TokenForPush }}
- parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
project: ${{ github.event.inputs.project }}
url: ${{ github.event.inputs.url }}
directCommit: ${{ github.event.inputs.directCommit }}
@@ -81,7 +80,9 @@ jobs:
- name: Finalize the workflow
if: always()
uses: microsoft/AL-Go-Actions/WorkflowPostProcess@main
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
with:
shell: powershell
- eventId: "DO0090"
telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
+ currentJobContext: ${{ toJson(job) }}
diff --git a/Templates/AppSource App/.github/workflows/CICD.yaml b/Templates/AppSource App/.github/workflows/CICD.yaml
index 4d534369b..d57c5c899 100644
--- a/Templates/AppSource App/.github/workflows/CICD.yaml
+++ b/Templates/AppSource App/.github/workflows/CICD.yaml
@@ -14,10 +14,10 @@ defaults:
shell: powershell
permissions:
- contents: read
actions: read
- pages: read
+ contents: read
id-token: write
+ pages: read
env:
workflowDepth: 1
@@ -59,7 +59,6 @@ jobs:
uses: microsoft/AL-Go-Actions/WorkflowInitialize@main
with:
shell: powershell
- eventId: "DO0091"
- name: Read settings
id: ReadSettings
@@ -155,7 +154,6 @@ jobs:
with:
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
runsOn: ${{ needs.Initialization.outputs.githubRunner }}
- parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
project: ${{ matrix.project }}
projectName: ${{ matrix.projectName }}
buildMode: ${{ matrix.buildMode }}
@@ -331,7 +329,9 @@ jobs:
- name: Finalize the workflow
id: PostProcess
uses: microsoft/AL-Go-Actions/WorkflowPostProcess@main
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
with:
shell: powershell
- eventId: "DO0091"
telemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
+ currentJobContext: ${{ toJson(job) }}
diff --git a/Templates/AppSource App/.github/workflows/CreateApp.yaml b/Templates/AppSource App/.github/workflows/CreateApp.yaml
index 6c8189f3a..8458ff06d 100644
--- a/Templates/AppSource App/.github/workflows/CreateApp.yaml
+++ b/Templates/AppSource App/.github/workflows/CreateApp.yaml
@@ -32,9 +32,10 @@ on:
default: false
permissions:
+ actions: read
contents: write
- pull-requests: write
id-token: write
+ pull-requests: write
defaults:
run:
@@ -62,7 +63,6 @@ jobs:
uses: microsoft/AL-Go-Actions/WorkflowInitialize@main
with:
shell: powershell
- eventId: "DO0092"
- name: Read settings
uses: microsoft/AL-Go-Actions/ReadSettings@main
@@ -84,7 +84,6 @@ jobs:
with:
shell: powershell
token: ${{ steps.ReadSecrets.outputs.TokenForPush }}
- parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
project: ${{ github.event.inputs.project }}
type: ${{ env.type }}
name: ${{ github.event.inputs.name }}
@@ -96,7 +95,9 @@ jobs:
- name: Finalize the workflow
if: always()
uses: microsoft/AL-Go-Actions/WorkflowPostProcess@main
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
with:
shell: powershell
- eventId: "DO0092"
telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
+ currentJobContext: ${{ toJson(job) }}
diff --git a/Templates/AppSource App/.github/workflows/CreateOnlineDevelopmentEnvironment.yaml b/Templates/AppSource App/.github/workflows/CreateOnlineDevelopmentEnvironment.yaml
index d3f61738a..eb23fb6f7 100644
--- a/Templates/AppSource App/.github/workflows/CreateOnlineDevelopmentEnvironment.yaml
+++ b/Templates/AppSource App/.github/workflows/CreateOnlineDevelopmentEnvironment.yaml
@@ -26,9 +26,10 @@ on:
default: false
permissions:
+ actions: read
contents: write
- pull-requests: write
id-token: write
+ pull-requests: write
defaults:
run:
@@ -44,9 +45,9 @@ jobs:
runs-on: [ windows-latest ]
outputs:
deviceCode: ${{ steps.authenticate.outputs.deviceCode }}
- telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
githubRunner: ${{ steps.ReadSettings.outputs.GitHubRunnerJson }}
githubRunnerShell: ${{ steps.ReadSettings.outputs.GitHubRunnerShell }}
+ telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
steps:
- name: Dump Workflow Information
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
@@ -61,7 +62,6 @@ jobs:
uses: microsoft/AL-Go-Actions/WorkflowInitialize@main
with:
shell: powershell
- eventId: "DO0093"
- name: Read settings
id: ReadSettings
@@ -141,7 +141,6 @@ jobs:
with:
shell: powershell
token: ${{ steps.ReadSecrets.outputs.TokenForPush }}
- parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
environmentName: ${{ github.event.inputs.environmentName }}
project: ${{ github.event.inputs.project }}
reUseExistingEnvironment: ${{ github.event.inputs.reUseExistingEnvironment }}
@@ -151,7 +150,9 @@ jobs:
- name: Finalize the workflow
if: always()
uses: microsoft/AL-Go-Actions/WorkflowPostProcess@main
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
with:
shell: powershell
- eventId: "DO0093"
telemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
+ currentJobContext: ${{ toJson(job) }}
diff --git a/Templates/AppSource App/.github/workflows/CreatePerformanceTestApp.yaml b/Templates/AppSource App/.github/workflows/CreatePerformanceTestApp.yaml
index ee2474995..6966ff7c7 100644
--- a/Templates/AppSource App/.github/workflows/CreatePerformanceTestApp.yaml
+++ b/Templates/AppSource App/.github/workflows/CreatePerformanceTestApp.yaml
@@ -38,9 +38,10 @@ on:
default: false
permissions:
+ actions: read
contents: write
- pull-requests: write
id-token: write
+ pull-requests: write
defaults:
run:
@@ -68,7 +69,6 @@ jobs:
uses: microsoft/AL-Go-Actions/WorkflowInitialize@main
with:
shell: powershell
- eventId: "DO0102"
- name: Read settings
uses: microsoft/AL-Go-Actions/ReadSettings@main
@@ -89,7 +89,6 @@ jobs:
with:
shell: powershell
token: ${{ steps.ReadSecrets.outputs.TokenForPush }}
- parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
project: ${{ github.event.inputs.project }}
type: 'Performance Test App'
name: ${{ github.event.inputs.name }}
@@ -102,7 +101,9 @@ jobs:
- name: Finalize the workflow
if: always()
uses: microsoft/AL-Go-Actions/WorkflowPostProcess@main
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
with:
shell: powershell
- eventId: "DO0102"
telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
+ currentJobContext: ${{ toJson(job) }}
diff --git a/Templates/AppSource App/.github/workflows/CreateRelease.yaml b/Templates/AppSource App/.github/workflows/CreateRelease.yaml
index 22027dc88..a69bbe356 100644
--- a/Templates/AppSource App/.github/workflows/CreateRelease.yaml
+++ b/Templates/AppSource App/.github/workflows/CreateRelease.yaml
@@ -46,10 +46,10 @@ on:
default: false
permissions:
- contents: write
- pull-requests: write
actions: read
+ contents: write
id-token: write
+ pull-requests: write
concurrency: release
@@ -66,11 +66,11 @@ jobs:
needs: [ ]
runs-on: [ windows-latest ]
outputs:
- telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
artifacts: ${{ steps.analyzeartifacts.outputs.artifacts }}
releaseId: ${{ steps.createrelease.outputs.releaseId }}
commitish: ${{ steps.analyzeartifacts.outputs.commitish }}
releaseVersion: ${{ steps.createreleasenotes.outputs.releaseVersion }}
+ telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
steps:
- name: Dump Workflow Information
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
@@ -85,7 +85,6 @@ jobs:
uses: microsoft/AL-Go-Actions/WorkflowInitialize@main
with:
shell: powershell
- eventId: "DO0094"
- name: Read settings
id: ReadSettings
@@ -207,7 +206,6 @@ jobs:
uses: microsoft/AL-Go-Actions/CreateReleaseNotes@main
with:
shell: powershell
- parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
tag_name: ${{ github.event.inputs.tag }}
target_commitish: ${{ steps.analyzeartifacts.outputs.commitish }}
@@ -366,7 +364,6 @@ jobs:
with:
shell: powershell
token: ${{ steps.ReadSecrets.outputs.TokenForPush }}
- parentTelemetryScopeJson: ${{ needs.CreateRelease.outputs.telemetryScopeJson }}
versionNumber: ${{ github.event.inputs.updateVersionNumber }}
directCommit: ${{ github.event.inputs.directCommit }}
@@ -381,7 +378,9 @@ jobs:
- name: Finalize the workflow
id: PostProcess
uses: microsoft/AL-Go-Actions/WorkflowPostProcess@main
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
with:
shell: powershell
- eventId: "DO0094"
telemetryScopeJson: ${{ needs.CreateRelease.outputs.telemetryScopeJson }}
+ currentJobContext: ${{ toJson(job) }}
diff --git a/Templates/AppSource App/.github/workflows/CreateTestApp.yaml b/Templates/AppSource App/.github/workflows/CreateTestApp.yaml
index 524c235c0..beeed7a91 100644
--- a/Templates/AppSource App/.github/workflows/CreateTestApp.yaml
+++ b/Templates/AppSource App/.github/workflows/CreateTestApp.yaml
@@ -34,9 +34,10 @@ on:
default: false
permissions:
+ actions: read
contents: write
- pull-requests: write
id-token: write
+ pull-requests: write
defaults:
run:
@@ -64,7 +65,6 @@ jobs:
uses: microsoft/AL-Go-Actions/WorkflowInitialize@main
with:
shell: powershell
- eventId: "DO0095"
- name: Read settings
uses: microsoft/AL-Go-Actions/ReadSettings@main
@@ -85,7 +85,6 @@ jobs:
with:
shell: powershell
token: ${{ steps.ReadSecrets.outputs.TokenForPush }}
- parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
project: ${{ github.event.inputs.project }}
type: 'Test App'
name: ${{ github.event.inputs.name }}
@@ -97,7 +96,9 @@ jobs:
- name: Finalize the workflow
if: always()
uses: microsoft/AL-Go-Actions/WorkflowPostProcess@main
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
with:
shell: powershell
- eventId: "DO0095"
telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
+ currentJobContext: ${{ toJson(job) }}
diff --git a/Templates/AppSource App/.github/workflows/Current.yaml b/Templates/AppSource App/.github/workflows/Current.yaml
index 4da7bfc47..a485d6601 100644
--- a/Templates/AppSource App/.github/workflows/Current.yaml
+++ b/Templates/AppSource App/.github/workflows/Current.yaml
@@ -4,8 +4,8 @@ on:
workflow_dispatch:
permissions:
- contents: read
actions: read
+ contents: read
id-token: write
defaults:
@@ -22,13 +22,13 @@ jobs:
needs: [ ]
runs-on: [ windows-latest ]
outputs:
- telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
githubRunner: ${{ steps.ReadSettings.outputs.GitHubRunnerJson }}
githubRunnerShell: ${{ steps.ReadSettings.outputs.GitHubRunnerShell }}
projects: ${{ steps.determineProjectsToBuild.outputs.ProjectsJson }}
projectDependenciesJson: ${{ steps.determineProjectsToBuild.outputs.ProjectDependenciesJson }}
buildOrderJson: ${{ steps.determineProjectsToBuild.outputs.BuildOrderJson }}
workflowDepth: ${{ steps.DetermineWorkflowDepth.outputs.WorkflowDepth }}
+ telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
steps:
- name: Dump Workflow Information
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
@@ -45,7 +45,6 @@ jobs:
uses: microsoft/AL-Go-Actions/WorkflowInitialize@main
with:
shell: powershell
- eventId: "DO0101"
- name: Read settings
id: ReadSettings
@@ -78,7 +77,6 @@ jobs:
with:
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
runsOn: ${{ needs.Initialization.outputs.githubRunner }}
- parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
project: ${{ matrix.project }}
projectName: ${{ matrix.projectName }}
buildMode: ${{ matrix.buildMode }}
@@ -98,7 +96,9 @@ jobs:
- name: Finalize the workflow
id: PostProcess
uses: microsoft/AL-Go-Actions/WorkflowPostProcess@main
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
with:
shell: powershell
- eventId: "DO0101"
telemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
+ currentJobContext: ${{ toJson(job) }}
diff --git a/Templates/AppSource App/.github/workflows/DeployReferenceDocumentation.yaml b/Templates/AppSource App/.github/workflows/DeployReferenceDocumentation.yaml
index 1912739c0..bde6cfe3f 100644
--- a/Templates/AppSource App/.github/workflows/DeployReferenceDocumentation.yaml
+++ b/Templates/AppSource App/.github/workflows/DeployReferenceDocumentation.yaml
@@ -4,10 +4,10 @@ on:
workflow_dispatch:
permissions:
- contents: read
actions: read
- pages: write
+ contents: read
id-token: write
+ pages: write
defaults:
run:
@@ -33,7 +33,6 @@ jobs:
uses: microsoft/AL-Go-Actions/WorkflowInitialize@main
with:
shell: powershell
- eventId: "DO0097"
- name: Read settings
uses: microsoft/AL-Go-Actions/ReadSettings@main
@@ -69,3 +68,13 @@ jobs:
if: steps.DetermineDeploymentEnvironments.outputs.deployALDocArtifact == 1
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5
+
+ - name: Finalize the workflow
+ if: always()
+ uses: microsoft/AL-Go-Actions/WorkflowPostProcess@main
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
+ with:
+ shell: powershell
+ telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
+ currentJobContext: ${{ toJson(job) }}
diff --git a/Templates/AppSource App/.github/workflows/IncrementVersionNumber.yaml b/Templates/AppSource App/.github/workflows/IncrementVersionNumber.yaml
index 20e9aa5a4..a2c326b12 100644
--- a/Templates/AppSource App/.github/workflows/IncrementVersionNumber.yaml
+++ b/Templates/AppSource App/.github/workflows/IncrementVersionNumber.yaml
@@ -22,9 +22,10 @@ on:
default: false
permissions:
+ actions: read
contents: write
- pull-requests: write
id-token: write
+ pull-requests: write
defaults:
run:
@@ -52,7 +53,6 @@ jobs:
uses: microsoft/AL-Go-Actions/WorkflowInitialize@main
with:
shell: powershell
- eventId: "DO0096"
- name: Read settings
uses: microsoft/AL-Go-Actions/ReadSettings@main
@@ -73,7 +73,6 @@ jobs:
with:
shell: powershell
token: ${{ steps.ReadSecrets.outputs.TokenForPush }}
- parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
projects: ${{ github.event.inputs.projects }}
versionNumber: ${{ github.event.inputs.versionNumber }}
directCommit: ${{ github.event.inputs.directCommit }}
@@ -81,7 +80,9 @@ jobs:
- name: Finalize the workflow
if: always()
uses: microsoft/AL-Go-Actions/WorkflowPostProcess@main
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
with:
shell: powershell
- eventId: "DO0096"
telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
+ currentJobContext: ${{ toJson(job) }}
diff --git a/Templates/AppSource App/.github/workflows/NextMajor.yaml b/Templates/AppSource App/.github/workflows/NextMajor.yaml
index 5ba614151..1f2d1fb65 100644
--- a/Templates/AppSource App/.github/workflows/NextMajor.yaml
+++ b/Templates/AppSource App/.github/workflows/NextMajor.yaml
@@ -4,8 +4,8 @@ on:
workflow_dispatch:
permissions:
- contents: read
actions: read
+ contents: read
id-token: write
defaults:
@@ -22,13 +22,13 @@ jobs:
needs: [ ]
runs-on: [ windows-latest ]
outputs:
- telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
githubRunner: ${{ steps.ReadSettings.outputs.GitHubRunnerJson }}
githubRunnerShell: ${{ steps.ReadSettings.outputs.GitHubRunnerShell }}
projects: ${{ steps.determineProjectsToBuild.outputs.ProjectsJson }}
projectDependenciesJson: ${{ steps.determineProjectsToBuild.outputs.ProjectDependenciesJson }}
buildOrderJson: ${{ steps.determineProjectsToBuild.outputs.BuildOrderJson }}
workflowDepth: ${{ steps.DetermineWorkflowDepth.outputs.WorkflowDepth }}
+ telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
steps:
- name: Dump Workflow Information
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
@@ -45,7 +45,6 @@ jobs:
uses: microsoft/AL-Go-Actions/WorkflowInitialize@main
with:
shell: powershell
- eventId: "DO0099"
- name: Read settings
id: ReadSettings
@@ -78,7 +77,6 @@ jobs:
with:
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
runsOn: ${{ needs.Initialization.outputs.githubRunner }}
- parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
project: ${{ matrix.project }}
projectName: ${{ matrix.projectName }}
buildMode: ${{ matrix.buildMode }}
@@ -98,7 +96,9 @@ jobs:
- name: Finalize the workflow
id: PostProcess
uses: microsoft/AL-Go-Actions/WorkflowPostProcess@main
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
with:
shell: powershell
- eventId: "DO0099"
telemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
+ currentJobContext: ${{ toJson(job) }}
diff --git a/Templates/AppSource App/.github/workflows/NextMinor.yaml b/Templates/AppSource App/.github/workflows/NextMinor.yaml
index a175730e7..ecc312651 100644
--- a/Templates/AppSource App/.github/workflows/NextMinor.yaml
+++ b/Templates/AppSource App/.github/workflows/NextMinor.yaml
@@ -4,8 +4,8 @@ on:
workflow_dispatch:
permissions:
- contents: read
actions: read
+ contents: read
id-token: write
defaults:
@@ -22,13 +22,13 @@ jobs:
needs: [ ]
runs-on: [ windows-latest ]
outputs:
- telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
githubRunner: ${{ steps.ReadSettings.outputs.GitHubRunnerJson }}
githubRunnerShell: ${{ steps.ReadSettings.outputs.GitHubRunnerShell }}
projects: ${{ steps.determineProjectsToBuild.outputs.ProjectsJson }}
projectDependenciesJson: ${{ steps.determineProjectsToBuild.outputs.ProjectDependenciesJson }}
buildOrderJson: ${{ steps.determineProjectsToBuild.outputs.BuildOrderJson }}
workflowDepth: ${{ steps.DetermineWorkflowDepth.outputs.WorkflowDepth }}
+ telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
steps:
- name: Dump Workflow Information
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
@@ -45,7 +45,6 @@ jobs:
uses: microsoft/AL-Go-Actions/WorkflowInitialize@main
with:
shell: powershell
- eventId: "DO0100"
- name: Read settings
id: ReadSettings
@@ -78,7 +77,6 @@ jobs:
with:
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
runsOn: ${{ needs.Initialization.outputs.githubRunner }}
- parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
project: ${{ matrix.project }}
projectName: ${{ matrix.projectName }}
buildMode: ${{ matrix.buildMode }}
@@ -98,7 +96,9 @@ jobs:
- name: Finalize the workflow
id: PostProcess
uses: microsoft/AL-Go-Actions/WorkflowPostProcess@main
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
with:
shell: powershell
- eventId: "DO0100"
telemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
+ currentJobContext: ${{ toJson(job) }}
diff --git a/Templates/AppSource App/.github/workflows/PublishToAppSource.yaml b/Templates/AppSource App/.github/workflows/PublishToAppSource.yaml
index 63f69fbde..988a53930 100644
--- a/Templates/AppSource App/.github/workflows/PublishToAppSource.yaml
+++ b/Templates/AppSource App/.github/workflows/PublishToAppSource.yaml
@@ -18,8 +18,8 @@ on:
default: false
permissions:
- contents: read
actions: read
+ contents: read
id-token: write
defaults:
@@ -50,7 +50,6 @@ jobs:
uses: microsoft/AL-Go-Actions/WorkflowInitialize@main
with:
shell: powershell
- eventId: "DO0103"
Deliver:
needs: [ Initialization ]
@@ -79,7 +78,6 @@ jobs:
Secrets: '${{ steps.ReadSecrets.outputs.Secrets }}'
with:
shell: powershell
- parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
type: 'Release'
projects: ${{ github.event.inputs.projects }}
deliveryTarget: 'AppSource'
@@ -97,7 +95,9 @@ jobs:
- name: Finalize the workflow
id: PostProcess
uses: microsoft/AL-Go-Actions/WorkflowPostProcess@main
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
with:
shell: powershell
- eventId: "DO0103"
telemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
+ currentJobContext: ${{ toJson(job) }}
diff --git a/Templates/AppSource App/.github/workflows/PublishToEnvironment.yaml b/Templates/AppSource App/.github/workflows/PublishToEnvironment.yaml
index 6858dcf01..4e984321a 100644
--- a/Templates/AppSource App/.github/workflows/PublishToEnvironment.yaml
+++ b/Templates/AppSource App/.github/workflows/PublishToEnvironment.yaml
@@ -12,8 +12,8 @@ on:
required: true
permissions:
- contents: read
actions: read
+ contents: read
id-token: write
defaults:
@@ -29,11 +29,11 @@ jobs:
needs: [ ]
runs-on: [ windows-latest ]
outputs:
- telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
environmentsMatrixJson: ${{ steps.DetermineDeploymentEnvironments.outputs.EnvironmentsMatrixJson }}
environmentCount: ${{ steps.DetermineDeploymentEnvironments.outputs.EnvironmentCount }}
deploymentEnvironmentsJson: ${{ steps.DetermineDeploymentEnvironments.outputs.DeploymentEnvironmentsJson }}
deviceCode: ${{ steps.Authenticate.outputs.deviceCode }}
+ telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
steps:
- name: Dump Workflow Information
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
@@ -48,7 +48,6 @@ jobs:
uses: microsoft/AL-Go-Actions/WorkflowInitialize@main
with:
shell: powershell
- eventId: "DO0097"
- name: Read settings
id: ReadSettings
@@ -196,7 +195,9 @@ jobs:
- name: Finalize the workflow
id: PostProcess
uses: microsoft/AL-Go-Actions/WorkflowPostProcess@main
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
with:
shell: ${{ matrix.shell }}
- eventId: "DO0097"
telemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
+ currentJobContext: ${{ toJson(job) }}
diff --git a/Templates/AppSource App/.github/workflows/PullRequestHandler.yaml b/Templates/AppSource App/.github/workflows/PullRequestHandler.yaml
index 806bd56c0..3bfdf3318 100644
--- a/Templates/AppSource App/.github/workflows/PullRequestHandler.yaml
+++ b/Templates/AppSource App/.github/workflows/PullRequestHandler.yaml
@@ -13,10 +13,10 @@ defaults:
shell: powershell
permissions:
- contents: read
actions: read
- pull-requests: read
+ contents: read
id-token: write
+ pull-requests: read
env:
workflowDepth: 1
@@ -35,7 +35,6 @@ jobs:
if: (!failure() && !cancelled())
runs-on: [ windows-latest ]
outputs:
- telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
githubRunner: ${{ steps.ReadSettings.outputs.GitHubRunnerJson }}
githubRunnerShell: ${{ steps.ReadSettings.outputs.GitHubRunnerShell }}
projects: ${{ steps.determineProjectsToBuild.outputs.ProjectsJson }}
@@ -43,6 +42,7 @@ jobs:
buildOrderJson: ${{ steps.determineProjectsToBuild.outputs.BuildOrderJson }}
baselineWorkflowRunId: ${{ steps.determineProjectsToBuild.outputs.BaselineWorkflowRunId }}
workflowDepth: ${{ steps.DetermineWorkflowDepth.outputs.WorkflowDepth }}
+ telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
steps:
- name: Dump Workflow Information
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
@@ -60,7 +60,6 @@ jobs:
uses: microsoft/AL-Go-Actions/WorkflowInitialize@main
with:
shell: powershell
- eventId: "DO0104"
- name: Read settings
id: ReadSettings
@@ -94,7 +93,6 @@ jobs:
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
runsOn: ${{ needs.Initialization.outputs.githubRunner }}
checkoutRef: ${{ github.event_name == 'pull_request' && github.sha || format('refs/pull/{0}/merge', github.event.pull_request.number) }}
- parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
project: ${{ matrix.project }}
projectName: ${{ matrix.projectName }}
buildMode: ${{ matrix.buildMode }}
@@ -117,3 +115,13 @@ jobs:
GITHUB_TOKEN: ${{ github.token }}
with:
shell: powershell
+
+ - name: Finalize the workflow
+ id: PostProcess
+ uses: microsoft/AL-Go-Actions/WorkflowPostProcess@main
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
+ with:
+ shell: powershell
+ telemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
+ currentJobContext: ${{ toJson(job) }}
diff --git a/Templates/AppSource App/.github/workflows/Troubleshooting.yaml b/Templates/AppSource App/.github/workflows/Troubleshooting.yaml
index f421efa7d..258a20c8a 100644
--- a/Templates/AppSource App/.github/workflows/Troubleshooting.yaml
+++ b/Templates/AppSource App/.github/workflows/Troubleshooting.yaml
@@ -9,8 +9,8 @@ on:
default: false
permissions:
- contents: read
actions: read
+ contents: read
defaults:
run:
diff --git a/Templates/AppSource App/.github/workflows/UpdateGitHubGoSystemFiles.yaml b/Templates/AppSource App/.github/workflows/UpdateGitHubGoSystemFiles.yaml
index 5e2b74798..9ded4de35 100644
--- a/Templates/AppSource App/.github/workflows/UpdateGitHubGoSystemFiles.yaml
+++ b/Templates/AppSource App/.github/workflows/UpdateGitHubGoSystemFiles.yaml
@@ -17,6 +17,7 @@ on:
default: false
permissions:
+ actions: read
contents: read
id-token: write
@@ -47,7 +48,6 @@ jobs:
uses: microsoft/AL-Go-Actions/WorkflowInitialize@main
with:
shell: powershell
- eventId: "DO0098"
- name: Read settings
uses: microsoft/AL-Go-Actions/ReadSettings@main
@@ -105,7 +105,9 @@ jobs:
- name: Finalize the workflow
if: always()
uses: microsoft/AL-Go-Actions/WorkflowPostProcess@main
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
with:
shell: powershell
- eventId: "DO0098"
telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
+ currentJobContext: ${{ toJson(job) }}
diff --git a/Templates/AppSource App/.github/workflows/_BuildALGoProject.yaml b/Templates/AppSource App/.github/workflows/_BuildALGoProject.yaml
index 56034725f..cafa9d978 100644
--- a/Templates/AppSource App/.github/workflows/_BuildALGoProject.yaml
+++ b/Templates/AppSource App/.github/workflows/_BuildALGoProject.yaml
@@ -67,14 +67,10 @@ on:
description: Flag determining whether to use the Artifacts Cache
type: boolean
default: false
- parentTelemetryScopeJson:
- description: Specifies the telemetry scope for the telemetry signal
- required: false
- type: string
permissions:
- contents: read
actions: read
+ contents: read
id-token: write
env:
@@ -117,7 +113,6 @@ jobs:
id: determineArtifactUrl
with:
shell: ${{ inputs.shell }}
- parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }}
project: ${{ inputs.project }}
- name: Cache Business Central Artifacts
@@ -146,7 +141,6 @@ jobs:
BuildMode: ${{ inputs.buildMode }}
with:
shell: ${{ inputs.shell }}
- parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }}
artifact: ${{ env.artifact }}
project: ${{ inputs.project }}
buildMode: ${{ inputs.buildMode }}
@@ -161,7 +155,6 @@ jobs:
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
azureCredentialsJson: '${{ fromJson(steps.ReadSecrets.outputs.Secrets).AZURE_CREDENTIALS }}'
pathToFiles: '${{ inputs.project }}/.buildartifacts/Apps/*.app'
- parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
- name: Calculate Artifact names
id: calculateArtifactsNames
@@ -262,7 +255,6 @@ jobs:
uses: microsoft/AL-Go-Actions/AnalyzeTests@main
with:
shell: ${{ inputs.shell }}
- parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }}
project: ${{ inputs.project }}
- name: Cleanup
@@ -270,5 +262,4 @@ jobs:
uses: microsoft/AL-Go-Actions/PipelineCleanup@main
with:
shell: ${{ inputs.shell }}
- parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }}
project: ${{ inputs.project }}
diff --git a/Templates/Per Tenant Extension/.github/workflows/AddExistingAppOrTestApp.yaml b/Templates/Per Tenant Extension/.github/workflows/AddExistingAppOrTestApp.yaml
index bd23d3700..b3311ca13 100644
--- a/Templates/Per Tenant Extension/.github/workflows/AddExistingAppOrTestApp.yaml
+++ b/Templates/Per Tenant Extension/.github/workflows/AddExistingAppOrTestApp.yaml
@@ -22,9 +22,10 @@ on:
default: false
permissions:
+ actions: read
contents: write
- pull-requests: write
id-token: write
+ pull-requests: write
defaults:
run:
@@ -52,7 +53,6 @@ jobs:
uses: microsoft/AL-Go-Actions/WorkflowInitialize@main
with:
shell: powershell
- eventId: "DO0090"
- name: Read settings
uses: microsoft/AL-Go-Actions/ReadSettings@main
@@ -73,7 +73,6 @@ jobs:
with:
shell: powershell
token: ${{ steps.ReadSecrets.outputs.TokenForPush }}
- parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
project: ${{ github.event.inputs.project }}
url: ${{ github.event.inputs.url }}
directCommit: ${{ github.event.inputs.directCommit }}
@@ -81,7 +80,9 @@ jobs:
- name: Finalize the workflow
if: always()
uses: microsoft/AL-Go-Actions/WorkflowPostProcess@main
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
with:
shell: powershell
- eventId: "DO0090"
telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
+ currentJobContext: ${{ toJson(job) }}
diff --git a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml
index a4cc025bc..3d9933ee4 100644
--- a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml
+++ b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml
@@ -14,10 +14,10 @@ defaults:
shell: powershell
permissions:
- contents: read
actions: read
- pages: read
+ contents: read
id-token: write
+ pages: read
env:
workflowDepth: 1
@@ -59,7 +59,6 @@ jobs:
uses: microsoft/AL-Go-Actions/WorkflowInitialize@main
with:
shell: powershell
- eventId: "DO0091"
- name: Read settings
id: ReadSettings
@@ -155,7 +154,6 @@ jobs:
with:
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
runsOn: ${{ needs.Initialization.outputs.githubRunner }}
- parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
project: ${{ matrix.project }}
projectName: ${{ matrix.projectName }}
buildMode: ${{ matrix.buildMode }}
@@ -345,7 +343,9 @@ jobs:
- name: Finalize the workflow
id: PostProcess
uses: microsoft/AL-Go-Actions/WorkflowPostProcess@main
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
with:
shell: powershell
- eventId: "DO0091"
telemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
+ currentJobContext: ${{ toJson(job) }}
diff --git a/Templates/Per Tenant Extension/.github/workflows/CreateApp.yaml b/Templates/Per Tenant Extension/.github/workflows/CreateApp.yaml
index 6c8189f3a..8458ff06d 100644
--- a/Templates/Per Tenant Extension/.github/workflows/CreateApp.yaml
+++ b/Templates/Per Tenant Extension/.github/workflows/CreateApp.yaml
@@ -32,9 +32,10 @@ on:
default: false
permissions:
+ actions: read
contents: write
- pull-requests: write
id-token: write
+ pull-requests: write
defaults:
run:
@@ -62,7 +63,6 @@ jobs:
uses: microsoft/AL-Go-Actions/WorkflowInitialize@main
with:
shell: powershell
- eventId: "DO0092"
- name: Read settings
uses: microsoft/AL-Go-Actions/ReadSettings@main
@@ -84,7 +84,6 @@ jobs:
with:
shell: powershell
token: ${{ steps.ReadSecrets.outputs.TokenForPush }}
- parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
project: ${{ github.event.inputs.project }}
type: ${{ env.type }}
name: ${{ github.event.inputs.name }}
@@ -96,7 +95,9 @@ jobs:
- name: Finalize the workflow
if: always()
uses: microsoft/AL-Go-Actions/WorkflowPostProcess@main
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
with:
shell: powershell
- eventId: "DO0092"
telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
+ currentJobContext: ${{ toJson(job) }}
diff --git a/Templates/Per Tenant Extension/.github/workflows/CreateOnlineDevelopmentEnvironment.yaml b/Templates/Per Tenant Extension/.github/workflows/CreateOnlineDevelopmentEnvironment.yaml
index d3f61738a..eb23fb6f7 100644
--- a/Templates/Per Tenant Extension/.github/workflows/CreateOnlineDevelopmentEnvironment.yaml
+++ b/Templates/Per Tenant Extension/.github/workflows/CreateOnlineDevelopmentEnvironment.yaml
@@ -26,9 +26,10 @@ on:
default: false
permissions:
+ actions: read
contents: write
- pull-requests: write
id-token: write
+ pull-requests: write
defaults:
run:
@@ -44,9 +45,9 @@ jobs:
runs-on: [ windows-latest ]
outputs:
deviceCode: ${{ steps.authenticate.outputs.deviceCode }}
- telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
githubRunner: ${{ steps.ReadSettings.outputs.GitHubRunnerJson }}
githubRunnerShell: ${{ steps.ReadSettings.outputs.GitHubRunnerShell }}
+ telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
steps:
- name: Dump Workflow Information
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
@@ -61,7 +62,6 @@ jobs:
uses: microsoft/AL-Go-Actions/WorkflowInitialize@main
with:
shell: powershell
- eventId: "DO0093"
- name: Read settings
id: ReadSettings
@@ -141,7 +141,6 @@ jobs:
with:
shell: powershell
token: ${{ steps.ReadSecrets.outputs.TokenForPush }}
- parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
environmentName: ${{ github.event.inputs.environmentName }}
project: ${{ github.event.inputs.project }}
reUseExistingEnvironment: ${{ github.event.inputs.reUseExistingEnvironment }}
@@ -151,7 +150,9 @@ jobs:
- name: Finalize the workflow
if: always()
uses: microsoft/AL-Go-Actions/WorkflowPostProcess@main
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
with:
shell: powershell
- eventId: "DO0093"
telemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
+ currentJobContext: ${{ toJson(job) }}
diff --git a/Templates/Per Tenant Extension/.github/workflows/CreatePerformanceTestApp.yaml b/Templates/Per Tenant Extension/.github/workflows/CreatePerformanceTestApp.yaml
index ee2474995..6966ff7c7 100644
--- a/Templates/Per Tenant Extension/.github/workflows/CreatePerformanceTestApp.yaml
+++ b/Templates/Per Tenant Extension/.github/workflows/CreatePerformanceTestApp.yaml
@@ -38,9 +38,10 @@ on:
default: false
permissions:
+ actions: read
contents: write
- pull-requests: write
id-token: write
+ pull-requests: write
defaults:
run:
@@ -68,7 +69,6 @@ jobs:
uses: microsoft/AL-Go-Actions/WorkflowInitialize@main
with:
shell: powershell
- eventId: "DO0102"
- name: Read settings
uses: microsoft/AL-Go-Actions/ReadSettings@main
@@ -89,7 +89,6 @@ jobs:
with:
shell: powershell
token: ${{ steps.ReadSecrets.outputs.TokenForPush }}
- parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
project: ${{ github.event.inputs.project }}
type: 'Performance Test App'
name: ${{ github.event.inputs.name }}
@@ -102,7 +101,9 @@ jobs:
- name: Finalize the workflow
if: always()
uses: microsoft/AL-Go-Actions/WorkflowPostProcess@main
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
with:
shell: powershell
- eventId: "DO0102"
telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
+ currentJobContext: ${{ toJson(job) }}
diff --git a/Templates/Per Tenant Extension/.github/workflows/CreateRelease.yaml b/Templates/Per Tenant Extension/.github/workflows/CreateRelease.yaml
index a6f0eba89..5cb6d41e4 100644
--- a/Templates/Per Tenant Extension/.github/workflows/CreateRelease.yaml
+++ b/Templates/Per Tenant Extension/.github/workflows/CreateRelease.yaml
@@ -46,10 +46,10 @@ on:
default: false
permissions:
- contents: write
- pull-requests: write
actions: read
+ contents: write
id-token: write
+ pull-requests: write
concurrency: release
@@ -66,11 +66,11 @@ jobs:
needs: [ ]
runs-on: [ windows-latest ]
outputs:
- telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
artifacts: ${{ steps.analyzeartifacts.outputs.artifacts }}
releaseId: ${{ steps.createrelease.outputs.releaseId }}
commitish: ${{ steps.analyzeartifacts.outputs.commitish }}
releaseVersion: ${{ steps.createreleasenotes.outputs.releaseVersion }}
+ telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
steps:
- name: Dump Workflow Information
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
@@ -85,7 +85,6 @@ jobs:
uses: microsoft/AL-Go-Actions/WorkflowInitialize@main
with:
shell: powershell
- eventId: "DO0094"
- name: Read settings
id: ReadSettings
@@ -207,7 +206,6 @@ jobs:
uses: microsoft/AL-Go-Actions/CreateReleaseNotes@main
with:
shell: powershell
- parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
tag_name: ${{ github.event.inputs.tag }}
target_commitish: ${{ steps.analyzeartifacts.outputs.commitish }}
@@ -366,7 +364,6 @@ jobs:
with:
shell: powershell
token: ${{ steps.ReadSecrets.outputs.TokenForPush }}
- parentTelemetryScopeJson: ${{ needs.CreateRelease.outputs.telemetryScopeJson }}
versionNumber: ${{ github.event.inputs.updateVersionNumber }}
directCommit: ${{ github.event.inputs.directCommit }}
@@ -381,7 +378,9 @@ jobs:
- name: Finalize the workflow
id: PostProcess
uses: microsoft/AL-Go-Actions/WorkflowPostProcess@main
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
with:
shell: powershell
- eventId: "DO0094"
telemetryScopeJson: ${{ needs.CreateRelease.outputs.telemetryScopeJson }}
+ currentJobContext: ${{ toJson(job) }}
diff --git a/Templates/Per Tenant Extension/.github/workflows/CreateTestApp.yaml b/Templates/Per Tenant Extension/.github/workflows/CreateTestApp.yaml
index 524c235c0..beeed7a91 100644
--- a/Templates/Per Tenant Extension/.github/workflows/CreateTestApp.yaml
+++ b/Templates/Per Tenant Extension/.github/workflows/CreateTestApp.yaml
@@ -34,9 +34,10 @@ on:
default: false
permissions:
+ actions: read
contents: write
- pull-requests: write
id-token: write
+ pull-requests: write
defaults:
run:
@@ -64,7 +65,6 @@ jobs:
uses: microsoft/AL-Go-Actions/WorkflowInitialize@main
with:
shell: powershell
- eventId: "DO0095"
- name: Read settings
uses: microsoft/AL-Go-Actions/ReadSettings@main
@@ -85,7 +85,6 @@ jobs:
with:
shell: powershell
token: ${{ steps.ReadSecrets.outputs.TokenForPush }}
- parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
project: ${{ github.event.inputs.project }}
type: 'Test App'
name: ${{ github.event.inputs.name }}
@@ -97,7 +96,9 @@ jobs:
- name: Finalize the workflow
if: always()
uses: microsoft/AL-Go-Actions/WorkflowPostProcess@main
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
with:
shell: powershell
- eventId: "DO0095"
telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
+ currentJobContext: ${{ toJson(job) }}
diff --git a/Templates/Per Tenant Extension/.github/workflows/Current.yaml b/Templates/Per Tenant Extension/.github/workflows/Current.yaml
index 4da7bfc47..a485d6601 100644
--- a/Templates/Per Tenant Extension/.github/workflows/Current.yaml
+++ b/Templates/Per Tenant Extension/.github/workflows/Current.yaml
@@ -4,8 +4,8 @@ on:
workflow_dispatch:
permissions:
- contents: read
actions: read
+ contents: read
id-token: write
defaults:
@@ -22,13 +22,13 @@ jobs:
needs: [ ]
runs-on: [ windows-latest ]
outputs:
- telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
githubRunner: ${{ steps.ReadSettings.outputs.GitHubRunnerJson }}
githubRunnerShell: ${{ steps.ReadSettings.outputs.GitHubRunnerShell }}
projects: ${{ steps.determineProjectsToBuild.outputs.ProjectsJson }}
projectDependenciesJson: ${{ steps.determineProjectsToBuild.outputs.ProjectDependenciesJson }}
buildOrderJson: ${{ steps.determineProjectsToBuild.outputs.BuildOrderJson }}
workflowDepth: ${{ steps.DetermineWorkflowDepth.outputs.WorkflowDepth }}
+ telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
steps:
- name: Dump Workflow Information
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
@@ -45,7 +45,6 @@ jobs:
uses: microsoft/AL-Go-Actions/WorkflowInitialize@main
with:
shell: powershell
- eventId: "DO0101"
- name: Read settings
id: ReadSettings
@@ -78,7 +77,6 @@ jobs:
with:
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
runsOn: ${{ needs.Initialization.outputs.githubRunner }}
- parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
project: ${{ matrix.project }}
projectName: ${{ matrix.projectName }}
buildMode: ${{ matrix.buildMode }}
@@ -98,7 +96,9 @@ jobs:
- name: Finalize the workflow
id: PostProcess
uses: microsoft/AL-Go-Actions/WorkflowPostProcess@main
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
with:
shell: powershell
- eventId: "DO0101"
telemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
+ currentJobContext: ${{ toJson(job) }}
diff --git a/Templates/Per Tenant Extension/.github/workflows/DeployReferenceDocumentation.yaml b/Templates/Per Tenant Extension/.github/workflows/DeployReferenceDocumentation.yaml
index 1912739c0..bde6cfe3f 100644
--- a/Templates/Per Tenant Extension/.github/workflows/DeployReferenceDocumentation.yaml
+++ b/Templates/Per Tenant Extension/.github/workflows/DeployReferenceDocumentation.yaml
@@ -4,10 +4,10 @@ on:
workflow_dispatch:
permissions:
- contents: read
actions: read
- pages: write
+ contents: read
id-token: write
+ pages: write
defaults:
run:
@@ -33,7 +33,6 @@ jobs:
uses: microsoft/AL-Go-Actions/WorkflowInitialize@main
with:
shell: powershell
- eventId: "DO0097"
- name: Read settings
uses: microsoft/AL-Go-Actions/ReadSettings@main
@@ -69,3 +68,13 @@ jobs:
if: steps.DetermineDeploymentEnvironments.outputs.deployALDocArtifact == 1
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5
+
+ - name: Finalize the workflow
+ if: always()
+ uses: microsoft/AL-Go-Actions/WorkflowPostProcess@main
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
+ with:
+ shell: powershell
+ telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
+ currentJobContext: ${{ toJson(job) }}
diff --git a/Templates/Per Tenant Extension/.github/workflows/IncrementVersionNumber.yaml b/Templates/Per Tenant Extension/.github/workflows/IncrementVersionNumber.yaml
index 20e9aa5a4..a2c326b12 100644
--- a/Templates/Per Tenant Extension/.github/workflows/IncrementVersionNumber.yaml
+++ b/Templates/Per Tenant Extension/.github/workflows/IncrementVersionNumber.yaml
@@ -22,9 +22,10 @@ on:
default: false
permissions:
+ actions: read
contents: write
- pull-requests: write
id-token: write
+ pull-requests: write
defaults:
run:
@@ -52,7 +53,6 @@ jobs:
uses: microsoft/AL-Go-Actions/WorkflowInitialize@main
with:
shell: powershell
- eventId: "DO0096"
- name: Read settings
uses: microsoft/AL-Go-Actions/ReadSettings@main
@@ -73,7 +73,6 @@ jobs:
with:
shell: powershell
token: ${{ steps.ReadSecrets.outputs.TokenForPush }}
- parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
projects: ${{ github.event.inputs.projects }}
versionNumber: ${{ github.event.inputs.versionNumber }}
directCommit: ${{ github.event.inputs.directCommit }}
@@ -81,7 +80,9 @@ jobs:
- name: Finalize the workflow
if: always()
uses: microsoft/AL-Go-Actions/WorkflowPostProcess@main
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
with:
shell: powershell
- eventId: "DO0096"
telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
+ currentJobContext: ${{ toJson(job) }}
diff --git a/Templates/Per Tenant Extension/.github/workflows/NextMajor.yaml b/Templates/Per Tenant Extension/.github/workflows/NextMajor.yaml
index 5ba614151..1f2d1fb65 100644
--- a/Templates/Per Tenant Extension/.github/workflows/NextMajor.yaml
+++ b/Templates/Per Tenant Extension/.github/workflows/NextMajor.yaml
@@ -4,8 +4,8 @@ on:
workflow_dispatch:
permissions:
- contents: read
actions: read
+ contents: read
id-token: write
defaults:
@@ -22,13 +22,13 @@ jobs:
needs: [ ]
runs-on: [ windows-latest ]
outputs:
- telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
githubRunner: ${{ steps.ReadSettings.outputs.GitHubRunnerJson }}
githubRunnerShell: ${{ steps.ReadSettings.outputs.GitHubRunnerShell }}
projects: ${{ steps.determineProjectsToBuild.outputs.ProjectsJson }}
projectDependenciesJson: ${{ steps.determineProjectsToBuild.outputs.ProjectDependenciesJson }}
buildOrderJson: ${{ steps.determineProjectsToBuild.outputs.BuildOrderJson }}
workflowDepth: ${{ steps.DetermineWorkflowDepth.outputs.WorkflowDepth }}
+ telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
steps:
- name: Dump Workflow Information
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
@@ -45,7 +45,6 @@ jobs:
uses: microsoft/AL-Go-Actions/WorkflowInitialize@main
with:
shell: powershell
- eventId: "DO0099"
- name: Read settings
id: ReadSettings
@@ -78,7 +77,6 @@ jobs:
with:
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
runsOn: ${{ needs.Initialization.outputs.githubRunner }}
- parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
project: ${{ matrix.project }}
projectName: ${{ matrix.projectName }}
buildMode: ${{ matrix.buildMode }}
@@ -98,7 +96,9 @@ jobs:
- name: Finalize the workflow
id: PostProcess
uses: microsoft/AL-Go-Actions/WorkflowPostProcess@main
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
with:
shell: powershell
- eventId: "DO0099"
telemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
+ currentJobContext: ${{ toJson(job) }}
diff --git a/Templates/Per Tenant Extension/.github/workflows/NextMinor.yaml b/Templates/Per Tenant Extension/.github/workflows/NextMinor.yaml
index a175730e7..ecc312651 100644
--- a/Templates/Per Tenant Extension/.github/workflows/NextMinor.yaml
+++ b/Templates/Per Tenant Extension/.github/workflows/NextMinor.yaml
@@ -4,8 +4,8 @@ on:
workflow_dispatch:
permissions:
- contents: read
actions: read
+ contents: read
id-token: write
defaults:
@@ -22,13 +22,13 @@ jobs:
needs: [ ]
runs-on: [ windows-latest ]
outputs:
- telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
githubRunner: ${{ steps.ReadSettings.outputs.GitHubRunnerJson }}
githubRunnerShell: ${{ steps.ReadSettings.outputs.GitHubRunnerShell }}
projects: ${{ steps.determineProjectsToBuild.outputs.ProjectsJson }}
projectDependenciesJson: ${{ steps.determineProjectsToBuild.outputs.ProjectDependenciesJson }}
buildOrderJson: ${{ steps.determineProjectsToBuild.outputs.BuildOrderJson }}
workflowDepth: ${{ steps.DetermineWorkflowDepth.outputs.WorkflowDepth }}
+ telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
steps:
- name: Dump Workflow Information
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
@@ -45,7 +45,6 @@ jobs:
uses: microsoft/AL-Go-Actions/WorkflowInitialize@main
with:
shell: powershell
- eventId: "DO0100"
- name: Read settings
id: ReadSettings
@@ -78,7 +77,6 @@ jobs:
with:
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
runsOn: ${{ needs.Initialization.outputs.githubRunner }}
- parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
project: ${{ matrix.project }}
projectName: ${{ matrix.projectName }}
buildMode: ${{ matrix.buildMode }}
@@ -98,7 +96,9 @@ jobs:
- name: Finalize the workflow
id: PostProcess
uses: microsoft/AL-Go-Actions/WorkflowPostProcess@main
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
with:
shell: powershell
- eventId: "DO0100"
telemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
+ currentJobContext: ${{ toJson(job) }}
diff --git a/Templates/Per Tenant Extension/.github/workflows/PublishToEnvironment.yaml b/Templates/Per Tenant Extension/.github/workflows/PublishToEnvironment.yaml
index 6858dcf01..4e984321a 100644
--- a/Templates/Per Tenant Extension/.github/workflows/PublishToEnvironment.yaml
+++ b/Templates/Per Tenant Extension/.github/workflows/PublishToEnvironment.yaml
@@ -12,8 +12,8 @@ on:
required: true
permissions:
- contents: read
actions: read
+ contents: read
id-token: write
defaults:
@@ -29,11 +29,11 @@ jobs:
needs: [ ]
runs-on: [ windows-latest ]
outputs:
- telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
environmentsMatrixJson: ${{ steps.DetermineDeploymentEnvironments.outputs.EnvironmentsMatrixJson }}
environmentCount: ${{ steps.DetermineDeploymentEnvironments.outputs.EnvironmentCount }}
deploymentEnvironmentsJson: ${{ steps.DetermineDeploymentEnvironments.outputs.DeploymentEnvironmentsJson }}
deviceCode: ${{ steps.Authenticate.outputs.deviceCode }}
+ telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
steps:
- name: Dump Workflow Information
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
@@ -48,7 +48,6 @@ jobs:
uses: microsoft/AL-Go-Actions/WorkflowInitialize@main
with:
shell: powershell
- eventId: "DO0097"
- name: Read settings
id: ReadSettings
@@ -196,7 +195,9 @@ jobs:
- name: Finalize the workflow
id: PostProcess
uses: microsoft/AL-Go-Actions/WorkflowPostProcess@main
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
with:
shell: ${{ matrix.shell }}
- eventId: "DO0097"
telemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
+ currentJobContext: ${{ toJson(job) }}
diff --git a/Templates/Per Tenant Extension/.github/workflows/PullPowerPlatformChanges.yaml b/Templates/Per Tenant Extension/.github/workflows/PullPowerPlatformChanges.yaml
index 44adba60a..a22e99ee1 100644
--- a/Templates/Per Tenant Extension/.github/workflows/PullPowerPlatformChanges.yaml
+++ b/Templates/Per Tenant Extension/.github/workflows/PullPowerPlatformChanges.yaml
@@ -19,9 +19,10 @@ on:
default: false
permissions:
+ actions: read
contents: write
- pull-requests: write
id-token: write
+ pull-requests: write
defaults:
run:
@@ -40,7 +41,6 @@ jobs:
uses: microsoft/AL-Go-Actions/WorkflowInitialize@main
with:
shell: powershell
- eventId: "DO0103"
- name: EnvName
env:
@@ -103,7 +103,9 @@ jobs:
- name: Finalize the workflow
if: always()
uses: microsoft/AL-Go-Actions/WorkflowPostProcess@main
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
with:
shell: powershell
- eventId: "DO0103"
telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
+ currentJobContext: ${{ toJson(job) }}
diff --git a/Templates/Per Tenant Extension/.github/workflows/PullRequestHandler.yaml b/Templates/Per Tenant Extension/.github/workflows/PullRequestHandler.yaml
index 806bd56c0..3bfdf3318 100644
--- a/Templates/Per Tenant Extension/.github/workflows/PullRequestHandler.yaml
+++ b/Templates/Per Tenant Extension/.github/workflows/PullRequestHandler.yaml
@@ -13,10 +13,10 @@ defaults:
shell: powershell
permissions:
- contents: read
actions: read
- pull-requests: read
+ contents: read
id-token: write
+ pull-requests: read
env:
workflowDepth: 1
@@ -35,7 +35,6 @@ jobs:
if: (!failure() && !cancelled())
runs-on: [ windows-latest ]
outputs:
- telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
githubRunner: ${{ steps.ReadSettings.outputs.GitHubRunnerJson }}
githubRunnerShell: ${{ steps.ReadSettings.outputs.GitHubRunnerShell }}
projects: ${{ steps.determineProjectsToBuild.outputs.ProjectsJson }}
@@ -43,6 +42,7 @@ jobs:
buildOrderJson: ${{ steps.determineProjectsToBuild.outputs.BuildOrderJson }}
baselineWorkflowRunId: ${{ steps.determineProjectsToBuild.outputs.BaselineWorkflowRunId }}
workflowDepth: ${{ steps.DetermineWorkflowDepth.outputs.WorkflowDepth }}
+ telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
steps:
- name: Dump Workflow Information
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
@@ -60,7 +60,6 @@ jobs:
uses: microsoft/AL-Go-Actions/WorkflowInitialize@main
with:
shell: powershell
- eventId: "DO0104"
- name: Read settings
id: ReadSettings
@@ -94,7 +93,6 @@ jobs:
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
runsOn: ${{ needs.Initialization.outputs.githubRunner }}
checkoutRef: ${{ github.event_name == 'pull_request' && github.sha || format('refs/pull/{0}/merge', github.event.pull_request.number) }}
- parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
project: ${{ matrix.project }}
projectName: ${{ matrix.projectName }}
buildMode: ${{ matrix.buildMode }}
@@ -117,3 +115,13 @@ jobs:
GITHUB_TOKEN: ${{ github.token }}
with:
shell: powershell
+
+ - name: Finalize the workflow
+ id: PostProcess
+ uses: microsoft/AL-Go-Actions/WorkflowPostProcess@main
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
+ with:
+ shell: powershell
+ telemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
+ currentJobContext: ${{ toJson(job) }}
diff --git a/Templates/Per Tenant Extension/.github/workflows/PushPowerPlatformChanges.yaml b/Templates/Per Tenant Extension/.github/workflows/PushPowerPlatformChanges.yaml
index 8a7b1d59a..2e5b90edf 100644
--- a/Templates/Per Tenant Extension/.github/workflows/PushPowerPlatformChanges.yaml
+++ b/Templates/Per Tenant Extension/.github/workflows/PushPowerPlatformChanges.yaml
@@ -11,6 +11,7 @@ on:
required: false
permissions:
+ actions: read
contents: read
id-token: write
@@ -31,7 +32,6 @@ jobs:
uses: microsoft/AL-Go-Actions/WorkflowInitialize@main
with:
shell: powershell
- eventId: "DO0103"
- name: EnvName
env:
@@ -92,7 +92,9 @@ jobs:
- name: Finalize the workflow
if: always()
uses: microsoft/AL-Go-Actions/WorkflowPostProcess@main
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
with:
shell: powershell
- eventId: "DO0103"
telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
+ currentJobContext: ${{ toJson(job) }}
diff --git a/Templates/Per Tenant Extension/.github/workflows/Troubleshooting.yaml b/Templates/Per Tenant Extension/.github/workflows/Troubleshooting.yaml
index f421efa7d..258a20c8a 100644
--- a/Templates/Per Tenant Extension/.github/workflows/Troubleshooting.yaml
+++ b/Templates/Per Tenant Extension/.github/workflows/Troubleshooting.yaml
@@ -9,8 +9,8 @@ on:
default: false
permissions:
- contents: read
actions: read
+ contents: read
defaults:
run:
diff --git a/Templates/Per Tenant Extension/.github/workflows/UpdateGitHubGoSystemFiles.yaml b/Templates/Per Tenant Extension/.github/workflows/UpdateGitHubGoSystemFiles.yaml
index 5e2b74798..9ded4de35 100644
--- a/Templates/Per Tenant Extension/.github/workflows/UpdateGitHubGoSystemFiles.yaml
+++ b/Templates/Per Tenant Extension/.github/workflows/UpdateGitHubGoSystemFiles.yaml
@@ -17,6 +17,7 @@ on:
default: false
permissions:
+ actions: read
contents: read
id-token: write
@@ -47,7 +48,6 @@ jobs:
uses: microsoft/AL-Go-Actions/WorkflowInitialize@main
with:
shell: powershell
- eventId: "DO0098"
- name: Read settings
uses: microsoft/AL-Go-Actions/ReadSettings@main
@@ -105,7 +105,9 @@ jobs:
- name: Finalize the workflow
if: always()
uses: microsoft/AL-Go-Actions/WorkflowPostProcess@main
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
with:
shell: powershell
- eventId: "DO0098"
telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
+ currentJobContext: ${{ toJson(job) }}
diff --git a/Templates/Per Tenant Extension/.github/workflows/_BuildALGoProject.yaml b/Templates/Per Tenant Extension/.github/workflows/_BuildALGoProject.yaml
index 56034725f..cafa9d978 100644
--- a/Templates/Per Tenant Extension/.github/workflows/_BuildALGoProject.yaml
+++ b/Templates/Per Tenant Extension/.github/workflows/_BuildALGoProject.yaml
@@ -67,14 +67,10 @@ on:
description: Flag determining whether to use the Artifacts Cache
type: boolean
default: false
- parentTelemetryScopeJson:
- description: Specifies the telemetry scope for the telemetry signal
- required: false
- type: string
permissions:
- contents: read
actions: read
+ contents: read
id-token: write
env:
@@ -117,7 +113,6 @@ jobs:
id: determineArtifactUrl
with:
shell: ${{ inputs.shell }}
- parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }}
project: ${{ inputs.project }}
- name: Cache Business Central Artifacts
@@ -146,7 +141,6 @@ jobs:
BuildMode: ${{ inputs.buildMode }}
with:
shell: ${{ inputs.shell }}
- parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }}
artifact: ${{ env.artifact }}
project: ${{ inputs.project }}
buildMode: ${{ inputs.buildMode }}
@@ -161,7 +155,6 @@ jobs:
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
azureCredentialsJson: '${{ fromJson(steps.ReadSecrets.outputs.Secrets).AZURE_CREDENTIALS }}'
pathToFiles: '${{ inputs.project }}/.buildartifacts/Apps/*.app'
- parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
- name: Calculate Artifact names
id: calculateArtifactsNames
@@ -262,7 +255,6 @@ jobs:
uses: microsoft/AL-Go-Actions/AnalyzeTests@main
with:
shell: ${{ inputs.shell }}
- parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }}
project: ${{ inputs.project }}
- name: Cleanup
@@ -270,5 +262,4 @@ jobs:
uses: microsoft/AL-Go-Actions/PipelineCleanup@main
with:
shell: ${{ inputs.shell }}
- parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }}
project: ${{ inputs.project }}
diff --git a/Tests/CheckForUpdates.Action.Test.ps1 b/Tests/CheckForUpdates.Action.Test.ps1
index ea3cb62b7..0fd0517a5 100644
--- a/Tests/CheckForUpdates.Action.Test.ps1
+++ b/Tests/CheckForUpdates.Action.Test.ps1
@@ -30,7 +30,7 @@ Describe "CheckForUpdates Action Tests" {
$yaml = [Yaml]::load((Join-Path $PSScriptRoot 'YamlSnippet.txt'))
# Yaml file should have 77 entries
- $yaml.content.Count | Should -be 77
+ $yaml.content.Count | Should -be 73
$start = 0; $count = 0
# Locate lines for permissions section (including permissions: line)
@@ -60,8 +60,8 @@ Describe "CheckForUpdates Action Tests" {
# Locate CheckForUpdates
$jobsYaml.Find('CheckForUpdates:', [ref] $start, [ref] $count) | Should -be $true
- $start | Should -be 25
- $count | Should -be 21
+ $start | Should -be 23
+ $count | Should -be 19
# Replace all occurances of 'shell: powershell' with 'shell: pwsh'
$yaml.ReplaceAll('shell: powershell','shell: pwsh')
@@ -70,7 +70,7 @@ Describe "CheckForUpdates Action Tests" {
# Replace Permissions
$yaml.Replace('Permissions:/',@('contents: write','actions: read'))
$yaml.content[44].Trim() | Should -be 'shell: pwsh'
- $yaml.content.Count | Should -be 75
+ $yaml.content.Count | Should -be 71
# Get Jobs section (without the jobs: line)
$jobsYaml = $yaml.Get('jobs:/')
diff --git a/Tests/CreateReleaseNotes.Test.ps1 b/Tests/CreateReleaseNotes.Test.ps1
index 6da6168f7..78b47748c 100644
--- a/Tests/CreateReleaseNotes.Test.ps1
+++ b/Tests/CreateReleaseNotes.Test.ps1
@@ -2,8 +2,6 @@
Import-Module (Join-Path $PSScriptRoot '..\Actions\Github-Helper.psm1' -Resolve)
Get-Module TestActionsHelper | Remove-Module -Force
Import-Module (Join-Path $PSScriptRoot 'TestActionsHelper.psm1')
-Get-Module TelemetryHelper | Remove-Module -Force
-Import-Module (Join-Path $PSScriptRoot '..\Actions\TelemetryHelper.psm1')
$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
Describe 'CreateReleaseNotes Tests' {
@@ -45,9 +43,8 @@ Describe 'CreateReleaseNotes Tests' {
""body"": ""Mocked notes""
}" }
Mock DownloadAndImportBcContainerHelper {}
- Mock CreateScope {}
- . $scriptPath -token "" -tag_name "1.0.5" -parentTelemetryScopeJson "{}"
+ . $scriptPath -token "" -tag_name "1.0.5"
Should -Invoke -CommandName GetLatestRelease -Exactly -Times 1
Should -Invoke -CommandName GetReleaseNotes -Exactly -Times 1 -ParameterFilter { $tag_name -eq "1.0.5" -and $previous_tag_name -eq "1.0.0.0" }
@@ -62,9 +59,8 @@ Describe 'CreateReleaseNotes Tests' {
""body"": ""Mocked notes""
}"}
Mock DownloadAndImportBcContainerHelper {}
- Mock CreateScope {}
- . $scriptPath -token "" -tag_name "1.0.5" -parentTelemetryScopeJson "{}"
+ . $scriptPath -token "" -tag_name "1.0.5"
Should -Invoke -CommandName GetLatestRelease -Exactly -Times 1
Should -Invoke -CommandName GetReleaseNotes -Exactly -Times 1 -ParameterFilter { $tag_name -eq "1.0.5" -and $previous_tag_name -eq "" }
diff --git a/Tests/TestActionsHelper.psm1 b/Tests/TestActionsHelper.psm1
index b5b15b449..01df7098a 100644
--- a/Tests/TestActionsHelper.psm1
+++ b/Tests/TestActionsHelper.psm1
@@ -148,14 +148,9 @@ function YamlTest {
else {
$yaml.AppendLine(" run: |") | Out-Null
}
- $yaml.AppendLine(' $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0') | Out-Null
- $yaml.AppendLine(" try {") | Out-Null
+ $yaml.AppendLine(" `${{ github.action_path }}/../Invoke-AlGoAction.ps1 -ActionName `"$actionName`" -Action {") | Out-Null
$yaml.AppendLine(" `${{ github.action_path }}/$actionName.ps1$parameterString") | Out-Null
$yaml.AppendLine(" }") | Out-Null
- $yaml.AppendLine(" catch {") | Out-Null
- $yaml.AppendLine(' Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'''').Replace("`n",'' '')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'''').Replace("`n",'' <- ''))";') | Out-Null
- $yaml.AppendLine(" exit 1") | Out-Null
- $yaml.AppendLine(" }") | Out-Null
$yaml.AppendLine("branding:") | Out-Null
$yaml.AppendLine(" icon: terminal") | Out-Null
$yaml.Append(" color: blue") | Out-Null
diff --git a/Tests/WorkflowInitialize.Test.ps1 b/Tests/WorkflowInitialize.Test.ps1
index 9bc279049..0de30f75e 100644
--- a/Tests/WorkflowInitialize.Test.ps1
+++ b/Tests/WorkflowInitialize.Test.ps1
@@ -21,7 +21,6 @@ Describe "WorkflowInitialize Action Tests" {
$permissions = [ordered]@{
}
$outputs = [ordered]@{
- "correlationId" = "A correlation Id for the workflow"
"telemetryScopeJson" = "A telemetryScope that covers the workflow"
}
YamlTest -scriptRoot $scriptRoot -actionName $actionName -actionScript $actionScript -permissions $permissions -outputs $outputs
diff --git a/Tests/YamlSnippet.txt b/Tests/YamlSnippet.txt
index 9df445fbf..2e6dcdc08 100644
--- a/Tests/YamlSnippet.txt
+++ b/Tests/YamlSnippet.txt
@@ -45,14 +45,12 @@ jobs:
uses: microsoft/AL-Go-Actions/WorkflowInitialize@main
with:
shell: powershell
- eventId: "DO0091"
- name: Read settings
id: ReadSettings
uses: microsoft/AL-Go-Actions/ReadSettings@main
with:
shell: powershell
- parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
CheckForUpdates:
runs-on: [ windows-latest ]
@@ -66,12 +64,10 @@ jobs:
uses: microsoft/AL-Go-Actions/ReadSettings@main
with:
shell: powershell
- parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
get: templateUrl
- name: Check for updates to AL-Go system files
uses: microsoft/AL-Go-Actions/CheckForUpdates@main
with:
shell: powershell
- parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
templateUrl: ${{ env.templateUrl }}