diff --git a/.github/workflows/CleanupTempRepos.yaml b/.github/workflows/CleanupTempRepos.yaml index d1238e54b..c9cf4491c 100644 --- a/.github/workflows/CleanupTempRepos.yaml +++ b/.github/workflows/CleanupTempRepos.yaml @@ -1,4 +1,4 @@ -name: Cleanup after failed E2E +name: Cleanup after failed E2E on: workflow_dispatch: diff --git a/.github/workflows/Deploy.yaml b/.github/workflows/Deploy.yaml index 140051393..1372a0cf9 100644 --- a/.github/workflows/Deploy.yaml +++ b/.github/workflows/Deploy.yaml @@ -16,7 +16,7 @@ on: directCommit: type: boolean description: Push directly to the target branch. If not set, a PR will be created. - required: false + required: false default: false defaultBcContainerHelperVersion: description: 'Which version of BcContainerHelper to use? (latest, preview, private, a specific version number or a direct download URL like https://github.com/freddydk/navcontainerhelper/archive/master.zip - leave empty to use latest)' @@ -34,11 +34,11 @@ jobs: steps: - name: Validate Deployment if: github.repository_owner == 'microsoft' - env: + env: branch: ${{ github.event.inputs.branch }} repository: ${{ github.repository }} runId: ${{ github.run_id }} - run: | + run: | if ($env:branch -match 'preview') { Write-Host "Deploying to preview branch. No validation required" } else { diff --git a/.github/workflows/E2E.yaml b/.github/workflows/E2E.yaml index 3304d4184..155256485 100644 --- a/.github/workflows/E2E.yaml +++ b/.github/workflows/E2E.yaml @@ -103,7 +103,7 @@ jobs: run: | $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0 . (Join-Path "." "e2eTests/SetupRepositories.ps1") -github -githubOwner '${{ needs.Check.outputs.githubowner }}' -token '${{ Secrets.E2EPAT }}' -bcContainerHelperVersion '${{ github.event.inputs.bcContainerHelperVersion }}' - + Analyze: runs-on: [ ubuntu-latest ] needs: [ Check ] @@ -127,8 +127,8 @@ jobs: $testrunsJson = @{ "matrix" = @{ - "include" = @( - @('private','public') | ForEach-Object { + "include" = @( + @('private','public') | ForEach-Object { $visibility = $_ @('appSourceApp','PTE') | ForEach-Object { $type = $_ diff --git a/Actions/AL-Go-Helper.ps1 b/Actions/AL-Go-Helper.ps1 index 108e20d05..34e597a24 100644 --- a/Actions/AL-Go-Helper.ps1 +++ b/Actions/AL-Go-Helper.ps1 @@ -1,4 +1,4 @@ -Param( +Param( [switch] $local ) @@ -62,8 +62,11 @@ if ($isPsCore) { else { $byteEncodingParam = @{ "Encoding" = "byte" } $allowUnencryptedAuthenticationParam = @{ } + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidAssignmentToAutomaticVariable', 'isWindows', Justification = 'Will only run on PS5')] $isWindows = $true + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidAssignmentToAutomaticVariable', 'isLinux', Justification = 'Will only run on PS5')] $isLinux = $false + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidAssignmentToAutomaticVariable', 'isMacOS', Justification = 'Will only run on PS5')] $IsMacOS = $false } @@ -1603,9 +1606,6 @@ function CreateDevEnv { throw "$_ is an illegal property in adminCenterApiCredentials setting" } } - if ($adminCenterApiCredentials.Keys -contains 'ClientSecret') { - $adminCenterApiCredentials.ClientSecret = ConvertTo-SecureString -String $adminCenterApiCredentials.ClientSecret -AsPlainText -Force - } } } } diff --git a/Actions/AL-Go-TestRepoHelper.ps1 b/Actions/AL-Go-TestRepoHelper.ps1 index 915dfca08..134237e95 100644 --- a/Actions/AL-Go-TestRepoHelper.ps1 +++ b/Actions/AL-Go-TestRepoHelper.ps1 @@ -1,4 +1,4 @@ -function Test-Property { +function Test-Property { Param( [HashTable] $json, [string] $settingsDescription, @@ -71,7 +71,7 @@ function Test-Json { # templateUrl should not be in Project or Workflow settings Test-Property -settingsDescription $settingsDescription -json $json -key 'templateUrl' -maynot - # schedules and runs-on should not be in Project or Workflow settings + # schedules and runs-on should not be in Project or Workflow settings 'nextMajorSchedule','nextMinorSchedule','currentSchedule','githubRunner','runs-on' | ForEach-Object { Test-Property -settingsDescription $settingsDescription -json $json -key $_ -shouldnot } @@ -118,7 +118,7 @@ function Test-ALGoRepository { Param( [string] $baseFolder = $ENV:GITHUB_WORKSPACE ) - + if ($ENV:ALGoOrgSettings) { Write-Host "Checking AL-Go Org Settings variable (ALGoOrgSettings)" Test-JsonStr -jsonStr "$ENV:ALGoOrgSettings" -settingsDescription 'ALGoOrgSettings variable' -type 'Variable' @@ -149,141 +149,140 @@ function Test-ALGoRepository { } function Write-Big { -Param( - [string] $str -) -$chars = @{ -"0" = @' - ___ - / _ \ - | | | | - | | | | - | |_| | - \___/ -'@.Split("`n") -"1" = @' - __ - /_ | - | | - | | - | | - |_| -'@.Split("`n") -"2" = @' - ___ - |__ \ - ) | - / / - / /_ - |____| -'@.Split("`n") -"3" = @' - ____ - |___ \ - __) | - |__ < - ___) | - |____/ -'@.Split("`n") -"4" = @' - _ _ - | || | - | || |_ - |__ _| - | | - |_| -'@.Split("`n") -"5" = @' - _____ - | ____| - | |__ - |___ \ - ___) | - |____/ -'@.Split("`n") -"6" = @' - __ - / / - / /_ - | '_ \ - | (_) | - \___/ -'@.Split("`n") -"7" = @' - ______ - |____ | - / / - / / - / / - /_/ -'@.Split("`n") -"8" = @' - ___ - / _ \ - | (_) | - > _ < - | (_) | - \___/ -'@.Split("`n") -"9" = @' - ___ - / _ \ - | (_) | - \__, | - / / - /_/ -'@.Split("`n") -"." = @' - - - - - _ - (_) -'@.Split("`n") -"v" = @' - - - __ __ - \ \ / / - \ V / - \_(_) -'@.Split("`n") -"p" = @' - _____ _ - | __ \ (_) - | |__) | __ _____ ___ _____ __ - | ___/ '__/ _ \ \ / / |/ _ \ \ /\ / / - | | | | | __/\ V /| | __/\ V V / - |_| |_| \___| \_/ |_|\___| \_/\_/ -'@.Split("`n") -"d" = @' - _____ - | __ \ - | | | | _____ __ - | | | |/ _ \ \ / / - | |__| | __/\ V / - |_____/ \___| \_(_) -'@.Split("`n") -"a" = @' - _ _____ __ _____ _ _ _ _ _ - /\ | | / ____| / _| / ____(_) | | | | | | | - / \ | | ______| | __ ___ | |_ ___ _ __ | | __ _| |_| |__| |_ _| |__ - / /\ \ | | |______| | |_ |/ _ \ | _/ _ \| '__| | | |_ | | __| __ | | | | '_ \ - / ____ \| |____ | |__| | (_) | | || (_) | | | |__| | | |_| | | | |_| | |_) | - /_/ \_\______| \_____|\___/ |_| \___/|_| \_____|_|\__|_| |_|\__,_|_.__/ -'@.Split("`n") -} - + Param( + [string] $str + ) + $chars = @{ + "0" = @( + " ___ " + " / _ \ " + "| | | |" + "| | | |" + "| |_| |" + " \___/ " + ) + "1" = @( + " __ " + "/_ |" + " | |" + " | |" + " | |" + " |_|" + ) + "2" = @( + " ___ " + "|__ \ " + " ) |" + " / / " + " / /_ " + "|____|" + ) + "3" = @( + " ____ " + "|___ \ " + " __) |" + " |__ < " + " ___) |" + "|____/ " + ) + "4" = @( + " _ _ " + "| || | " + "| || |_ " + "|__ _|" + " | | " + " |_| " + ) + "5" = @( + " _____ " + "| ____|" + "| |__ " + "|___ \ " + " ___) |" + "|____/ " + ) + "6" = @( + " __ " + " / / " + " / /_ " + "| '_ \ " + "| (_) |" + " \___/ " + ) + "7" = @( + " ______ " + "|____ |" + " / / " + " / / " + " / / " + " /_/ " + ) + "8" = @( + " ___ " + " / _ \ " + "| (_) |" + " > _ < " + "| (_) |" + " \___/ " + ) + "9" = @( + " ___ " + " / _ \ " + "| (_) |" + " \__, |" + " / / " + " /_/ " + ) + "." = @( + " " + " " + " " + " " + " _ " + "(_)" + ) + "v" = @( + " " + " " + "__ __" + "\ \ / /" + " \ V / " + " \_(_)" + ) + "p" = @( + " _____ _ " + "| __ \ (_) " + "| |__) | __ _____ ___ _____ __" + "| ___/ '__/ _ \ \ / / |/ _ \ \ /\ / /" + "| | | | | __/\ V /| | __/\ V V / " + "|_| |_| \___| \_/ |_|\___| \_/\_/ " + ) + "d" = @( + " _____ " + "| __ \ " + "| | | | _____ __" + "| | | |/ _ \ \ / /" + "| |__| | __/\ V / " + "|_____/ \___| \_(_)" + ) + "a" = @( + " _ _____ __ _____ _ _ _ _ _ " + " /\ | | / ____| / _| / ____(_) | | | | | | | " + " / \ | | ______| | __ ___ | |_ ___ _ __ | | __ _| |_| |__| |_ _| |__ " + " / /\ \ | | |______| | |_ |/ _ \ | _/ _ \| '__| | | |_ | | __| __ | | | | '_ \ " + " / ____ \| |____ | |__| | (_) | | || (_) | | | |__| | | |_| | | | |_| | |_) | " + "/_/ \_\______| \_____|\___/ |_| \___/|_| \_____|_|\__|_| |_|\__,_|_.__/ " + ) + } -0..5 | ForEach-Object { - $line = $_ - $str.ToCharArray() | ForEach-Object { - if ($chars.Keys -contains $_) { - $ch = $chars."$_" - Write-Host -noNewline $ch[$line] + $lines = $chars."a".Count + for ($line = 0; $line -lt $lines; $line++) { + foreach ($ch in $str.ToCharArray()) { + if ($chars.Keys -contains $ch) { + $bigCh = $chars."$ch" + Write-Host -noNewline $bigCh[$line] + } } + Write-Host } - Write-Host -} } diff --git a/Actions/AddExistingApp/AddExistingApp.ps1 b/Actions/AddExistingApp/AddExistingApp.ps1 index 2210a827a..c7f0a0620 100644 --- a/Actions/AddExistingApp/AddExistingApp.ps1 +++ b/Actions/AddExistingApp/AddExistingApp.ps1 @@ -1,4 +1,4 @@ -Param( +Param( [Parameter(HelpMessage = "The GitHub actor running the action", Mandatory = $false)] [string] $actor, [Parameter(HelpMessage = "The GitHub token running the action", Mandatory = $false)] @@ -39,11 +39,11 @@ function expandfile { # .zip file $destinationPath = Join-Path ([System.IO.Path]::GetTempPath()) "$([Guid]::NewGuid().ToString())" Expand-7zipArchive -path $path -destinationPath $destinationPath - + $directoryInfo = Get-ChildItem $destinationPath | Measure-Object if ($directoryInfo.count -eq 0) { throw "The file is empty or malformed." - } + } $appFolders = @() if (Test-Path (Join-Path $destinationPath 'app.json')) { @@ -71,7 +71,7 @@ function expandfile { elseif ([string]::new([char[]](Get-Content $path @byteEncodingParam -TotalCount 4)) -eq "NAVX") { $destinationPath = Join-Path ([System.IO.Path]::GetTempPath()) "$([Guid]::NewGuid().ToString())" Extract-AppFileToFolder -appFilename $path -appFolder $destinationPath -generateAppJson - $destinationPath + $destinationPath } else { throw "The provided url cannot be extracted. The url might be wrong or the file is malformed." @@ -92,7 +92,7 @@ try { DownloadAndImportBcContainerHelper -baseFolder $baseFolder import-module (Join-Path -path $PSScriptRoot -ChildPath "..\TelemetryHelper.psm1" -Resolve) - $telemetryScope = CreateScope -eventId 'DO0070' -parentTelemetryScopeJson $parentTelemetryScopeJson + $telemetryScope = CreateScope -eventId 'DO0070' -parentTelemetryScopeJson $parentTelemetryScopeJson $type = "PTE" Write-Host "Reading $RepoSettingsFile" @@ -120,17 +120,17 @@ try { if ($appJson.PSObject.Properties.Name -eq "idRange") { $ranges += @($appJson.idRange) } - + $ttype = "" $ranges | Select-Object -First 1 | ForEach-Object { if ($_.from -lt 100000 -and $_.to -lt 100000) { $ttype = "PTE" } else { - $ttype = "AppSource App" + $ttype = "AppSource App" } } - + if ($appJson.PSObject.Properties.Name -eq "dependencies") { $appJson.dependencies | ForEach-Object { if ($_.PSObject.Properties.Name -eq "AppId") { @@ -139,7 +139,7 @@ try { else { $id = $_.Id } - if ($testRunnerApps.Contains($id)) { + if ($testRunnerApps.Contains($id)) { $ttype = "Test App" } } diff --git a/Actions/AnalyzeTests/AnalyzeTests.ps1 b/Actions/AnalyzeTests/AnalyzeTests.ps1 index 2c8bc596d..58e7e45ed 100644 --- a/Actions/AnalyzeTests/AnalyzeTests.ps1 +++ b/Actions/AnalyzeTests/AnalyzeTests.ps1 @@ -1,4 +1,4 @@ -Param( +Param( [Parameter(HelpMessage = "The GitHub actor running the action", Mandatory = $false)] [string] $actor, [Parameter(HelpMessage = "The GitHub token running the action", Mandatory = $false)] @@ -27,7 +27,7 @@ try { Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "TestResultMD=$testResultSummary" Write-Host "TestResultMD=$testResultSummary" - + Add-Content -path $ENV:GITHUB_STEP_SUMMARY -value "$($testResultSummary.Replace("\n","`n"))`n" } else { diff --git a/Actions/AnalyzeTests/TestResultAnalyzer.ps1 b/Actions/AnalyzeTests/TestResultAnalyzer.ps1 index e999de7f2..5bb648e5a 100644 --- a/Actions/AnalyzeTests/TestResultAnalyzer.ps1 +++ b/Actions/AnalyzeTests/TestResultAnalyzer.ps1 @@ -1,4 +1,4 @@ -function GetTestResultSummary { +function GetTestResultSummary { Param( [xml] $testResults, [int] $includeFailures diff --git a/Actions/CalculateArtifactNames/CalculateArtifactNames.ps1 b/Actions/CalculateArtifactNames/CalculateArtifactNames.ps1 index 03e4a892e..f0478b3b4 100644 --- a/Actions/CalculateArtifactNames/CalculateArtifactNames.ps1 +++ b/Actions/CalculateArtifactNames/CalculateArtifactNames.ps1 @@ -1,4 +1,4 @@ -Param( +Param( [Parameter(HelpMessage = "Name of the built project", Mandatory = $true)] [string] $project, [Parameter(HelpMessage = "Build mode used when building the artifacts", Mandatory = $true)] diff --git a/Actions/CheckForUpdates/CheckForUpdates.ps1 b/Actions/CheckForUpdates/CheckForUpdates.ps1 index e5b24dc6a..6ac2dbca6 100644 --- a/Actions/CheckForUpdates/CheckForUpdates.ps1 +++ b/Actions/CheckForUpdates/CheckForUpdates.ps1 @@ -1,4 +1,4 @@ -Param( +Param( [Parameter(HelpMessage = "The GitHub actor running the action", Mandatory = $false)] [string] $actor, [Parameter(HelpMessage = "The GitHub token running the action", Mandatory = $false)] @@ -14,7 +14,7 @@ Param( [Parameter(HelpMessage = "Set the branch to update", Mandatory = $false)] [string] $updateBranch, [Parameter(HelpMessage = "Direct Commit (Y/N)", Mandatory = $false)] - [bool] $directCommit + [bool] $directCommit ) $telemetryScope = $null @@ -90,7 +90,7 @@ try { Write-Host "Using ArchiveUrl $archiveUrl" # Download the template repository and unpack to a temp folder - $headers = @{ + $headers = @{ "Accept" = "application/vnd.github.baptiste-preview+json" "token" = $token } @@ -98,7 +98,7 @@ try { InvokeWebRequest -Headers $headers -Uri $archiveUrl -OutFile "$tempName.zip" -retry Expand-7zipArchive -Path "$tempName.zip" -DestinationPath $tempName Remove-Item -Path "$tempName.zip" - + # CheckFiles is an array of hashtables with the following properties: # dstPath: The path to the file in the current repository # srcPath: The path to the file in the template repository @@ -157,7 +157,7 @@ try { $buildAlso = @{} $projectDependencies = @{} $projectsOrder = AnalyzeProjectDependencies -baseFolder $baseFolder -projects $projects -buildAlso ([ref]$buildAlso) -projectDependencies ([ref]$projectDependencies) - + $depth = $projectsOrder.Count Write-Host "Calculated dependency depth to be $depth" } @@ -260,7 +260,7 @@ try { if ($depth -gt 1) { # Also, duplicate the build job for each dependency depth - + $build = $yaml.Get('jobs:/Build:/') if($build) { @@ -299,7 +299,7 @@ try { $build.Replace('if:', $if) $build.Replace('needs:', "needs: [ $($needs -join ', ') ]") $build.Replace('strategy:/matrix:/include:',"include: `${{ fromJson(needs.Initialization.outputs.buildOrderJson)[$index].buildDimensions }}") - + # Last build job is called build, all other build jobs are called build1, build2, etc. if ($depth -eq $_) { $newBuild += @("Build:") @@ -328,7 +328,7 @@ try { if ($directALGo) { # If we are using the direct AL-Go repo, we need to change the owner and repo names in the workflow $lines = $srcContent.Split("`n") - + # The Original Owner and Repo in the AL-Go repository are microsoft/AL-Go-Actions, microsoft/AL-Go-PTE and microsoft/AL-Go-AppSource $originalOwnerAndRepo = @{ "actionsRepo" = "microsoft/AL-Go-Actions" @@ -425,7 +425,7 @@ try { # checkout branch to update invoke-git checkout $updateBranch - + # If $directCommit, then changes are made directly to the default branch if (!$directcommit) { # If not direct commit, create a new branch with name, relevant to the current date and base branch, and switch to it diff --git a/Actions/CheckForUpdates/yamlclass.ps1 b/Actions/CheckForUpdates/yamlclass.ps1 index f7db9970b..b4b7b811c 100644 --- a/Actions/CheckForUpdates/yamlclass.ps1 +++ b/Actions/CheckForUpdates/yamlclass.ps1 @@ -1,4 +1,4 @@ -#requires -Version 5.0 +#requires -Version 5.0 # This class holds the content of a Yaml file # The content is stored in an array of strings, where each string is a line of the Yaml file @@ -106,8 +106,8 @@ class Yaml { $c = 0 if ($this.Find($line, [ref] $s, [ref] $c)) { $charCount = ($line.ToCharArray() | Where-Object {$_ -eq '/'} | Measure-Object).Count - [string[]] $result = @($this.content | Select-Object -Skip $s -First $c | ForEach-Object { - "$_$(" "*$charCount)".Substring(2*$charCount).TrimEnd() + [string[]] $result = @($this.content | Select-Object -Skip $s -First $c | ForEach-Object { + "$_$(" "*$charCount)".Substring(2*$charCount).TrimEnd() } ) $start.value = $s $count.value = $c diff --git a/Actions/CreateApp/AppHelper.psm1 b/Actions/CreateApp/AppHelper.psm1 index b4024d963..19221df37 100644 --- a/Actions/CreateApp/AppHelper.psm1 +++ b/Actions/CreateApp/AppHelper.psm1 @@ -4,7 +4,7 @@ This module contains some useful functions for working with app manifests. . (Join-Path -path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve) $here = Split-Path -Parent $MyInvocation.MyCommand.Path -$alTemplatePath = Join-Path -Path $here -ChildPath "AppTemplate" +$alTemplatePath = Join-Path -Path $here -ChildPath "AppTemplate" $validRanges = @{ @@ -14,7 +14,11 @@ $validRanges = @{ "Performance Test App" = "50000..$([int32]::MaxValue)" ; }; -function Confirm-IdRanges([string] $templateType, [string]$idrange ) { +<# +.SYNOPSIS +Check that the IdRange is valid for the template type. +#> +function ConfirmIdRanges([string] $templateType, [string]$idrange ) { $validRange = $validRanges.$templateType.Replace('..', '-').Split("-") $validStart = [int] $validRange[0] $validEnd = [int] $validRange[1] @@ -22,13 +26,13 @@ function Confirm-IdRanges([string] $templateType, [string]$idrange ) { $ids = $idrange.Replace('..', '-').Split("-") $idStart = [int] $ids[0] $idEnd = [int] $ids[1] - - if ($ids.Count -ne 2 -or ($idStart) -lt $validStart -or $idStart -gt $idEnd -or $idEnd -lt $validStart -or $idEnd -gt $validEnd -or $idStart -gt $idEnd) { + + if ($ids.Count -ne 2 -or ($idStart) -lt $validStart -or $idStart -gt $idEnd -or $idEnd -lt $validStart -or $idEnd -gt $validEnd -or $idStart -gt $idEnd) { throw "IdRange should be formatted as fromId..toId, and the Id range must be in $($validRange[0]) and $($validRange[1])" } return $ids -} +} function UpdateManifest ( @@ -39,7 +43,7 @@ function UpdateManifest [string] $version, [string[]] $idrange, [switch] $AddTestDependencies -) +) { #Modify app.json $appJson = Get-Content (Join-Path $sourceFolder "app.json") -Encoding UTF8 | ConvertFrom-Json @@ -78,7 +82,7 @@ function UpdateManifest $appJson | Set-JsonContentLF -path $appJsonFile } -function UpdateALFile +function UpdateALFile ( [string] $sourceFolder = $alTemplatePath, [string] $destinationFolder, @@ -86,7 +90,7 @@ function UpdateALFile [int] $fromId = 50100, [int] $toId = 50100, [int] $startId -) +) { $al = Get-Content -Encoding UTF8 -Raw -path (Join-Path $sourceFolder $alFileName) $fromId..$toId | ForEach-Object { @@ -100,7 +104,7 @@ function UpdateALFile .SYNOPSIS Creates a simple app. #> -function New-SampleApp +function NewSampleApp ( [string] $destinationPath, [string] $name, @@ -108,7 +112,7 @@ function New-SampleApp [string] $version, [string[]] $idrange, [bool] $sampleCode -) +) { Write-Host "Creating a new sample app in: $destinationPath" New-Item -Path $destinationPath -ItemType Directory -Force | Out-Null @@ -122,11 +126,11 @@ function New-SampleApp } -# <# -# .SYNOPSIS -# Creates a test app. -# #> -function New-SampleTestApp +<# +.SYNOPSIS +Creates a test app. +#> +function NewSampleTestApp ( [string] $destinationPath, [string] $name, @@ -134,7 +138,7 @@ function New-SampleTestApp [string] $version, [string[]] $idrange, [bool] $sampleCode -) +) { Write-Host "Creating a new test app in: $destinationPath" New-Item -Path $destinationPath -ItemType Directory -Force | Out-Null @@ -147,11 +151,11 @@ function New-SampleTestApp } } -# <# -# .SYNOPSIS -# Creates a performance test app. -# #> -function New-SamplePerformanceTestApp +<# +.SYNOPSIS +Creates a performance test app. +#> +function NewSamplePerformanceTestApp ( [string] $destinationPath, [string] $name, @@ -161,7 +165,7 @@ function New-SamplePerformanceTestApp [bool] $sampleCode, [bool] $sampleSuite, [string] $appSourceFolder -) +) { Write-Host "Creating a new performance test app in: $destinationPath" New-Item -Path $destinationPath -ItemType Directory -Force | Out-Null @@ -182,20 +186,24 @@ function New-SamplePerformanceTestApp } } -function Update-WorkSpaces +<# +.SYNOPSIS +Update workspace file +#> +function UpdateWorkspaces ( [string] $projectFolder, [string] $appName -) +) { - Get-ChildItem -Path $projectFolder -Filter "*.code-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 $appName })) { - $workspace.folders = Add-NewAppFolderToWorkspaceFolders $workspace.folders $appName + $workspace.folders = AddNewAppFolderToWorkspaceFolders $workspace.folders $appName } $workspace | Set-JsonContentLF -Path $workspaceFile } @@ -205,7 +213,11 @@ function Update-WorkSpaces } } -function Add-NewAppFolderToWorkspaceFolders +<# +.SYNOPSIS +Add new App Folder to Workspace file +#> +function AddNewAppFolderToWorkspaceFolders ( [PSCustomObject[]] $workspaceFolders, [string] $appFolder @@ -236,9 +248,9 @@ function Add-NewAppFolderToWorkspaceFolders $workspaceFolders } -Export-ModuleMember -Function New-SampleApp -Export-ModuleMember -Function New-SampleTestApp -Export-ModuleMember -Function New-SamplePerformanceTestApp -Export-ModuleMember -Function Confirm-IdRanges -Export-ModuleMember -Function Update-WorkSpaces -Export-ModuleMember -Function Add-NewAppFolderToWorkspaceFolders +Export-ModuleMember -Function NewSampleApp +Export-ModuleMember -Function NewSampleTestApp +Export-ModuleMember -Function NewSamplePerformanceTestApp +Export-ModuleMember -Function ConfirmIdRanges +Export-ModuleMember -Function UpdateWorkspaces +Export-ModuleMember -Function AddNewAppFolderToWorkspaceFolders diff --git a/Actions/CreateApp/CreateApp.ps1 b/Actions/CreateApp/CreateApp.ps1 index 27a9647bb..ffe0b264d 100644 --- a/Actions/CreateApp/CreateApp.ps1 +++ b/Actions/CreateApp/CreateApp.ps1 @@ -1,4 +1,4 @@ -Param( +Param( [Parameter(HelpMessage = "The GitHub actor running the action", Mandatory = $false)] [string] $actor, [Parameter(HelpMessage = "The GitHub token running the action", Mandatory = $false)] @@ -42,7 +42,7 @@ try { 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" @@ -55,7 +55,7 @@ try { throw "An extension name must be specified." } - $ids = Confirm-IdRanges -templateType $type -idrange $idrange + $ids = ConfirmIdRanges -templateType $type -idrange $idrange CheckAndCreateProjectFolder -project $project $projectFolder = (Get-Location).Path @@ -122,16 +122,16 @@ try { } if ($type -eq "Performance Test App") { - New-SamplePerformanceTestApp -destinationPath (Join-Path $projectFolder $folderName) -name $name -publisher $publisher -version $appVersion -sampleCode $sampleCode -sampleSuite $sampleSuite -idrange $ids -appSourceFolder $tmpFolder + NewSamplePerformanceTestApp -destinationPath (Join-Path $projectFolder $folderName) -name $name -publisher $publisher -version $appVersion -sampleCode $sampleCode -sampleSuite $sampleSuite -idrange $ids -appSourceFolder $tmpFolder } elseif ($type -eq "Test App") { - New-SampleTestApp -destinationPath (Join-Path $projectFolder $folderName) -name $name -publisher $publisher -version $appVersion -sampleCode $sampleCode -idrange $ids + NewSampleTestApp -destinationPath (Join-Path $projectFolder $folderName) -name $name -publisher $publisher -version $appVersion -sampleCode $sampleCode -idrange $ids } else { - New-SampleApp -destinationPath (Join-Path $projectFolder $folderName) -name $name -publisher $publisher -version $appVersion -sampleCode $sampleCode -idrange $ids + NewSampleApp -destinationPath (Join-Path $projectFolder $folderName) -name $name -publisher $publisher -version $appVersion -sampleCode $sampleCode -idrange $ids } - Update-WorkSpaces -projectFolder $projectFolder -appName $folderName + UpdateWorkspaces -projectFolder $projectFolder -appName $folderName Set-Location $baseFolder CommitFromNewFolder -serverUrl $serverUrl -commitMessage "New $type ($Name)" -branch $branch diff --git a/Actions/CreateDevelopmentEnvironment/CreateDevelopmentEnvironment.ps1 b/Actions/CreateDevelopmentEnvironment/CreateDevelopmentEnvironment.ps1 index 95c708e2c..3cbd64ec5 100644 --- a/Actions/CreateDevelopmentEnvironment/CreateDevelopmentEnvironment.ps1 +++ b/Actions/CreateDevelopmentEnvironment/CreateDevelopmentEnvironment.ps1 @@ -1,4 +1,4 @@ -Param( +Param( [Parameter(HelpMessage = "The GitHub actor running the action", Mandatory = $false)] [string] $actor, [Parameter(HelpMessage = "The GitHub token running the action", Mandatory = $false)] @@ -16,7 +16,7 @@ Param( [Parameter(HelpMessage = "Set the branch to update", Mandatory = $false)] [string] $updateBranch, [Parameter(HelpMessage = "Direct Commit (Y/N)", Mandatory = $false)] - [bool] $directCommit + [bool] $directCommit ) $telemetryScope = $null diff --git a/Actions/CreateReleaseNotes/CreateReleaseNotes.ps1 b/Actions/CreateReleaseNotes/CreateReleaseNotes.ps1 index 0f165a521..856a4af20 100644 --- a/Actions/CreateReleaseNotes/CreateReleaseNotes.ps1 +++ b/Actions/CreateReleaseNotes/CreateReleaseNotes.ps1 @@ -1,4 +1,4 @@ -Param( +Param( [Parameter(HelpMessage = "The GitHub actor running the action", Mandatory = $false)] [string] $actor, [Parameter(HelpMessage = "The GitHub token running the action", Mandatory = $false)] @@ -19,7 +19,7 @@ try { 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) # Check that tag is SemVer diff --git a/Actions/Deliver/Deliver.ps1 b/Actions/Deliver/Deliver.ps1 index 440a4b2be..494d3f7ff 100644 --- a/Actions/Deliver/Deliver.ps1 +++ b/Actions/Deliver/Deliver.ps1 @@ -1,4 +1,4 @@ -Param( +Param( [Parameter(HelpMessage = "The GitHub actor running the action", Mandatory = $false)] [string] $actor, [Parameter(HelpMessage = "The GitHub token running the action", Mandatory = $false)] @@ -37,7 +37,7 @@ function EnsureAzStorageModule() { Set-Alias -Name Set-AzStorageBlobContent -Value Set-AzureStorageBlobContent -Scope Script } else { - Write-Host "Installing and importing Az.Storage." + Write-Host "Installing and importing Az.Storage." Install-Module 'Az.Storage' -Force Import-Module 'Az.Storage' -DisableNameChecking -WarningAction SilentlyContinue | Out-Null } @@ -78,7 +78,7 @@ try { throw "No projects matches the pattern '$projects'" } if ($deliveryTarget -eq "AppSource") { - $atypes = "Apps,Dependencies" + $atypes = "Apps,Dependencies" } Write-Host "Artifacts $artifacts" Write-Host "Projects:" @@ -175,7 +175,7 @@ try { 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 = @{ @@ -187,7 +187,7 @@ try { "ProjectSettings" = $projectSettings } #Calculate the folders per artifact type - + #Calculate the folders per artifact type 'Apps', 'TestApps', 'Dependencies' | ForEach-Object { $artifactType = $_ @@ -219,7 +219,7 @@ try { $parameters[$artifactType.ToLowerInvariant() + "Folders"] = $artifactFolders.FullName } } - + Write-Host "Calling custom script: $customScript" . $customScript -parameters $parameters } diff --git a/Actions/Deploy/Deploy.ps1 b/Actions/Deploy/Deploy.ps1 index f47e844d5..92973863b 100644 --- a/Actions/Deploy/Deploy.ps1 +++ b/Actions/Deploy/Deploy.ps1 @@ -1,4 +1,4 @@ -Param( +Param( [Parameter(HelpMessage = "The GitHub actor running the action", Mandatory = $false)] [string] $actor, [Parameter(HelpMessage = "The GitHub token running the action", Mandatory = $false)] diff --git a/Actions/DetermineArtifactUrl/DetermineArtifactUrl.ps1 b/Actions/DetermineArtifactUrl/DetermineArtifactUrl.ps1 index 2ec8b3bab..63abdef09 100644 --- a/Actions/DetermineArtifactUrl/DetermineArtifactUrl.ps1 +++ b/Actions/DetermineArtifactUrl/DetermineArtifactUrl.ps1 @@ -1,4 +1,4 @@ -Param( +Param( [Parameter(HelpMessage = "Specifies the parent telemetry scope for the telemetry signal", Mandatory = $false)] [string] $parentTelemetryScopeJson = '7b7d', [Parameter(HelpMessage = "Project folder", Mandatory = $false)] @@ -13,7 +13,7 @@ try { 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 $secrets = $env:Secrets | ConvertFrom-Json | ConvertTo-HashTable diff --git a/Actions/DetermineDeliveryTargets/DetermineDeliveryTargets.ps1 b/Actions/DetermineDeliveryTargets/DetermineDeliveryTargets.ps1 index 8655b2875..f357a4e2e 100644 --- a/Actions/DetermineDeliveryTargets/DetermineDeliveryTargets.ps1 +++ b/Actions/DetermineDeliveryTargets/DetermineDeliveryTargets.ps1 @@ -1,4 +1,4 @@ -Param( +Param( [Parameter(HelpMessage = "Projects to investigate", Mandatory = $false)] [string] $projectsJson = '["."]', [Parameter(HelpMessage = "Check whether context secret exists", Mandatory = $false)] diff --git a/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 b/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 index 501a03b29..ee00cd153 100644 --- a/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 +++ b/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 @@ -1,4 +1,4 @@ -Param( +Param( [Parameter(HelpMessage = "Specifies the pattern of the environments you want to retreive (* for all)", Mandatory = $true)] [string] $getEnvironments, [Parameter(HelpMessage = "Type of deployment (CD or Publish)", Mandatory = $true)] diff --git a/Actions/DetermineProjectsToBuild/DetermineProjectsToBuild.Action.ps1 b/Actions/DetermineProjectsToBuild/DetermineProjectsToBuild.Action.ps1 index 8e6fba298..aab20c9af 100644 --- a/Actions/DetermineProjectsToBuild/DetermineProjectsToBuild.Action.ps1 +++ b/Actions/DetermineProjectsToBuild/DetermineProjectsToBuild.Action.ps1 @@ -1,4 +1,4 @@ -Param( +Param( [Parameter(HelpMessage = "The folder to scan for projects to build", Mandatory = $true)] [string] $baseFolder, [Parameter(HelpMessage = "An array of changed files paths, used to filter the projects to build", Mandatory = $false)] @@ -18,7 +18,7 @@ try { DownloadAndImportBcContainerHelper -baseFolder $baseFolder Import-Module (Join-Path -Path $PSScriptRoot -ChildPath "..\TelemetryHelper.psm1" -Resolve) -DisableNameChecking #endregion - + $telemetryScope = CreateScope -eventId 'DO0085' -parentTelemetryScopeJson $parentTelemetryScopeJson #region Action: Determine projects to build @@ -31,12 +31,12 @@ try { $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 "BuildOrderJson=$buildOrderJson" + Write-Host "ProjectsJson=$projectsJson" Write-Host "ProjectDependenciesJson=$projectDependenciesJson" Write-Host "BuildOrderJson=$buildOrderJson" diff --git a/Actions/DetermineProjectsToBuild/DetermineProjectsToBuild.ps1 b/Actions/DetermineProjectsToBuild/DetermineProjectsToBuild.ps1 index 3049d5dd8..d86ad4645 100644 --- a/Actions/DetermineProjectsToBuild/DetermineProjectsToBuild.ps1 +++ b/Actions/DetermineProjectsToBuild/DetermineProjectsToBuild.ps1 @@ -1,4 +1,4 @@ -<# +<# .Synopsis Creates buils dimensions for a list of projects. diff --git a/Actions/DetermineProjectsToBuild/GetModifiedFiles.ps1 b/Actions/DetermineProjectsToBuild/GetModifiedFiles.ps1 index 83e0f0ea5..801cbb198 100644 --- a/Actions/DetermineProjectsToBuild/GetModifiedFiles.ps1 +++ b/Actions/DetermineProjectsToBuild/GetModifiedFiles.ps1 @@ -1,4 +1,4 @@ -Param( +Param( [Parameter(HelpMessage = "The GitHub token to use to fetch the changed files", Mandatory = $false)] [string] $token ) @@ -17,7 +17,7 @@ if(-not ($ghEvent.PSObject.Properties.name -eq 'pull_request')) { $url = "$($env:GITHUB_API_URL)/repos/$($env:GITHUB_REPOSITORY)/compare/$($ghEvent.pull_request.base.sha)...$($ghEvent.pull_request.head.sha)" -$headers = @{ +$headers = @{ "Authorization" = "token $token" "Accept" = "application/vnd.github.baptiste-preview+json" } diff --git a/Actions/DetermineProjectsToBuild/action.yaml b/Actions/DetermineProjectsToBuild/action.yaml index b2807f038..312bcb06b 100644 --- a/Actions/DetermineProjectsToBuild/action.yaml +++ b/Actions/DetermineProjectsToBuild/action.yaml @@ -20,7 +20,7 @@ outputs: ProjectDependenciesJson: description: An object that holds the project dependencies in compressed JSON format value: ${{ steps.determineProjectsToBuild.outputs.ProjectDependenciesJson }} - BuildOrderJson: + BuildOrderJson: description: An array of objects that determine that build order, including build dimensions value: ${{ steps.determineProjectsToBuild.outputs.BuildOrderJson }} runs: @@ -34,7 +34,7 @@ runs: _maxBuildDepth: ${{ inputs.maxBuildDepth }} run: | $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0 - try { + try { $changedFiles = ${{ github.action_path }}/GetModifiedFiles.ps1 -token ${{ github.token }} ${{ github.action_path }}/DetermineProjectsToBuild.Action.ps1 -baseFolder ${{ github.workspace }} -modifiedFiles $changedFiles -maxBuildDepth $env:_maxBuildDepth -parentTelemetryScopeJson $env:_parentTelemetryScopeJson } diff --git a/Actions/DownloadProjectDependencies/DownloadProjectDependencies.Action.ps1 b/Actions/DownloadProjectDependencies/DownloadProjectDependencies.Action.ps1 index 27b31eeb1..4f9e32f52 100644 --- a/Actions/DownloadProjectDependencies/DownloadProjectDependencies.Action.ps1 +++ b/Actions/DownloadProjectDependencies/DownloadProjectDependencies.Action.ps1 @@ -1,4 +1,4 @@ -Param( +Param( [Parameter(HelpMessage = "The project for which to download dependencies", Mandatory = $true)] [string] $project, [string] $baseFolder, @@ -17,23 +17,23 @@ function DownloadDependenciesFromProbingPaths($baseFolder, $project, $destinatio } } -function DownloadDependenciesFromCurrentBuild($baseFolder, $project, $projectsDependencies, $buildMode, $destinationPath) { +function DownloadDependenciesFromCurrentBuild($baseFolder, $project, $projectsDependencies, $buildMode, $destinationPath) { Write-Host "Downloading dependencies for project '$project'" - + $dependencyProjects = @() if ($projectsDependencies.Keys -contains $project) { $dependencyProjects = @($projectsDependencies."$project") } Write-Host "Dependency projects: $($dependencyProjects -join ', ')" - + # For each dependency project, calculate the corresponding probing path $dependeciesProbingPaths = @($dependencyProjects | ForEach-Object { $dependencyProject = $_ Write-Host "Reading settings for project '$dependencyProject'" $dependencyProjectSettings = ReadSettings -baseFolder $baseFolder -project $dependencyProject - + $dependencyBuildMode = $buildMode if (!($dependencyProjectSettings.buildModes -contains $dependencyBuildMode)) { # Download the default build mode if the specified build mode is not supported for the dependency project @@ -48,7 +48,7 @@ function DownloadDependenciesFromCurrentBuild($baseFolder, $project, $projectsDe if (!$baseBranch) { $baseBranch = $currentBranch } - + return @{ "release_status" = "thisBuild" "version" = "latest" @@ -60,7 +60,7 @@ function DownloadDependenciesFromCurrentBuild($baseFolder, $project, $projectsDe "authTokenSecret" = $token } }) - + # For each probing path, download the dependencies $downloadedDependencies = @() $dependeciesProbingPaths | ForEach-Object { diff --git a/Actions/Github-Helper.psm1 b/Actions/Github-Helper.psm1 index 57c17a25c..cd8293bfb 100644 --- a/Actions/Github-Helper.psm1 +++ b/Actions/Github-Helper.psm1 @@ -125,22 +125,22 @@ function Get-Dependencies { $dependency = $_ $projects = $dependency.projects $buildMode = $dependency.buildMode - + # change the mask to include the build mode if($buildMode -ne "Default") { $mask = "$buildMode$mask" } Write-Host "Locating $mask artifacts for projects: $projects" - + if ($dependency.release_status -eq "thisBuild") { $missingProjects = @() $projects.Split(',') | ForEach-Object { $project = $_ $project = $project.Replace('\','_').Replace('/','_') # sanitize project name - + $downloadName = Join-Path $saveToPath "thisbuild-$project-$($mask)" - + if (Test-Path $downloadName -PathType Container) { $folder = Get-Item $downloadName Get-ChildItem -Path $folder | ForEach-Object { @@ -264,7 +264,7 @@ function CmdDo { if ("$err" -ne "") { $message += "$err" } - + $message = $message.Trim() if ($p.ExitCode -eq 0) { @@ -485,9 +485,9 @@ function GetReleases { if ($releases.Count -gt 1) { # Sort by SemVer tag try { - $sortedReleases = $releases.tag_name | - ForEach-Object { SemVerStrToSemVerObj -semVerStr $_ } | - Sort-Object -Property Major,Minor,Patch,Addt0,Addt1,Addt2,Addt3,Addt4 -Descending | + $sortedReleases = $releases.tag_name | + ForEach-Object { SemVerStrToSemVerObj -semVerStr $_ } | + Sort-Object -Property Major,Minor,Patch,Addt0,Addt1,Addt2,Addt3,Addt4 -Descending | ForEach-Object { SemVerObjToSemVerStr -semVerObj $_ } | ForEach-Object { $tag_name = $_ $releases | Where-Object { $_.tag_name -eq $tag_name } @@ -511,7 +511,7 @@ function GetLatestRelease { [string] $repository = $ENV:GITHUB_REPOSITORY, [string] $ref = $ENV:GITHUB_REFNAME ) - + Write-Host "Getting the latest release from $api_url/repos/$repository/releases/latest - branch $ref" # Get all releases from GitHub, sorted by SemVer tag # If any release tag is not a valid SemVer tag, use default GitHub sorting and issue a warning @@ -559,7 +559,7 @@ function GetReleaseNotes { [string] $previous_tag_name, [string] $target_commitish ) - + Write-Host "Generating release note $api_url/repos/$repository/releases/generate-notes" $postParams = @{ @@ -573,7 +573,7 @@ function GetReleaseNotes { $postParams["target_commitish"] = $target_commitish } - InvokeWebRequest -Headers (GetHeader -token $token) -Method POST -Body ($postParams | ConvertTo-Json) -Uri "$api_url/repos/$repository/releases/generate-notes" + InvokeWebRequest -Headers (GetHeader -token $token) -Method POST -Body ($postParams | ConvertTo-Json) -Uri "$api_url/repos/$repository/releases/generate-notes" } function DownloadRelease { @@ -596,12 +596,12 @@ function DownloadRelease { $projects.Split(',') | ForEach-Object { $project = $_.Replace('\','_').Replace('/','_') Write-Host "project '$project'" - + $release.assets | Where-Object { $_.name -like "$project-*-$mask-*.zip" -or $_.name -like "$project-$mask-*.zip" } | ForEach-Object { $uri = "$api_url/repos/$repository/releases/assets/$($_.id)" Write-Host $uri $filename = Join-Path $path $_.name - InvokeWebRequest -Headers $headers -Uri $uri -OutFile $filename + InvokeWebRequest -Headers $headers -Uri $uri -OutFile $filename return $filename } } diff --git a/Actions/IncrementVersionNumber/IncrementVersionNumber.ps1 b/Actions/IncrementVersionNumber/IncrementVersionNumber.ps1 index 3df41a7ec..cc6dfdc15 100644 --- a/Actions/IncrementVersionNumber/IncrementVersionNumber.ps1 +++ b/Actions/IncrementVersionNumber/IncrementVersionNumber.ps1 @@ -1,4 +1,4 @@ -Param( +Param( [Parameter(HelpMessage = "The GitHub actor running the action", Mandatory = $false)] [string] $actor, [Parameter(HelpMessage = "The GitHub token running the action", Mandatory = $false)] @@ -30,7 +30,7 @@ try { import-module (Join-Path -path $PSScriptRoot -ChildPath "..\TelemetryHelper.psm1" -Resolve) $telemetryScope = CreateScope -eventId 'DO0076' -parentTelemetryScopeJson $parentTelemetryScopeJson - + $addToVersionNumber = "$versionnumber".StartsWith('+') if ($addToVersionNumber) { $versionnumber = $versionnumber.Substring(1) diff --git a/Actions/PipelineCleanup/PipelineCleanup.ps1 b/Actions/PipelineCleanup/PipelineCleanup.ps1 index 72322f63d..a7a348fad 100644 --- a/Actions/PipelineCleanup/PipelineCleanup.ps1 +++ b/Actions/PipelineCleanup/PipelineCleanup.ps1 @@ -1,4 +1,4 @@ -Param( +Param( [Parameter(HelpMessage = "Project folder", Mandatory = $false)] [string] $project = ".", [Parameter(HelpMessage = "Specifies the parent telemetry scope for the telemetry signal", Mandatory = $false)] @@ -13,7 +13,7 @@ try { import-module (Join-Path -path $PSScriptRoot -ChildPath "..\TelemetryHelper.psm1" -Resolve) $telemetryScope = CreateScope -eventId 'DO0077' -parentTelemetryScopeJson $parentTelemetryScopeJson - + if ($project -eq ".") { $project = "" } $containerName = GetContainerName($project) diff --git a/Actions/PullRequestStatusCheck/PullRequestStatusCheck.ps1 b/Actions/PullRequestStatusCheck/PullRequestStatusCheck.ps1 index ae9375a95..bd0cf737f 100644 --- a/Actions/PullRequestStatusCheck/PullRequestStatusCheck.ps1 +++ b/Actions/PullRequestStatusCheck/PullRequestStatusCheck.ps1 @@ -1,4 +1,4 @@ -function PullRequestStatusCheck() +function PullRequestStatusCheck() { param( [Parameter(HelpMessage = "Repository name", Mandatory = $true)] diff --git a/Actions/README.md b/Actions/README.md index be7f4d163..c2d11a494 100644 --- a/Actions/README.md +++ b/Actions/README.md @@ -36,8 +36,8 @@ We do not accept Pull Requests on the Actions repository directly. ## Trademarks -This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft -trademarks or logos is subject to and must follow +This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft +trademarks or logos is subject to and must follow [Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general). Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies. diff --git a/Actions/ReadSecrets/README.md b/Actions/ReadSecrets/README.md index 35821eb98..ac2df1a8b 100644 --- a/Actions/ReadSecrets/README.md +++ b/Actions/ReadSecrets/README.md @@ -2,6 +2,8 @@ Read secrets from GitHub secrets or Azure Keyvault for AL-Go workflows The secrets read and added to the output are the secrets specified in the getSecrets parameter Additionally, the secrets specified by the authToken secret in AppDependencyProbingPaths are read if appDependencyProbingPathsSecrets is specified in getSecrets +All secrets included in the Secrets output are Base64 encoded to avoid issues with national characters +Secrets, which name is preceded by an asterisk (*) are encrypted and Base64 encoded ## INPUT @@ -15,7 +17,7 @@ Additionally, the secrets specified by the authToken secret in AppDependencyProb | :-- | :-: | :-- | :-- | | 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 | {} | -| getSecrets | Yes | Comma separated list of secrets to get (add appDependencyProbingPathsSecrets to request secrets needed for resolving dependencies in AppDependencyProbingPaths, add TokenForPush in order to request a token to use for pull requests and commits) | | +| getSecrets | Yes | Comma separated list of secrets to get (add appDependencyProbingPathsSecrets to request secrets needed for resolving dependencies in AppDependencyProbingPaths, add TokenForPush in order to request a token to use for pull requests and commits). Secrets preceded by an asterisk are returned encrypted | | | useGhTokenWorkflowForPush | false | Determines whether you want to use the GhTokenWorkflow secret for TokenForPush | ## OUTPUT @@ -26,6 +28,6 @@ none ### OUTPUT variables | Name | Description | | :-- | :-- | -| Secrets | A compressed json construct with all requested secrets base64 encoded. The secret value + the base64 value of the secret value are masked in the log | +| Secrets | A compressed json construct with all requested secrets base64 encoded. Secrets preceded by an asterisk (*) are encrypted before base64 encoding. The secret value + the base64 value of the secret value are masked in the log | | TokenForPush | The token to use when workflows are pushing changes (either directly, or via pull requests). This is either the GITHUB_TOKEN or the GhTokenWorkflow secret (based on the env variable useGhTokenWorkflowForPush) | diff --git a/Actions/ReadSecrets/ReadSecrets.ps1 b/Actions/ReadSecrets/ReadSecrets.ps1 index 4eede406e..231041b9e 100644 --- a/Actions/ReadSecrets/ReadSecrets.ps1 +++ b/Actions/ReadSecrets/ReadSecrets.ps1 @@ -1,7 +1,7 @@ -Param( +Param( [Parameter(HelpMessage = "All GitHub Secrets in compressed JSON format", Mandatory = $true)] [string] $gitHubSecrets = "", - [Parameter(HelpMessage = "Comma separated list of Secrets to get", Mandatory = $true)] + [Parameter(HelpMessage = "Comma separated list of Secrets to get. Secrets preceded by an asterisk are returned encrypted", Mandatory = $true)] [string] $getSecrets = "", [Parameter(HelpMessage = "Determines whether you want to use the GhTokenWorkflow secret for TokenForPush", Mandatory = $false)] [string] $useGhTokenWorkflowForPush = 'false' @@ -26,16 +26,7 @@ try { $outSecrets = [ordered]@{} $settings = $env:Settings | ConvertFrom-Json | ConvertTo-HashTable - $keyVaultName = "" - if (IsKeyVaultSet -and $settings.ContainsKey('keyVaultName')) { - $keyVaultName = $settings.keyVaultName - if ([string]::IsNullOrEmpty($keyVaultName)) { - $credentialsJson = Get-KeyVaultCredentials | ConvertTo-HashTable - if ($credentialsJson.Keys -contains "keyVaultName") { - $keyVaultName = $credentialsJson.keyVaultName - } - } - } + $keyVaultCredentials = GetKeyVaultCredentials $getAppDependencyProbingPathsSecrets = $false $getTokenForPush = $false [System.Collections.ArrayList]$secretsCollection = @() @@ -46,16 +37,26 @@ try { # If we are using the ghTokenWorkflow for commits, we need to get ghTokenWorkflow secret $secret = 'ghTokenWorkflow' } - $secretNameProperty = "$($secret)SecretName" + $secretNameProperty = "$($secret.TrimStart('*'))SecretName" if ($secret -eq 'AppDependencyProbingPathsSecrets') { $getAppDependencyProbingPathsSecrets = $true } else { + $secretName = $secret if ($settings.Keys -contains $secretNameProperty) { - $secret = "$($secret)=$($settings."$secretNameProperty")" + $secretName = $settings."$secretNameProperty" } - if ($secretsCollection -notcontains $secret) { - $secretsCollection += $secret + # Secret is the AL-Go name of the secret + # SecretName is the actual name of the secret to get from the KeyVault or GitHub environment + if ($secretName) { + if ($secretName -ne $secret) { + # Setup mapping between AL-Go secret name and actual secret name + $secret = "$($secret)=$secretName" + } + if ($secretsCollection -notcontains $secret) { + # Add secret to the collection of secrets to get + $secretsCollection += $secret + } } } } @@ -75,13 +76,16 @@ try { foreach($secret in @($secretsCollection)) { $secretSplit = $secret.Split('=') $secretsProperty = $secretSplit[0] - $secretName = $secretsProperty + # Secret names preceded by an asterisk are returned encrypted (and base64 encoded) + $secretsPropertyName = $secretsProperty.TrimStart('*') + $encrypted = $secretsProperty.StartsWith('*') + $secretName = $secretsPropertyName if ($secretSplit.Count -gt 1) { $secretName = $secretSplit[1] } if ($secretName) { - $secretValue = GetSecret -secret $secretName -keyVaultName $keyVaultName + $secretValue = GetSecret -secret $secretName -keyVaultCredentials $keyVaultCredentials -encrypted:$encrypted if ($secretValue) { $json = @{} try { @@ -102,7 +106,7 @@ try { } $base64value = [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($secretValue)) $outSecrets += @{ "$secretsProperty" = $base64value } - Write-Host "$secretsProperty successfully read from secret $secretName" + Write-Host "$($secretsPropertyName) successfully read from secret $secretName" $secretsCollection.Remove($secret) } } @@ -111,13 +115,16 @@ try { if ($secretsCollection) { $unresolvedSecrets = ($secretsCollection | ForEach-Object { $secretSplit = @($_.Split('=')) - if ($secretSplit.Count -eq 1) { - $secretSplit[0] + $secretsProperty = $secretSplit[0] + # Secret names preceded by an asterisk are returned encrypted (and base64 encoded) + $secretsPropertyName = $secretsProperty.TrimStart('*') + if ($secretSplit.Count -eq 1 -or ($secretSplit[1] -eq '')) { + $secretsPropertyName } else { - "$($secretSplit[0]) (Secret $($secretSplit[1]))" + "$($secretsPropertyName) (Secret $($secretSplit[1]))" } - $outSecrets += @{ "$($secretSplit[0])" = "" } + $outSecrets += @{ "$secretsProperty" = "" } }) -join ', ' Write-Host "The following secrets was not found: $unresolvedSecrets" } diff --git a/Actions/ReadSecrets/ReadSecretsHelper.psm1 b/Actions/ReadSecrets/ReadSecretsHelper.psm1 index da63007b9..2dc9dec07 100644 --- a/Actions/ReadSecrets/ReadSecretsHelper.psm1 +++ b/Actions/ReadSecrets/ReadSecretsHelper.psm1 @@ -1,3 +1,4 @@ +[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '', Justification = 'GitHub Secrets come in as plain text')] Param( [string] $_gitHubSecrets ) @@ -40,7 +41,8 @@ function MaskValue { function GetGithubSecret { param ( - [string] $secretName + [string] $secretName, + [switch] $encrypted ) $secretSplit = $secretName.Split('=') $envVar = $secretSplit[0] @@ -52,42 +54,61 @@ function GetGithubSecret { if ($script:gitHubSecrets.PSObject.Properties.Name -eq $secret) { $value = $script:githubSecrets."$secret" if ($value) { - MaskValue -key $secret -value $value - return $value + MaskValue -key $envVar -value $value + if ($encrypted) { + # Return encrypted string + return (ConvertTo-SecureString -String $value -AsPlainText -Force | ConvertFrom-SecureString) + } + else { + # Return decrypted string + return $value + } } } return $null } - -function Get-KeyVaultCredentials { + +function GetKeyVaultCredentials { + $creds = $null if ($script:isKeyvaultSet) { - $jsonStr = $script:gitHuBSecrets.AZURE_CREDENTIALS + $jsonStr = $script:gitHubSecrets.AZURE_CREDENTIALS if ($jsonStr -contains "`n" -or $jsonStr -contains "`r") { - throw "Secret AZURE_CREDENTIALS cannot contain line breaks" + throw "Secret AZURE_CREDENTIALS cannot contain line breaks, needs to be formatted as compressed JSON (no line breaks)" } try { $creds = $jsonStr | ConvertFrom-Json # Mask ClientSecret MaskValue -key 'clientSecret' -value $creds.ClientSecret + $creds.ClientSecret = ConvertTo-SecureString $creds.ClientSecret -AsPlainText -Force # Check thet $creds contains the needed properties $creds.ClientId | Out-Null $creds.subscriptionId | Out-Null $creds.TenantId | Out-Null - return $creds } catch { throw "Secret AZURE_CREDENTIALS is wrongly formatted. Needs to be formatted as compressed JSON (no line breaks) and contain at least the properties: clientId, clientSecret, tenantId and subscriptionId." } + $keyVaultNameExists = $creds.PSObject.Properties.Name -eq 'keyVaultName' + $settings = $env:Settings | ConvertFrom-Json + # If KeyVaultName is defined in settings, use that value + if ($settings.keyVaultName) { + if ($keyVaultNameExists) { + $creds.keyVaultName = $settings.keyVaultName + } + else { + $creds | Add-Member -MemberType NoteProperty -Name 'keyVaultName' -Value $settings.keyVaultName + } + } + elseif (!($keyVaultNameExists)) { + # If KeyVaultName is not defined - return null (i.e. do not use a KeyVault) + $creds = $null + } } - throw "Secret AZURE_CREDENTIALS is missing. In order to use a Keyvault, please add a secret called AZURE_CREDENTIALS like explained here: https://go.microsoft.com/fwlink/?linkid=2217318&clcid=0x409 (remember to format the json string as compressed json, i.e. no line breaks)" + return $creds } function InstallKeyVaultModuleIfNeeded { - if (-not $script:isKeyvaultSet) { - return - } - if ($isWindows) { $azModulesPath = Get-ChildItem 'C:\Modules\az_*' | Where-Object { $_.PSIsContainer } if ($azModulesPath) { @@ -121,7 +142,7 @@ function InstallKeyVaultModuleIfNeeded { Disable-AzureRmDataCollection -WarningAction SilentlyContinue } else { - Write-Host "Installing and importing Az.KeyVault." + Write-Host "Installing and importing Az.KeyVault." Install-Module 'Az.KeyVault' -Force Import-Module 'Az.KeyVault' -DisableNameChecking -WarningAction SilentlyContinue | Out-Null } @@ -129,19 +150,15 @@ function InstallKeyVaultModuleIfNeeded { } } -function ConnectAzureKeyVaultIfNeeded { - param( +function ConnectAzureKeyVault { + param( [string] $subscriptionId, [string] $tenantId, - [string] $clientId , - [string] $clientSecret + [string] $clientId, + [SecureString] $clientSecret ) try { - if ($script:keyvaultConnectionExists) { - return - } - - $credential = New-Object PSCredential -argumentList $clientId, (ConvertTo-SecureString $clientSecret -AsPlainText -Force) + $credential = New-Object PSCredential -argumentList $clientId, $clientSecret if ($script:azureRm210) { Add-AzureRmAccount -ServicePrincipal -Tenant $tenantId -Credential $credential -WarningAction SilentlyContinue | Out-Null Set-AzureRmContext -SubscriptionId $subscriptionId -Tenant $tenantId -ErrorAction SilentlyContinue -WarningAction SilentlyContinue | Out-Null @@ -163,60 +180,71 @@ function ConnectAzureKeyVaultIfNeeded { function GetKeyVaultSecret { param ( [string] $secretName, - [string] $keyVaultName + [PsCustomObject] $keyVaultCredentials, + [switch] $encrypted ) if (-not $script:isKeyvaultSet) { return $null } - + if (-not $script:keyvaultConnectionExists) { - InstallKeyVaultModuleIfNeeded - - $credentialsJson = Get-KeyVaultCredentials - ConnectAzureKeyVaultIfNeeded -subscriptionId $credentialsJson.subscriptionId -tenantId $credentialsJson.tenantId -clientId $credentialsJson.clientId -clientSecret $credentialsJson.clientSecret + ConnectAzureKeyVault -subscriptionId $keyVaultCredentials.subscriptionId -tenantId $keyVaultCredentials.tenantId -clientId $keyVaultCredentials.clientId -clientSecret $keyVaultCredentials.clientSecret + } + + $secretSplit = $secretName.Split('=') + $envVar = $secretSplit[0] + $secret = $envVar + if ($secretSplit.Count -gt 1) { + $secret = $secretSplit[1] } - $value = "" + $value = $null if ($script:azureRm210) { - $keyVaultSecret = Get-AzureKeyVaultSecret -VaultName $keyVaultName -Name $secret -ErrorAction SilentlyContinue + $keyVaultSecret = Get-AzureKeyVaultSecret -VaultName $keyVaultCredentials.keyVaultName -Name $secret -ErrorAction SilentlyContinue } else { - $keyVaultSecret = Get-AzKeyVaultSecret -VaultName $keyVaultName -Name $secret -ErrorAction SilentlyContinue + $keyVaultSecret = Get-AzKeyVaultSecret -VaultName $keyVaultCredentials.keyVaultName -Name $secret -ErrorAction SilentlyContinue } - if ($keyVaultSecret) { - $value = [Runtime.InteropServices.Marshal]::PtrToStringBSTR(([Runtime.InteropServices.Marshal]::SecureStringToBSTR($keyVaultSecret.SecretValue))) - MaskValue -key $secret -value $value - return $value + if ($encrypted) { + # Return encrypted string + $value = $keyVaultSecret.SecretValue | ConvertFrom-SecureString + } + else { + # Return decrypted string + $bstr = [Runtime.InteropServices.Marshal]::SecureStringToBSTR($keyVaultSecret.SecretValue) + $value = [Runtime.InteropServices.Marshal]::PtrToStringBSTR($bstr) + [Runtime.InteropServices.Marshal]::FreeBSTR($bstr) + MaskValue -key $envVar -value $value + } } - - return $null + return $value } function GetSecret { param ( [string] $secret, - [string] $keyVaultName + [PSCustomObject] $keyVaultCredentials, + [switch] $encrypted ) - Write-Host "Trying to get the secret($secret) from the github environment." - $value = GetGithubSecret -secretName $secret + Write-Host "Trying to get the secret ($secret) from the github environment." + $value = GetGithubSecret -secretName $secret -encrypted:$encrypted if ($value) { - Write-Host "Secret($secret) was retrieved from the github environment." - return $value + Write-Host "Secret ($secret) was retrieved from the github environment." } - - if ($keyVaultName) { - Write-Host "Trying to get the secret($secret) from Key Vault ($keyVaultName)." - $value = GetKeyVaultSecret -secretName $secret -keyVaultName $keyVaultName + elseif ($keyVaultCredentials) { + Write-Host "Trying to get the secret ($secret) from Key Vault ($($keyVaultCredentials.keyVaultName))." + $value = GetKeyVaultSecret -secretName $secret -keyVaultCredentials $keyVaultCredentials -encrypted:$encrypted if ($value) { - Write-Host "Secret($secret) was retrieved from the Key Vault." - return $value + Write-Host "Secret ($secret) was retrieved from the Key Vault." } } - - Write-Host "Could not find secret $secret in Github secrets or Azure Key Vault." - return $null + else { + Write-Host "Could not find secret $secret in Github secrets or Azure Key Vault." + $value = $null + } + return $value } diff --git a/Actions/ReadSecrets/action.yaml b/Actions/ReadSecrets/action.yaml index 384d15f6f..fd6090aa1 100644 --- a/Actions/ReadSecrets/action.yaml +++ b/Actions/ReadSecrets/action.yaml @@ -9,7 +9,7 @@ inputs: description: All GitHub Secrets in compressed JSON format required: true getSecrets: - description: Comma separated list of Secrets to get + description: Comma separated list of Secrets to get. Secrets preceded by an asterisk are returned encrypted required: true useGhTokenWorkflowForPush: description: Determines whether you want to use the GhTokenWorkflow secret for TokenForPush diff --git a/Actions/ReadSettings/README.md b/Actions/ReadSettings/README.md index 627dee444..0c08e47ff 100644 --- a/Actions/ReadSettings/README.md +++ b/Actions/ReadSettings/README.md @@ -10,8 +10,6 @@ none | Name | Required | Description | Default value | | :-- | :-: | :-- | :-- | | 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 | | project | | Project name if the repository is setup for multiple projects | . | | get | | Specifies which properties to get from the settings file, default is all | | diff --git a/Actions/ReadSettings/ReadSettings.ps1 b/Actions/ReadSettings/ReadSettings.ps1 index 9539b87d9..d78b52a13 100644 --- a/Actions/ReadSettings/ReadSettings.ps1 +++ b/Actions/ReadSettings/ReadSettings.ps1 @@ -1,8 +1,4 @@ -Param( - [Parameter(HelpMessage = "The GitHub actor running the action", Mandatory = $false)] - [string] $actor, - [Parameter(HelpMessage = "The GitHub token running the action", Mandatory = $false)] - [string] $token, +Param( [Parameter(HelpMessage = "Project folder", Mandatory = $false)] [string] $project = ".", [Parameter(HelpMessage = "Specifies which properties to get from the settings file, default is all", Mandatory = $false)] diff --git a/Actions/ReadSettings/action.yaml b/Actions/ReadSettings/action.yaml index 09adee3ab..6208c5c98 100644 --- a/Actions/ReadSettings/action.yaml +++ b/Actions/ReadSettings/action.yaml @@ -5,14 +5,6 @@ inputs: description: Shell in which you want to run the action (powershell or pwsh) required: false default: powershell - actor: - description: The GitHub actor running the action - required: false - default: ${{ github.actor }} - token: - description: The GitHub token running the action - required: false - default: ${{ github.token }} project: description: Project folder required: false @@ -35,14 +27,12 @@ runs: shell: ${{ inputs.shell }} id: readsettings env: - _actor: ${{ inputs.actor }} - _token: ${{ inputs.token }} _project: ${{ inputs.project }} _get: ${{ inputs.get }} run: | $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0 try { - ${{ github.action_path }}/ReadSettings.ps1 -actor $ENV:_actor -token $ENV:_token -project $ENV:_project -get $ENV:_get + ${{ 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",' <- '))"; diff --git a/Actions/RunPipeline/RunPipeline.ps1 b/Actions/RunPipeline/RunPipeline.ps1 index b6be97189..f6d54957f 100644 --- a/Actions/RunPipeline/RunPipeline.ps1 +++ b/Actions/RunPipeline/RunPipeline.ps1 @@ -1,4 +1,4 @@ -Param( +Param( [Parameter(HelpMessage = "The GitHub actor running the action", Mandatory = $false)] [string] $actor, [Parameter(HelpMessage = "The GitHub token running the action", Mandatory = $false)] @@ -36,7 +36,7 @@ try { docker pull --quiet $genericImageName } -ArgumentList $genericImageName | Out-Null } - + $containerName = GetContainerName($project) $ap = "$ENV:GITHUB_ACTION_PATH".Split('\') @@ -82,7 +82,7 @@ try { $secrets = $env:Secrets | ConvertFrom-Json | ConvertTo-HashTable $appBuild = $settings.appBuild $appRevision = $settings.appRevision - 'licenseFileUrl','insiderSasToken','codeSignCertificateUrl','codeSignCertificatePassword','keyVaultCertificateUrl','keyVaultCertificatePassword','keyVaultClientId','gitHubPackagesContext','applicationInsightsConnectionString' | ForEach-Object { + 'licenseFileUrl','insiderSasToken','codeSignCertificateUrl','*codeSignCertificatePassword','keyVaultCertificateUrl','*keyVaultCertificatePassword','keyVaultClientId','gitHubPackagesContext','applicationInsightsConnectionString' | ForEach-Object { # Secrets might not be read during Pull Request runs if ($secrets.Keys -contains $_) { $value = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($secrets."$_")) @@ -90,7 +90,9 @@ try { else { $value = "" } - Set-Variable -Name $_ -Value $value + # Secrets preceded by an asterisk are returned encrypted. + # Variable name should not include the asterisk + Set-Variable -Name $_.TrimStart('*') -Value $value } $analyzeRepoParams = @{} @@ -137,26 +139,26 @@ try { # Analyze app.json version dependencies before launching pipeline - # Analyze InstallApps and InstallTestApps before launching pipeline + # Analyze InstallApps and InstallTestApps before launching pipeline # Check if codeSignCertificateUrl+Password is used (and defined) if (!$settings.doNotSignApps -and $codeSignCertificateUrl -and $codeSignCertificatePassword -and !$settings.keyVaultCodesignCertificateName) { OutputWarning -message "Using the legacy CodeSignCertificateUrl and CodeSignCertificatePassword parameters. Consider using the new Azure Keyvault signing instead. Go to https://aka.ms/ALGoSettings#keyVaultCodesignCertificateName to find out more" - $runAlPipelineParams += @{ + $runAlPipelineParams += @{ "CodeSignCertPfxFile" = $codeSignCertificateUrl - "CodeSignCertPfxPassword" = ConvertTo-SecureString -string $codeSignCertificatePassword -AsPlainText -Force + "CodeSignCertPfxPassword" = ConvertTo-SecureString -string $codeSignCertificatePassword } } if ($applicationInsightsConnectionString) { - $runAlPipelineParams += @{ + $runAlPipelineParams += @{ "applicationInsightsConnectionString" = $applicationInsightsConnectionString } } if ($keyVaultCertificateUrl -and $keyVaultCertificatePassword -and $keyVaultClientId) { - $runAlPipelineParams += @{ + $runAlPipelineParams += @{ "KeyVaultCertPfxFile" = $keyVaultCertificateUrl - "keyVaultCertPfxPassword" = ConvertTo-SecureString -string $keyVaultCertificatePassword -AsPlainText -Force + "keyVaultCertPfxPassword" = ConvertTo-SecureString -string $keyVaultCertificatePassword "keyVaultClientId" = $keyVaultClientId } } @@ -212,7 +214,7 @@ try { "appVersion" = $settings.repoVersion } } - + $buildArtifactFolder = Join-Path $projectPath ".buildartifacts" New-Item $buildArtifactFolder -ItemType Directory | Out-Null diff --git a/Actions/SECURITY.md b/Actions/SECURITY.md index 926b8ae40..a050f362c 100644 --- a/Actions/SECURITY.md +++ b/Actions/SECURITY.md @@ -14,7 +14,7 @@ Instead, please report them to the Microsoft Security Response Center (MSRC) at If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc). -You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc). +You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc). Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: diff --git a/Actions/SUPPORT.md b/Actions/SUPPORT.md index 96927d757..424e7e4c1 100644 --- a/Actions/SUPPORT.md +++ b/Actions/SUPPORT.md @@ -1,11 +1,11 @@ # Support -## How to file issues and get help +## How to file issues and get help This GitHub repo is auto-generated from https://github.com/microsoft/AL-Go. Issues, bug tracking and feature requests should be done there. Please follow the documentation [here](https://github.com/microsoft/AL-Go/blob/main/Scenarios/Contribute.md) if you want to contribute to AL-Go for GitHub. -## Microsoft Support Policy +## Microsoft Support Policy Support for this **PROJECT or PRODUCT** is limited to the resources listed above. diff --git a/Actions/Sign/Sign.ps1 b/Actions/Sign/Sign.ps1 index e035fd9ac..4e90d5190 100644 --- a/Actions/Sign/Sign.ps1 +++ b/Actions/Sign/Sign.ps1 @@ -1,4 +1,4 @@ -param( +param( [Parameter(HelpMessage = "Azure Credentials secret", Mandatory = $true)] [string] $AzureCredentialsJson, [Parameter(HelpMessage = "The path to the files to be signed", Mandatory = $true)] @@ -26,23 +26,25 @@ try { $Files = Get-ChildItem -Path $PathToFiles -File | Select-Object -ExpandProperty FullName Write-Host "Signing files:" - $Files | ForEach-Object { - Write-Host "- $_" + $Files | ForEach-Object { + Write-Host "- $_" } $AzureCredentials = ConvertFrom-Json $AzureCredentialsJson $settings = $env:Settings | ConvertFrom-Json - if ($AzureCredentials.PSobject.Properties.name -eq "keyVaultName") { - $AzureKeyVaultName = $AzureCredentials.keyVaultName - } elseif ($settings.PSobject.Properties.name -eq "keyVaultName") { + if ($settings.keyVaultName) { $AzureKeyVaultName = $settings.keyVaultName - } else { + } + 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." } Retry-Command -Command { Write-Host "::group::Register NavSip" - Register-NavSip + Register-NavSip Write-Host "::endgroup::" AzureSignTool sign --file-digest $digestAlgorithm ` @@ -55,7 +57,7 @@ try { --timestamp-digest $digestAlgorithm ` $Files } -MaxRetries 3 - + TrackTrace -telemetryScope $telemetryScope } catch { diff --git a/Actions/Sign/Sign.psm1 b/Actions/Sign/Sign.psm1 index d877984c3..981ca549e 100644 --- a/Actions/Sign/Sign.psm1 +++ b/Actions/Sign/Sign.psm1 @@ -1,7 +1,7 @@ function Get-NavSipFromArtifacts ( [string] $NavSipDestination -) +) { $artifactTempFolder = Join-Path $([System.IO.Path]::GetTempPath()) ([System.IO.Path]::GetRandomFileName()) diff --git a/Actions/TelemetryHelper.psm1 b/Actions/TelemetryHelper.psm1 index 9ef924751..83feaaf74 100644 --- a/Actions/TelemetryHelper.psm1 +++ b/Actions/TelemetryHelper.psm1 @@ -16,7 +16,7 @@ $signals = @{ "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" @@ -63,7 +63,7 @@ function CreateScope { [string] $parentTelemetryScopeJson = '7b7d' ) - $signalName = $signals[$eventId] + $signalName = $signals[$eventId] if (-not $signalName) { throw "Invalid event id ($eventId) is enountered." } diff --git a/Actions/VerifyPRChanges/VerifyPRChanges.ps1 b/Actions/VerifyPRChanges/VerifyPRChanges.ps1 index d49c1feef..907ff02ed 100644 --- a/Actions/VerifyPRChanges/VerifyPRChanges.ps1 +++ b/Actions/VerifyPRChanges/VerifyPRChanges.ps1 @@ -1,4 +1,4 @@ -Param( +Param( [Parameter(HelpMessage = "The token to use for the GitHub API", Mandatory = $false)] [string] $token, [Parameter(HelpMessage = "The name of the repository the PR is going to", Mandatory = $false)] diff --git a/Actions/WorkflowInitialize/WorkflowInitialize.ps1 b/Actions/WorkflowInitialize/WorkflowInitialize.ps1 index c8543a35f..c34d25b65 100644 --- a/Actions/WorkflowInitialize/WorkflowInitialize.ps1 +++ b/Actions/WorkflowInitialize/WorkflowInitialize.ps1 @@ -1,4 +1,4 @@ -Param( +Param( [Parameter(HelpMessage = "The event id of the initiating workflow", Mandatory = $true)] [string] $eventId ) @@ -54,7 +54,7 @@ try { 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 - + $scopeJson = strToHexStr -str ($telemetryScope | ConvertTo-Json -Compress) $correlationId = ($telemetryScope.CorrelationId).ToString() } diff --git a/Actions/WorkflowPostProcess/WorkflowPostProcess.ps1 b/Actions/WorkflowPostProcess/WorkflowPostProcess.ps1 index 388afa20f..77af82986 100644 --- a/Actions/WorkflowPostProcess/WorkflowPostProcess.ps1 +++ b/Actions/WorkflowPostProcess/WorkflowPostProcess.ps1 @@ -1,4 +1,4 @@ -Param( +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)] diff --git a/Actions/prettyfyjson.ps1 b/Actions/prettyfyjson.ps1 index 5cfd73d9d..9464a8b49 100644 --- a/Actions/prettyfyjson.ps1 +++ b/Actions/prettyfyjson.ps1 @@ -1,4 +1,4 @@ -Param( +Param( [string] $path ) diff --git a/Internal/Overrides/1st party apps/NewBcContainer.ps1 b/Internal/Overrides/1st party apps/NewBcContainer.ps1 index 4113a3932..ef0544df4 100644 --- a/Internal/Overrides/1st party apps/NewBcContainer.ps1 +++ b/Internal/Overrides/1st party apps/NewBcContainer.ps1 @@ -1,4 +1,4 @@ - + Param( [Hashtable]$parameters ) @@ -8,7 +8,7 @@ New-BcContainer @parameters Get-Location | Out-Host Write-Host "Removing companies" $keepCompany = "CRONUS Danmark A/S" -Get-CompanyInBcContainer -containerName $parameters.ContainerName | Where-Object { $_.CompanyName -ne $keepCompany } | ForEach-Object { +Get-CompanyInBcContainer -containerName $parameters.ContainerName | Where-Object { $_.CompanyName -ne $keepCompany } | ForEach-Object { Remove-CompanyInBcContainer -containerName $parameters.ContainerName -companyName $_.CompanyName } Clean-BcContainerDatabase ` diff --git a/Internal/Overrides/System Application/NewBcContainer.ps1 b/Internal/Overrides/System Application/NewBcContainer.ps1 index 7acee7357..d73867cda 100644 --- a/Internal/Overrides/System Application/NewBcContainer.ps1 +++ b/Internal/Overrides/System Application/NewBcContainer.ps1 @@ -1,4 +1,4 @@ -Param( +Param( [Hashtable]$parameters ) diff --git a/README.md b/README.md index 0ef95b0d9..e57a7ef85 100644 --- a/README.md +++ b/README.md @@ -71,8 +71,8 @@ contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additio ## Trademarks -This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft -trademarks or logos is subject to and must follow +This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft +trademarks or logos is subject to and must follow [Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general). Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies. diff --git a/RELEASENOTES.md b/RELEASENOTES.md index b2ef4a36a..c8b6ba4cc 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -2,7 +2,7 @@ Note that when using the preview version of AL-Go for GitHub, you need to Update your AL-Go system files, as soon as possible when told to do so. -### Issues +### Issues - Issue 227 Feature request: Allow deployments with "Schema Sync Mode" = Force - Issue 519 Deploying to onprem environment @@ -128,13 +128,13 @@ All these actions now uses the selected branch in the **Run workflow** dialog as ### New Settings -- `UseCompilerFolder`: Setting useCompilerFolder to true causes your pipelines to use containerless compiling. Unless you also set `doNotPublishApps` to true, setting useCompilerFolder to true won't give you any performance advantage, since AL-Go for GitHub will still need to create a container in order to publish and test the apps. In the future, publishing and testing will be split from building and there will be other options for getting an instance of Business Central for publishing and testing. +- `UseCompilerFolder`: Setting useCompilerFolder to true causes your pipelines to use containerless compiling. Unless you also set `doNotPublishApps` to true, setting useCompilerFolder to true won't give you any performance advantage, since AL-Go for GitHub will still need to create a container in order to publish and test the apps. In the future, publishing and testing will be split from building and there will be other options for getting an instance of Business Central for publishing and testing. - `vsixFile`: vsixFile should be a direct download URL to the version of the AL Language extension you want to use for building the project or repo. By default, AL-Go will use the AL Language extension that comes with the Business Central Artifacts. ### New Workflows - **_BuildALGoProject** is a reusable workflow that unites the steps for building an AL-Go projects. It has been reused in the following workflows: _CI/CD_, _Pull Request Build_, _NextMinor_, _NextMajor_ and _Current_. -The workflow appears under the _Actions_ tab in GitHub, but it is not actionable in any way. +The workflow appears under the _Actions_ tab in GitHub, but it is not actionable in any way. ### New Actions @@ -271,7 +271,7 @@ Setting the repo setting "runs-on" to "Ubuntu-Latest", followed by running Updat - Issue #273 Potential security issue in Pull Request Handler in Open Source repositories - Issue #303 PullRequestHandler fails on added files - Issue #299 Multi-project repositories build all projects on Pull Requests -- Issue #291 Issues with new Pull Request Handler +- Issue #291 Issues with new Pull Request Handler - Issue #287 AL-Go pipeline fails in ReadSettings step ### Changes @@ -386,7 +386,7 @@ Setting the repo setting "runs-on" to "Ubuntu-Latest", followed by running Updat ``` "ConditionalSettings": [ { - "branches": [ + "branches": [ "feature/*" ], "settings": { diff --git a/SECURITY.md b/SECURITY.md index f7b89984f..1f9d3d442 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -14,7 +14,7 @@ Instead, please report them to the Microsoft Security Response Center (MSRC) at If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc). -You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc). +You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc). Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: diff --git a/SUPPORT.md b/SUPPORT.md index 0e45e97b1..8d7be6abc 100644 --- a/SUPPORT.md +++ b/SUPPORT.md @@ -1,11 +1,11 @@ # Support -## How to file issues and get help +## How to file issues and get help -This project uses GitHub Issues to track bugs and feature requests. Please search the existing -issues before filing new issues to avoid duplicates. For new issues, file your bug or +This project uses GitHub Issues to track bugs and feature requests. Please search the existing +issues before filing new issues to avoid duplicates. For new issues, file your bug or feature request as a new Issue. -## Microsoft Support Policy +## Microsoft Support Policy Support for this **PROJECT or PRODUCT** is limited to the resources listed above. diff --git a/Scenarios/AppDependencies.md b/Scenarios/AppDependencies.md index 287e860fd..118b20283 100644 --- a/Scenarios/AppDependencies.md +++ b/Scenarios/AppDependencies.md @@ -1,4 +1,4 @@ -# 14. Introducing a dependency to an app on GitHub +# 14. Introducing a dependency to an app on GitHub If your app has a dependency to another application on a different GitHub repository, the foreign repository can be added to the dependency probing paths (appDependencyProbingPaths) in the AL-Go settings file. The dependency must also be added to the `app.json` file as a dependency. During a build all the apps mentioned in the probing paths will be downloaded and installed on the tenant. @@ -16,7 +16,7 @@ The `appDependencyProbingPaths` key in the settings expects a json array with th ] ``` -**repo** specifies the URL of the foreign repository. +**repo** specifies the URL of the foreign repository. **version** specifies the version of the dependency to be downloaded it could be set to **latest** or a specific version. diff --git a/Scenarios/EnablingTelemetry.md b/Scenarios/EnablingTelemetry.md index 51042a2bf..9e4bedcd5 100644 --- a/Scenarios/EnablingTelemetry.md +++ b/Scenarios/EnablingTelemetry.md @@ -1,4 +1,4 @@ -# 15. Enabling telemetry +# 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: @@ -12,7 +12,7 @@ You can also decide to send extended telelmetry to Microsoft. This would be help "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. +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 | diff --git a/Scenarios/MigrateFromAzureDevOpsWithHistory.md b/Scenarios/MigrateFromAzureDevOpsWithHistory.md index 1ed8c1e0a..8d245ba9f 100644 --- a/Scenarios/MigrateFromAzureDevOpsWithHistory.md +++ b/Scenarios/MigrateFromAzureDevOpsWithHistory.md @@ -29,7 +29,7 @@ - appFolders, see https://aka.ms/algosettings#appfolders - testFolders, see https://aka.ms/algosettings#testfolders - appSourceMandatoryAffixes, see https://aka.ms/algosettings#appSourceMandatoryAffixes - - enableAppSourceCop, see https://aka.ms/algosettings#enableAppSourceCop + - enableAppSourceCop, see https://aka.ms/algosettings#enableAppSourceCop - enablePerTenantExtensionCop, see https://aka.ms/algosettings#enablePerTenantExtensionCop - enableCodeCop, see https://aka.ms/algosettings#enableCodeCop - enableUICop, see https://aka.ms/algosettings#enableUICop diff --git a/Scenarios/MigrateFromAzureDevOpsWithoutHistory.md b/Scenarios/MigrateFromAzureDevOpsWithoutHistory.md index cafb437b8..75832d0de 100644 --- a/Scenarios/MigrateFromAzureDevOpsWithoutHistory.md +++ b/Scenarios/MigrateFromAzureDevOpsWithoutHistory.md @@ -19,7 +19,7 @@ - appFolders, see https://aka.ms/algosettings#appfolders - testFolders, see https://aka.ms/algosettings#testfolders - appSourceMandatoryAffixes, see https://aka.ms/algosettings#appSourceMandatoryAffixes - - enableAppSourceCop, see https://aka.ms/algosettings#enableAppSourceCop + - enableAppSourceCop, see https://aka.ms/algosettings#enableAppSourceCop - enablePerTenantExtensionCop, see https://aka.ms/algosettings#enablePerTenantExtensionCop - enableCodeCop, see https://aka.ms/algosettings#enableCodeCop - enableUICop, see https://aka.ms/algosettings#enableUICop diff --git a/Scenarios/settings.md b/Scenarios/settings.md index 73b2ed9b2..57e9079b9 100644 --- a/Scenarios/settings.md +++ b/Scenarios/settings.md @@ -118,7 +118,7 @@ Example, adding this: ```json "ConditionalSettings": [ { - "branches": [ + "branches": [ "feature/*" ], "settings": { @@ -140,10 +140,10 @@ You could imagine that you could have and organizational settings variable conta ```json "ConditionalSettings": [ { - "repositories": [ + "repositories": [ "bcsamples-*" ], - "branches": [ + "branches": [ "features/*" ], "settings": { diff --git a/Templates/AppSource App/.AL-Go/cloudDevEnv.ps1 b/Templates/AppSource App/.AL-Go/cloudDevEnv.ps1 index a749351d0..fe7b78e0b 100644 --- a/Templates/AppSource App/.AL-Go/cloudDevEnv.ps1 +++ b/Templates/AppSource App/.AL-Go/cloudDevEnv.ps1 @@ -1,4 +1,4 @@ -# +# # Script for creating cloud development environment # Please do not modify this script as it will be auto-updated from the AL-Go Template # Recommended approach is to use as is or add a script (freddyk-devenv.ps1), which calls this script with the user specific parameters @@ -31,13 +31,13 @@ $project = GetProject -baseFolder $baseFolder -projectALGoFolder $PSScriptRoot Clear-Host Write-Host Write-Host -ForegroundColor Yellow @' - _____ _ _ _____ ______ - / ____| | | | | __ \ | ____| + _____ _ _ _____ ______ + / ____| | | | | __ \ | ____| | | | | ___ _ _ __| | | | | | _____ __ |__ _ ____ __ | | | |/ _ \| | | |/ _` | | | | |/ _ \ \ / / __| | '_ \ \ / / - | |____| | (_) | |_| | (_| | | |__| | __/\ V /| |____| | | \ V / - \_____|_|\___/ \__,_|\__,_| |_____/ \___| \_/ |______|_| |_|\_/ - + | |____| | (_) | |_| | (_| | | |__| | __/\ V /| |____| | | \ V / + \_____|_|\___/ \__,_|\__,_| |_____/ \___| \_/ |______|_| |_|\_/ + '@ Write-Host @' diff --git a/Templates/AppSource App/.AL-Go/localDevEnv.ps1 b/Templates/AppSource App/.AL-Go/localDevEnv.ps1 index ad17012f1..c38d17ef8 100644 --- a/Templates/AppSource App/.AL-Go/localDevEnv.ps1 +++ b/Templates/AppSource App/.AL-Go/localDevEnv.ps1 @@ -1,4 +1,4 @@ -# +# # Script for creating local development environment # Please do not modify this script as it will be auto-updated from the AL-Go Template # Recommended approach is to use as is or add a script (freddyk-devenv.ps1), which calls this script with the user specific parameters @@ -34,13 +34,13 @@ $project = GetProject -baseFolder $baseFolder -projectALGoFolder $PSScriptRoot Clear-Host Write-Host Write-Host -ForegroundColor Yellow @' - _ _ _____ ______ - | | | | | __ \ | ____| + _ _ _____ ______ + | | | | | __ \ | ____| | | ___ ___ __ _| | | | | | _____ __ |__ _ ____ __ | | / _ \ / __/ _` | | | | | |/ _ \ \ / / __| | '_ \ \ / / - | |____ (_) | (__ (_| | | | |__| | __/\ V /| |____| | | \ V / - |______\___/ \___\__,_|_| |_____/ \___| \_/ |______|_| |_|\_/ - + | |____ (_) | (__ (_| | | | |__| | __/\ V /| |____| | | \ V / + |______\___/ \___\__,_|_| |_____/ \___| \_/ |______|_| |_|\_/ + '@ Write-Host @' diff --git a/Templates/AppSource App/.github/workflows/CICD.yaml b/Templates/AppSource App/.github/workflows/CICD.yaml index 807e2e3c3..3c4651b1d 100644 --- a/Templates/AppSource App/.github/workflows/CICD.yaml +++ b/Templates/AppSource App/.github/workflows/CICD.yaml @@ -61,7 +61,7 @@ jobs: id: DetermineWorkflowDepth run: | Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "WorkflowDepth=$($env:workflowDepth)" - + - name: Determine Projects To Build id: determineProjectsToBuild uses: microsoft/AL-Go-Actions/DetermineProjectsToBuild@main @@ -142,7 +142,7 @@ jobs: project: ${{ matrix.project }} buildMode: ${{ matrix.buildMode }} projectDependenciesJson: ${{ needs.Initialization.outputs.projectDependenciesJson }} - secrets: 'licenseFileUrl,insiderSasToken,codeSignCertificateUrl,codeSignCertificatePassword,keyVaultCertificateUrl,keyVaultCertificatePassword,keyVaultClientId,gitHubPackagesContext,applicationInsightsConnectionString' + secrets: 'licenseFileUrl,insiderSasToken,codeSignCertificateUrl,*codeSignCertificatePassword,keyVaultCertificateUrl,*keyVaultCertificatePassword,keyVaultClientId,gitHubPackagesContext,applicationInsightsConnectionString' publishThisBuildArtifacts: ${{ needs.Initialization.outputs.workflowDepth > 1 }} publishArtifacts: ${{ github.ref_name == 'main' || startswith(github.ref_name, 'release/') || needs.Initialization.outputs.deliveryTargetsJson != '[]' || needs.Initialization.outputs.environmentCount > 0 }} signArtifacts: true diff --git a/Templates/AppSource App/.github/workflows/CreateApp.yaml b/Templates/AppSource App/.github/workflows/CreateApp.yaml index 1ccbffdc4..09455920d 100644 --- a/Templates/AppSource App/.github/workflows/CreateApp.yaml +++ b/Templates/AppSource App/.github/workflows/CreateApp.yaml @@ -11,7 +11,7 @@ on: default: '.' name: description: Name - required: true + required: true publisher: description: Publisher required: true diff --git a/Templates/AppSource App/.github/workflows/CreatePerformanceTestApp.yaml b/Templates/AppSource App/.github/workflows/CreatePerformanceTestApp.yaml index a76f5fa30..e372c8ca4 100644 --- a/Templates/AppSource App/.github/workflows/CreatePerformanceTestApp.yaml +++ b/Templates/AppSource App/.github/workflows/CreatePerformanceTestApp.yaml @@ -12,14 +12,14 @@ on: name: description: Name required: true - default: '.PerformanceTest' + default: '.PerformanceTest' publisher: description: Publisher required: true idrange: description: ID range required: true - default: '50000..99999' + default: '50000..99999' sampleCode: description: Include Sample code (Y/N) required: false diff --git a/Templates/AppSource App/.github/workflows/CreateRelease.yaml b/Templates/AppSource App/.github/workflows/CreateRelease.yaml index 832cea633..4a2c423eb 100644 --- a/Templates/AppSource App/.github/workflows/CreateRelease.yaml +++ b/Templates/AppSource App/.github/workflows/CreateRelease.yaml @@ -105,7 +105,7 @@ jobs: $sha = '' $allArtifacts = @() $page = 1 - $headers = @{ + $headers = @{ "Authorization" = "token ${{ github.token }}" "X-GitHub-Api-Version" = "2022-11-28" "Accept" = "application/vnd.github+json" diff --git a/Templates/AppSource App/.github/workflows/CreateTestApp.yaml b/Templates/AppSource App/.github/workflows/CreateTestApp.yaml index 05a44d39e..10d8cc3c8 100644 --- a/Templates/AppSource App/.github/workflows/CreateTestApp.yaml +++ b/Templates/AppSource App/.github/workflows/CreateTestApp.yaml @@ -12,14 +12,14 @@ on: name: description: Name required: true - default: '.Test' + default: '.Test' publisher: description: Publisher required: true idrange: description: ID range required: true - default: '50000..99999' + default: '50000..99999' sampleCode: description: Include Sample code (Y/N) required: false diff --git a/Templates/AppSource App/.github/workflows/Current.yaml b/Templates/AppSource App/.github/workflows/Current.yaml index cb5597194..97cf3d601 100644 --- a/Templates/AppSource App/.github/workflows/Current.yaml +++ b/Templates/AppSource App/.github/workflows/Current.yaml @@ -49,7 +49,7 @@ jobs: id: DetermineWorkflowDepth run: | Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "WorkflowDepth=$($env:workflowDepth)" - + - name: Determine Projects To Build id: determineProjectsToBuild uses: microsoft/AL-Go-Actions/DetermineProjectsToBuild@main @@ -74,7 +74,7 @@ jobs: project: ${{ matrix.project }} buildMode: ${{ matrix.buildMode }} projectDependenciesJson: ${{ needs.Initialization.outputs.projectDependenciesJson }} - secrets: 'licenseFileUrl,insiderSasToken,codeSignCertificateUrl,codeSignCertificatePassword,keyVaultCertificateUrl,keyVaultCertificatePassword,keyVaultClientId,gitHubPackagesContext,applicationInsightsConnectionString' + secrets: 'licenseFileUrl,insiderSasToken,codeSignCertificateUrl,*codeSignCertificatePassword,keyVaultCertificateUrl,*keyVaultCertificatePassword,keyVaultClientId,gitHubPackagesContext,applicationInsightsConnectionString' publishThisBuildArtifacts: ${{ needs.Initialization.outputs.workflowDepth > 1 }} artifactsNameSuffix: 'Current' diff --git a/Templates/AppSource App/.github/workflows/IncrementVersionNumber.yaml b/Templates/AppSource App/.github/workflows/IncrementVersionNumber.yaml index 2b882ce75..ea3287658 100644 --- a/Templates/AppSource App/.github/workflows/IncrementVersionNumber.yaml +++ b/Templates/AppSource App/.github/workflows/IncrementVersionNumber.yaml @@ -69,7 +69,7 @@ jobs: project: ${{ github.event.inputs.project }} versionNumber: ${{ github.event.inputs.versionNumber }} directCommit: ${{ github.event.inputs.directCommit }} - + - name: Finalize the workflow if: always() uses: microsoft/AL-Go-Actions/WorkflowPostProcess@main diff --git a/Templates/AppSource App/.github/workflows/NextMajor.yaml b/Templates/AppSource App/.github/workflows/NextMajor.yaml index daba931e8..305092c9d 100644 --- a/Templates/AppSource App/.github/workflows/NextMajor.yaml +++ b/Templates/AppSource App/.github/workflows/NextMajor.yaml @@ -49,7 +49,7 @@ jobs: id: DetermineWorkflowDepth run: | Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "WorkflowDepth=$($env:workflowDepth)" - + - name: Determine Projects To Build id: determineProjectsToBuild uses: microsoft/AL-Go-Actions/DetermineProjectsToBuild@main @@ -74,7 +74,7 @@ jobs: project: ${{ matrix.project }} buildMode: ${{ matrix.buildMode }} projectDependenciesJson: ${{ needs.Initialization.outputs.projectDependenciesJson }} - secrets: 'licenseFileUrl,insiderSasToken,codeSignCertificateUrl,codeSignCertificatePassword,keyVaultCertificateUrl,keyVaultCertificatePassword,keyVaultClientId,gitHubPackagesContext,applicationInsightsConnectionString' + secrets: 'licenseFileUrl,insiderSasToken,codeSignCertificateUrl,*codeSignCertificatePassword,keyVaultCertificateUrl,*keyVaultCertificatePassword,keyVaultClientId,gitHubPackagesContext,applicationInsightsConnectionString' publishThisBuildArtifacts: ${{ needs.Initialization.outputs.workflowDepth > 1 }} artifactsNameSuffix: 'NextMajor' diff --git a/Templates/AppSource App/.github/workflows/NextMinor.yaml b/Templates/AppSource App/.github/workflows/NextMinor.yaml index cc6bc4412..c46c88bd9 100644 --- a/Templates/AppSource App/.github/workflows/NextMinor.yaml +++ b/Templates/AppSource App/.github/workflows/NextMinor.yaml @@ -49,7 +49,7 @@ jobs: id: DetermineWorkflowDepth run: | Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "WorkflowDepth=$($env:workflowDepth)" - + - name: Determine Projects To Build id: determineProjectsToBuild uses: microsoft/AL-Go-Actions/DetermineProjectsToBuild@main @@ -74,7 +74,7 @@ jobs: project: ${{ matrix.project }} buildMode: ${{ matrix.buildMode }} projectDependenciesJson: ${{ needs.Initialization.outputs.projectDependenciesJson }} - secrets: 'licenseFileUrl,insiderSasToken,codeSignCertificateUrl,codeSignCertificatePassword,keyVaultCertificateUrl,keyVaultCertificatePassword,keyVaultClientId,gitHubPackagesContext,applicationInsightsConnectionString' + secrets: 'licenseFileUrl,insiderSasToken,codeSignCertificateUrl,*codeSignCertificatePassword,keyVaultCertificateUrl,*keyVaultCertificatePassword,keyVaultClientId,gitHubPackagesContext,applicationInsightsConnectionString' publishThisBuildArtifacts: ${{ needs.Initialization.outputs.workflowDepth > 1 }} artifactsNameSuffix: 'NextMinor' diff --git a/Templates/AppSource App/.github/workflows/PullRequestHandler.yaml b/Templates/AppSource App/.github/workflows/PullRequestHandler.yaml index 9bf73d26f..f67b8e50e 100644 --- a/Templates/AppSource App/.github/workflows/PullRequestHandler.yaml +++ b/Templates/AppSource App/.github/workflows/PullRequestHandler.yaml @@ -62,12 +62,12 @@ jobs: uses: microsoft/AL-Go-Actions/ReadSettings@main with: shell: powershell - + - name: Determine Workflow Depth id: DetermineWorkflowDepth run: | Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "WorkflowDepth=$($env:workflowDepth)" - + - name: Determine Projects To Build id: determineProjectsToBuild uses: microsoft/AL-Go-Actions/DetermineProjectsToBuild@main @@ -93,7 +93,7 @@ jobs: project: ${{ matrix.project }} buildMode: ${{ matrix.buildMode }} projectDependenciesJson: ${{ needs.Initialization.outputs.projectDependenciesJson }} - secrets: 'licenseFileUrl,insiderSasToken,keyVaultCertificateUrl,keyVaultCertificatePassword,keyVaultClientId,gitHubPackagesContext,applicationInsightsConnectionString' + secrets: 'licenseFileUrl,insiderSasToken,keyVaultCertificateUrl,*keyVaultCertificatePassword,keyVaultClientId,gitHubPackagesContext,applicationInsightsConnectionString' publishThisBuildArtifacts: ${{ needs.Initialization.outputs.workflowDepth > 1 }} StatusCheck: diff --git a/Templates/AppSource App/.github/workflows/_BuildALGoProject.yaml b/Templates/AppSource App/.github/workflows/_BuildALGoProject.yaml index 9ddf9d4b8..bf2c4d9e0 100644 --- a/Templates/AppSource App/.github/workflows/_BuildALGoProject.yaml +++ b/Templates/AppSource App/.github/workflows/_BuildALGoProject.yaml @@ -10,7 +10,7 @@ on: required: false default: powershell type: string - runsOn: + runsOn: description: JSON-formatted string og the types of machine to run the build job on required: true type: string @@ -174,7 +174,7 @@ jobs: path: '${{ inputs.project }}/.buildartifacts/TestApps/' if-no-files-found: ignore retention-days: 1 - + - name: Publish artifacts - apps uses: actions/upload-artifact@v3 if: inputs.publishArtifacts diff --git a/Templates/AppSource App/SECURITY.md b/Templates/AppSource App/SECURITY.md index 926b8ae40..a050f362c 100644 --- a/Templates/AppSource App/SECURITY.md +++ b/Templates/AppSource App/SECURITY.md @@ -14,7 +14,7 @@ Instead, please report them to the Microsoft Security Response Center (MSRC) at If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc). -You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc). +You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc). Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: diff --git a/Templates/AppSource App/SUPPORT.md b/Templates/AppSource App/SUPPORT.md index 96927d757..424e7e4c1 100644 --- a/Templates/AppSource App/SUPPORT.md +++ b/Templates/AppSource App/SUPPORT.md @@ -1,11 +1,11 @@ # Support -## How to file issues and get help +## How to file issues and get help This GitHub repo is auto-generated from https://github.com/microsoft/AL-Go. Issues, bug tracking and feature requests should be done there. Please follow the documentation [here](https://github.com/microsoft/AL-Go/blob/main/Scenarios/Contribute.md) if you want to contribute to AL-Go for GitHub. -## Microsoft Support Policy +## Microsoft Support Policy Support for this **PROJECT or PRODUCT** is limited to the resources listed above. diff --git a/Templates/Per Tenant Extension/.AL-Go/cloudDevEnv.ps1 b/Templates/Per Tenant Extension/.AL-Go/cloudDevEnv.ps1 index 14e6937e4..fe7b78e0b 100644 --- a/Templates/Per Tenant Extension/.AL-Go/cloudDevEnv.ps1 +++ b/Templates/Per Tenant Extension/.AL-Go/cloudDevEnv.ps1 @@ -1,4 +1,4 @@ -# +# # Script for creating cloud development environment # Please do not modify this script as it will be auto-updated from the AL-Go Template # Recommended approach is to use as is or add a script (freddyk-devenv.ps1), which calls this script with the user specific parameters @@ -24,20 +24,20 @@ $webClient.DownloadFile('https://raw.githubusercontent.com/microsoft/AL-Go-Actio Import-Module $GitHubHelperPath . $ALGoHelperPath -local - + $baseFolder = GetBaseFolder -folder $PSScriptRoot $project = GetProject -baseFolder $baseFolder -projectALGoFolder $PSScriptRoot Clear-Host Write-Host Write-Host -ForegroundColor Yellow @' - _____ _ _ _____ ______ - / ____| | | | | __ \ | ____| + _____ _ _ _____ ______ + / ____| | | | | __ \ | ____| | | | | ___ _ _ __| | | | | | _____ __ |__ _ ____ __ | | | |/ _ \| | | |/ _` | | | | |/ _ \ \ / / __| | '_ \ \ / / - | |____| | (_) | |_| | (_| | | |__| | __/\ V /| |____| | | \ V / - \_____|_|\___/ \__,_|\__,_| |_____/ \___| \_/ |______|_| |_|\_/ - + | |____| | (_) | |_| | (_| | | |__| | __/\ V /| |____| | | \ V / + \_____|_|\___/ \__,_|\__,_| |_____/ \___| \_/ |______|_| |_|\_/ + '@ Write-Host @' diff --git a/Templates/Per Tenant Extension/.AL-Go/localDevEnv.ps1 b/Templates/Per Tenant Extension/.AL-Go/localDevEnv.ps1 index 69235aefe..ab0db7e94 100644 --- a/Templates/Per Tenant Extension/.AL-Go/localDevEnv.ps1 +++ b/Templates/Per Tenant Extension/.AL-Go/localDevEnv.ps1 @@ -1,4 +1,4 @@ -# +# # Script for creating local development environment # Please do not modify this script as it will be auto-updated from the AL-Go Template # Recommended approach is to use as is or add a script (freddyk-devenv.ps1), which calls this script with the user specific parameters @@ -34,13 +34,13 @@ $project = GetProject -baseFolder $baseFolder -projectALGoFolder $PSScriptRoot Clear-Host Write-Host Write-Host -ForegroundColor Yellow @' - _ _ _____ ______ - | | | | | __ \ | ____| + _ _ _____ ______ + | | | | | __ \ | ____| | | ___ ___ __ _| | | | | | _____ __ |__ _ ____ __ | | / _ \ / __/ _` | | | | | |/ _ \ \ / / __| | '_ \ \ / / - | |____ (_) | (__ (_| | | | |__| | __/\ V /| |____| | | \ V / - |______\___/ \___\__,_|_| |_____/ \___| \_/ |______|_| |_|\_/ - + | |____ (_) | (__ (_| | | | |__| | __/\ V /| |____| | | \ V / + |______\___/ \___\__,_|_| |_____/ \___| \_/ |______|_| |_|\_/ + '@ Write-Host @' diff --git a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml index 57854e9f1..09963e614 100644 --- a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml @@ -61,7 +61,7 @@ jobs: id: DetermineWorkflowDepth run: | Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "WorkflowDepth=$($env:workflowDepth)" - + - name: Determine Projects To Build id: determineProjectsToBuild uses: microsoft/AL-Go-Actions/DetermineProjectsToBuild@main @@ -142,7 +142,7 @@ jobs: project: ${{ matrix.project }} buildMode: ${{ matrix.buildMode }} projectDependenciesJson: ${{ needs.Initialization.outputs.projectDependenciesJson }} - secrets: 'licenseFileUrl,insiderSasToken,codeSignCertificateUrl,codeSignCertificatePassword,keyVaultCertificateUrl,keyVaultCertificatePassword,keyVaultClientId,gitHubPackagesContext,applicationInsightsConnectionString' + secrets: 'licenseFileUrl,insiderSasToken,codeSignCertificateUrl,*codeSignCertificatePassword,keyVaultCertificateUrl,*keyVaultCertificatePassword,keyVaultClientId,gitHubPackagesContext,applicationInsightsConnectionString' publishThisBuildArtifacts: ${{ needs.Initialization.outputs.workflowDepth > 1 }} publishArtifacts: ${{ github.ref_name == 'main' || startswith(github.ref_name, 'release/') || needs.Initialization.outputs.deliveryTargetsJson != '[]' || needs.Initialization.outputs.environmentCount > 0 }} signArtifacts: true diff --git a/Templates/Per Tenant Extension/.github/workflows/CreateApp.yaml b/Templates/Per Tenant Extension/.github/workflows/CreateApp.yaml index 1ccbffdc4..09455920d 100644 --- a/Templates/Per Tenant Extension/.github/workflows/CreateApp.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/CreateApp.yaml @@ -11,7 +11,7 @@ on: default: '.' name: description: Name - required: true + required: true publisher: description: Publisher required: true diff --git a/Templates/Per Tenant Extension/.github/workflows/CreatePerformanceTestApp.yaml b/Templates/Per Tenant Extension/.github/workflows/CreatePerformanceTestApp.yaml index a76f5fa30..e372c8ca4 100644 --- a/Templates/Per Tenant Extension/.github/workflows/CreatePerformanceTestApp.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/CreatePerformanceTestApp.yaml @@ -12,14 +12,14 @@ on: name: description: Name required: true - default: '.PerformanceTest' + default: '.PerformanceTest' publisher: description: Publisher required: true idrange: description: ID range required: true - default: '50000..99999' + default: '50000..99999' sampleCode: description: Include Sample code (Y/N) required: false diff --git a/Templates/Per Tenant Extension/.github/workflows/CreateRelease.yaml b/Templates/Per Tenant Extension/.github/workflows/CreateRelease.yaml index 585c29cdc..4a2c423eb 100644 --- a/Templates/Per Tenant Extension/.github/workflows/CreateRelease.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/CreateRelease.yaml @@ -105,7 +105,7 @@ jobs: $sha = '' $allArtifacts = @() $page = 1 - $headers = @{ + $headers = @{ "Authorization" = "token ${{ github.token }}" "X-GitHub-Api-Version" = "2022-11-28" "Accept" = "application/vnd.github+json" @@ -232,7 +232,7 @@ jobs: run: | $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0 Write-Host "Downloading artifact ${{ matrix.name}}" - $headers = @{ + $headers = @{ "Authorization" = "token ${{ github.token }}" "X-GitHub-Api-Version" = "2022-11-28" "Accept" = "application/vnd.github+json" diff --git a/Templates/Per Tenant Extension/.github/workflows/CreateTestApp.yaml b/Templates/Per Tenant Extension/.github/workflows/CreateTestApp.yaml index 05a44d39e..10d8cc3c8 100644 --- a/Templates/Per Tenant Extension/.github/workflows/CreateTestApp.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/CreateTestApp.yaml @@ -12,14 +12,14 @@ on: name: description: Name required: true - default: '.Test' + default: '.Test' publisher: description: Publisher required: true idrange: description: ID range required: true - default: '50000..99999' + default: '50000..99999' sampleCode: description: Include Sample code (Y/N) required: false diff --git a/Templates/Per Tenant Extension/.github/workflows/Current.yaml b/Templates/Per Tenant Extension/.github/workflows/Current.yaml index 69de07a70..97cf3d601 100644 --- a/Templates/Per Tenant Extension/.github/workflows/Current.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/Current.yaml @@ -44,12 +44,12 @@ jobs: uses: microsoft/AL-Go-Actions/ReadSettings@main with: shell: powershell - + - name: Determine Workflow Depth id: DetermineWorkflowDepth run: | Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "WorkflowDepth=$($env:workflowDepth)" - + - name: Determine Projects To Build id: determineProjectsToBuild uses: microsoft/AL-Go-Actions/DetermineProjectsToBuild@main @@ -74,7 +74,7 @@ jobs: project: ${{ matrix.project }} buildMode: ${{ matrix.buildMode }} projectDependenciesJson: ${{ needs.Initialization.outputs.projectDependenciesJson }} - secrets: 'licenseFileUrl,insiderSasToken,codeSignCertificateUrl,codeSignCertificatePassword,keyVaultCertificateUrl,keyVaultCertificatePassword,keyVaultClientId,gitHubPackagesContext,applicationInsightsConnectionString' + secrets: 'licenseFileUrl,insiderSasToken,codeSignCertificateUrl,*codeSignCertificatePassword,keyVaultCertificateUrl,*keyVaultCertificatePassword,keyVaultClientId,gitHubPackagesContext,applicationInsightsConnectionString' publishThisBuildArtifacts: ${{ needs.Initialization.outputs.workflowDepth > 1 }} artifactsNameSuffix: 'Current' diff --git a/Templates/Per Tenant Extension/.github/workflows/IncrementVersionNumber.yaml b/Templates/Per Tenant Extension/.github/workflows/IncrementVersionNumber.yaml index 2b882ce75..ea3287658 100644 --- a/Templates/Per Tenant Extension/.github/workflows/IncrementVersionNumber.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/IncrementVersionNumber.yaml @@ -69,7 +69,7 @@ jobs: project: ${{ github.event.inputs.project }} versionNumber: ${{ github.event.inputs.versionNumber }} directCommit: ${{ github.event.inputs.directCommit }} - + - name: Finalize the workflow if: always() uses: microsoft/AL-Go-Actions/WorkflowPostProcess@main diff --git a/Templates/Per Tenant Extension/.github/workflows/NextMajor.yaml b/Templates/Per Tenant Extension/.github/workflows/NextMajor.yaml index f0440df97..305092c9d 100644 --- a/Templates/Per Tenant Extension/.github/workflows/NextMajor.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/NextMajor.yaml @@ -44,12 +44,12 @@ jobs: uses: microsoft/AL-Go-Actions/ReadSettings@main with: shell: powershell - + - name: Determine Workflow Depth id: DetermineWorkflowDepth run: | Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "WorkflowDepth=$($env:workflowDepth)" - + - name: Determine Projects To Build id: determineProjectsToBuild uses: microsoft/AL-Go-Actions/DetermineProjectsToBuild@main @@ -74,7 +74,7 @@ jobs: project: ${{ matrix.project }} buildMode: ${{ matrix.buildMode }} projectDependenciesJson: ${{ needs.Initialization.outputs.projectDependenciesJson }} - secrets: 'licenseFileUrl,insiderSasToken,codeSignCertificateUrl,codeSignCertificatePassword,keyVaultCertificateUrl,keyVaultCertificatePassword,keyVaultClientId,gitHubPackagesContext,applicationInsightsConnectionString' + secrets: 'licenseFileUrl,insiderSasToken,codeSignCertificateUrl,*codeSignCertificatePassword,keyVaultCertificateUrl,*keyVaultCertificatePassword,keyVaultClientId,gitHubPackagesContext,applicationInsightsConnectionString' publishThisBuildArtifacts: ${{ needs.Initialization.outputs.workflowDepth > 1 }} artifactsNameSuffix: 'NextMajor' diff --git a/Templates/Per Tenant Extension/.github/workflows/NextMinor.yaml b/Templates/Per Tenant Extension/.github/workflows/NextMinor.yaml index cc6bc4412..c46c88bd9 100644 --- a/Templates/Per Tenant Extension/.github/workflows/NextMinor.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/NextMinor.yaml @@ -49,7 +49,7 @@ jobs: id: DetermineWorkflowDepth run: | Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "WorkflowDepth=$($env:workflowDepth)" - + - name: Determine Projects To Build id: determineProjectsToBuild uses: microsoft/AL-Go-Actions/DetermineProjectsToBuild@main @@ -74,7 +74,7 @@ jobs: project: ${{ matrix.project }} buildMode: ${{ matrix.buildMode }} projectDependenciesJson: ${{ needs.Initialization.outputs.projectDependenciesJson }} - secrets: 'licenseFileUrl,insiderSasToken,codeSignCertificateUrl,codeSignCertificatePassword,keyVaultCertificateUrl,keyVaultCertificatePassword,keyVaultClientId,gitHubPackagesContext,applicationInsightsConnectionString' + secrets: 'licenseFileUrl,insiderSasToken,codeSignCertificateUrl,*codeSignCertificatePassword,keyVaultCertificateUrl,*keyVaultCertificatePassword,keyVaultClientId,gitHubPackagesContext,applicationInsightsConnectionString' publishThisBuildArtifacts: ${{ needs.Initialization.outputs.workflowDepth > 1 }} artifactsNameSuffix: 'NextMinor' diff --git a/Templates/Per Tenant Extension/.github/workflows/PullRequestHandler.yaml b/Templates/Per Tenant Extension/.github/workflows/PullRequestHandler.yaml index 9bf73d26f..f67b8e50e 100644 --- a/Templates/Per Tenant Extension/.github/workflows/PullRequestHandler.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/PullRequestHandler.yaml @@ -62,12 +62,12 @@ jobs: uses: microsoft/AL-Go-Actions/ReadSettings@main with: shell: powershell - + - name: Determine Workflow Depth id: DetermineWorkflowDepth run: | Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "WorkflowDepth=$($env:workflowDepth)" - + - name: Determine Projects To Build id: determineProjectsToBuild uses: microsoft/AL-Go-Actions/DetermineProjectsToBuild@main @@ -93,7 +93,7 @@ jobs: project: ${{ matrix.project }} buildMode: ${{ matrix.buildMode }} projectDependenciesJson: ${{ needs.Initialization.outputs.projectDependenciesJson }} - secrets: 'licenseFileUrl,insiderSasToken,keyVaultCertificateUrl,keyVaultCertificatePassword,keyVaultClientId,gitHubPackagesContext,applicationInsightsConnectionString' + secrets: 'licenseFileUrl,insiderSasToken,keyVaultCertificateUrl,*keyVaultCertificatePassword,keyVaultClientId,gitHubPackagesContext,applicationInsightsConnectionString' publishThisBuildArtifacts: ${{ needs.Initialization.outputs.workflowDepth > 1 }} StatusCheck: diff --git a/Templates/Per Tenant Extension/.github/workflows/_BuildALGoProject.yaml b/Templates/Per Tenant Extension/.github/workflows/_BuildALGoProject.yaml index 7ee11db1c..3d5eac303 100644 --- a/Templates/Per Tenant Extension/.github/workflows/_BuildALGoProject.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/_BuildALGoProject.yaml @@ -10,7 +10,7 @@ on: required: false default: powershell type: string - runsOn: + runsOn: description: JSON-formatted string og the types of machine to run the build job on required: true type: string @@ -174,7 +174,7 @@ jobs: path: '${{ inputs.project }}/.buildartifacts/TestApps/' if-no-files-found: ignore retention-days: 1 - + - name: Publish artifacts - apps uses: actions/upload-artifact@v3 if: inputs.publishArtifacts diff --git a/Templates/Per Tenant Extension/SECURITY.md b/Templates/Per Tenant Extension/SECURITY.md index 926b8ae40..a050f362c 100644 --- a/Templates/Per Tenant Extension/SECURITY.md +++ b/Templates/Per Tenant Extension/SECURITY.md @@ -14,7 +14,7 @@ Instead, please report them to the Microsoft Security Response Center (MSRC) at If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc). -You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc). +You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc). Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: diff --git a/Templates/Per Tenant Extension/SUPPORT.md b/Templates/Per Tenant Extension/SUPPORT.md index 96927d757..424e7e4c1 100644 --- a/Templates/Per Tenant Extension/SUPPORT.md +++ b/Templates/Per Tenant Extension/SUPPORT.md @@ -1,11 +1,11 @@ # Support -## How to file issues and get help +## How to file issues and get help This GitHub repo is auto-generated from https://github.com/microsoft/AL-Go. Issues, bug tracking and feature requests should be done there. Please follow the documentation [here](https://github.com/microsoft/AL-Go/blob/main/Scenarios/Contribute.md) if you want to contribute to AL-Go for GitHub. -## Microsoft Support Policy +## Microsoft Support Policy Support for this **PROJECT or PRODUCT** is limited to the resources listed above. diff --git a/Tests/AL-Go-Helper.Test.ps1 b/Tests/AL-Go-Helper.Test.ps1 index f33a4b908..f6c49c39c 100644 --- a/Tests/AL-Go-Helper.Test.ps1 +++ b/Tests/AL-Go-Helper.Test.ps1 @@ -1,4 +1,4 @@ -Describe "AL-Go-Helper tests" { +Describe "AL-Go-Helper tests" { BeforeAll { . (Join-Path $PSScriptRoot '../Actions/AL-Go-Helper.ps1') } @@ -40,7 +40,7 @@ Describe "AL-Go-Helper tests" { } | ConvertTo-Json | ConvertFrom-Json $src.int2 = [Int32]3 $src.int3 = [Int32]4 - + # Merge the settings MergeCustomObjectIntoOrderedDictionary -dst $dest -src $src $dest.Count | Should -Be 13 @@ -61,7 +61,7 @@ Describe "AL-Go-Helper tests" { 'obj2' = [ordered]@{'c' = 'c'; 'd' = 'd'; 'e' = 'e'} 'obj3' = [ordered]@{'d' = 'd'; 'e' = 'e'; 'f' = 'f'} } | ConvertTo-Json | ConvertFrom-Json - + # Check that applying the same settings twice doesn't change the result 1..2 | ForEach-Object { MergeCustomObjectIntoOrderedDictionary -dst $dest -src $src @@ -95,17 +95,17 @@ Describe "AL-Go-Helper tests" { New-Item -Path (Join-Path $tempName "projectx/$ALGoFolderName") -ItemType Directory | Out-Null New-Item -Path (Join-Path $tempName "projecty/$ALGoFolderName") -ItemType Directory | Out-Null - + # Create settings files - # Property: Repo: Project (single): Project (multi): Workflow: Workflow: User: + # Property: Repo: Project (single): Project (multi): Workflow: Workflow: User: # if(branch=dev): - # Property1 repo1 single1 multi1 branch1 user1 - # Property2 repo2 workflow2 - # Property3 repo3 - # Arr1 @("repo1","repo2") - # Property4 single4 branch4 - # property5 multi5 - # property6 user6 + # Property1 repo1 single1 multi1 branch1 user1 + # Property2 repo2 workflow2 + # Property3 repo3 + # Arr1 @("repo1","repo2") + # Property4 single4 branch4 + # property5 multi5 + # property6 user6 @{ "property1" = "repo1"; "property2" = "repo2"; "property3" = "repo3"; "arr1" = @("repo1","repo2") } | ConvertTo-Json -Depth 99 | Set-Content -Path (Join-Path $githubFolder "AL-Go-Settings.json") -encoding utf8 -Force @{ "property1" = "single1"; "property4" = "single4" } | ConvertTo-Json -Depth 99 | @@ -262,7 +262,7 @@ Describe "AL-Go-Helper tests" { # Invalid Org(var) setting should throw $ENV:ALGoOrgSettings = 'this is not json' { ReadSettings -baseFolder $tempName -project 'Project' } | Should -Throw - + $ENV:ALGoOrgSettings = '' $ENV:ALGoRepoSettings = '' diff --git a/Tests/AddExistingApp.Action.Test.ps1 b/Tests/AddExistingApp.Action.Test.ps1 index cf7e5e7a0..92f8a2777 100644 --- a/Tests/AddExistingApp.Action.Test.ps1 +++ b/Tests/AddExistingApp.Action.Test.ps1 @@ -6,7 +6,9 @@ Describe "AddExistingApp Action Tests" { $actionName = "AddExistingApp" $scriptRoot = Join-Path $PSScriptRoot "..\Actions\$actionName" -Resolve $scriptName = "$actionName.ps1" + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'scriptPath', Justification = 'False positive.')] $scriptPath = Join-Path $scriptRoot $scriptName + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'actionScript', Justification = 'False positive.')] $actionScript = GetActionScript -scriptRoot $scriptRoot -scriptName $scriptName } diff --git a/Tests/AppHelper.Test.ps1 b/Tests/AppHelper.Test.ps1 index cb65cf133..149c4c814 100644 --- a/Tests/AppHelper.Test.ps1 +++ b/Tests/AppHelper.Test.ps1 @@ -1,4 +1,4 @@ -$here = Split-Path -Parent $MyInvocation.MyCommand.Path +$here = Split-Path -Parent $MyInvocation.MyCommand.Path # Reloading the module Get-Module AppHelper | Remove-Module -Force @@ -6,40 +6,40 @@ Import-Module (Join-Path -path $here -ChildPath "..\Actions\CreateApp\AppHelper. . (Join-Path -path $here -ChildPath "..\Actions\AL-Go-Helper.ps1" -Resolve) Describe 'AppHelper.psm1 Tests' { - It 'Confirm-IdRanges validates a valid PTE range' { - $ids = Confirm-IdRanges -templateType "PTE" -idrange "50000..99999" + It 'ConfirmIdRanges validates a valid PTE range' { + $ids = ConfirmIdRanges -templateType "PTE" -idrange "50000..99999" $ids[0] | Should -EQ "50000" $ids[1] | Should -EQ "99999" } - It 'Confirm-IdRanges throws on invalid PTE range' { - { Confirm-IdRanges -templateType "PTE" -idrange "5000..50200" } | Should -Throw - { Confirm-IdRanges -templateType "PTE" -idrange "50000..5000" } | Should -Throw - { Confirm-IdRanges -templateType "PTE" -idrange "50100..50000" } | Should -Throw - { Confirm-IdRanges -templateType "PTE" -idrange "50100..100000" } | Should -Throw + It 'ConfirmIdRanges throws on invalid PTE range' { + { ConfirmIdRanges -templateType "PTE" -idrange "5000..50200" } | Should -Throw + { ConfirmIdRanges -templateType "PTE" -idrange "50000..5000" } | Should -Throw + { ConfirmIdRanges -templateType "PTE" -idrange "50100..50000" } | Should -Throw + { ConfirmIdRanges -templateType "PTE" -idrange "50100..100000" } | Should -Throw } - It 'Confirm-IdRanges validates a valid AppSource app range' { - $ids = Confirm-IdRanges -templateType "AppSource App" -idrange "100000..110000" + It 'ConfirmIdRanges validates a valid AppSource app range' { + $ids = ConfirmIdRanges -templateType "AppSource App" -idrange "100000..110000" $ids[0] | Should -EQ "100000" $ids[1] | Should -EQ "110000" } - It '(Confirm-IdRanges) should throw on invalid AppSource app range' { - { Confirm-IdRanges -templateType "AppSource app" -idrange "99999..110000" } | Should -Throw - { Confirm-IdRanges -templateType "AppSource app" -idrange "100000..1100" } | Should -Throw - { Confirm-IdRanges -templateType "AppSource app" -idrange "110000..100000" } | Should -Throw - { Confirm-IdRanges -templateType "AppSource app" -idrange "110000..1000000000000000000000" } | Should -Throw + It '(ConfirmIdRanges) should throw on invalid AppSource app range' { + { ConfirmIdRanges -templateType "AppSource app" -idrange "99999..110000" } | Should -Throw + { ConfirmIdRanges -templateType "AppSource app" -idrange "100000..1100" } | Should -Throw + { ConfirmIdRanges -templateType "AppSource app" -idrange "110000..100000" } | Should -Throw + { ConfirmIdRanges -templateType "AppSource app" -idrange "110000..1000000000000000000000" } | Should -Throw } - It 'Should create a new app by calling New-SampleApp' { + It 'Should create a new app by calling NewSampleApp' { $sampleAppFolder = Join-Path $TestDrive "SampleApp" - New-SampleApp -destinationPath $sampleAppFolder -name "SampleApp" -publisher "TestPublisher" -version "1.0.0.0" -idrange "50101", "50120" -sampleCode $true + NewSampleApp -destinationPath $sampleAppFolder -name "SampleApp" -publisher "TestPublisher" -version "1.0.0.0" -idrange "50101", "50120" -sampleCode $true $sampleAppFolder | Should -Exist $sampleAppAppJson = Join-Path $sampleAppFolder "app.json" $sampleAppAppJson | Should -Exist - + $appJson = Get-Content -Path $sampleAppAppJson -Encoding UTF8 | ConvertFrom-Json $appJson.name | Should -be "SampleApp" $appJson.publisher | Should -be "TestPublisher" @@ -53,14 +53,14 @@ Describe 'AppHelper.psm1 Tests' { (Join-Path $sampleAppFolder ".vscode/launch.json") | Should -Exist } - It 'Should create a new test app by calling New-SampleTestApp' { + It 'Should create a new test app by calling NewSampleTestApp' { $sampleAppFolder = Join-Path $TestDrive "TestPTE" - New-SampleTestApp -destinationPath $sampleAppFolder -name "TestPTE" -publisher "TestPublisher" -version "1.0.0.0" -idrange "50101", "50120" -sampleCode $true + NewSampleTestApp -destinationPath $sampleAppFolder -name "TestPTE" -publisher "TestPublisher" -version "1.0.0.0" -idrange "50101", "50120" -sampleCode $true $sampleAppFolder | Should -Exist $sampleAppAppJson = Join-Path $sampleAppFolder "app.json" $sampleAppAppJson | Should -Exist - + $appJson = Get-Content -Path $sampleAppAppJson -Encoding UTF8 | ConvertFrom-Json $appJson.name | Should -be "TestPTE" $appJson.publisher | Should -be "TestPublisher" @@ -76,42 +76,42 @@ Describe 'AppHelper.psm1 Tests' { It 'Insert new app folder ahead of .AL-Go' { $workspaceFolders = '[{"path":".AL-Go"}]' | ConvertFrom-Json - $workspaceFolders = @(Add-NewAppFolderToWorkspaceFolders -workspaceFolder $workspaceFolders -appFolder 'newfolder') + $workspaceFolders = @(AddNewAppFolderToWorkspaceFolders -workspaceFolder $workspaceFolders -appFolder 'newfolder') (ConvertTo-Json -InputObject $workspaceFolders -Compress) | Should -Be '[{"path":"newfolder"},{"path":".AL-Go"}]' } It 'Insert new app folder ahead of .AL-Go and .github' { $workspaceFolders = '[{"path":".AL-Go"},{"path":".github"}]' | ConvertFrom-Json - $workspaceFolders = @(Add-NewAppFolderToWorkspaceFolders -workspaceFolder $workspaceFolders -appFolder 'newfolder') + $workspaceFolders = @(AddNewAppFolderToWorkspaceFolders -workspaceFolder $workspaceFolders -appFolder 'newfolder') (ConvertTo-Json -InputObject $workspaceFolders -Compress) |Should -Be '[{"path":"newfolder"},{"path":".AL-Go"},{"path":".github"}]' } It 'Insert new app folder after onefolder ahead of .AL-Go and .github' { $workspaceFolders = '[{"path":"oneFolder"},{"path":".AL-Go"},{"path":".github"}]' | ConvertFrom-Json - $workspaceFolders = @(Add-NewAppFolderToWorkspaceFolders -workspaceFolder $workspaceFolders -appFolder 'newfolder') + $workspaceFolders = @(AddNewAppFolderToWorkspaceFolders -workspaceFolder $workspaceFolders -appFolder 'newfolder') (ConvertTo-Json -InputObject $workspaceFolders -Compress) | Should -Be '[{"path":"onefolder"},{"path":"newfolder"},{"path":".AL-Go"},{"path":".github"}]' } It 'Insert new app folder after .AL-Go, .github and onefolder' { $workspaceFolders = '[{"path":".AL-Go"},{"path":".github"},{"path":"oneFolder"}]' | ConvertFrom-Json - $workspaceFolders = @(Add-NewAppFolderToWorkspaceFolders -workspaceFolder $workspaceFolders -appFolder 'newfolder') + $workspaceFolders = @(AddNewAppFolderToWorkspaceFolders -workspaceFolder $workspaceFolders -appFolder 'newfolder') (ConvertTo-Json -InputObject $workspaceFolders -Compress) | Should -Be '[{"path":".AL-Go"},{"path":".github"},{"path":"onefolder"},{"path":"newfolder"}]' } It 'Insert new app folder in empty list' { $workspaceFolders = '[]' | ConvertFrom-Json - $workspaceFolders = @(Add-NewAppFolderToWorkspaceFolders -workspaceFolder $workspaceFolders -appFolder 'newfolder') + $workspaceFolders = @(AddNewAppFolderToWorkspaceFolders -workspaceFolder $workspaceFolders -appFolder 'newfolder') (ConvertTo-Json -InputObject $workspaceFolders -Compress) | Should -Be '[{"path":"newfolder"}]' } It 'Insert new app folder in null object' { $workspaceFolders = $null - $workspaceFolders = @(Add-NewAppFolderToWorkspaceFolders -workspaceFolder $workspaceFolders -appFolder 'newfolder') + $workspaceFolders = @(AddNewAppFolderToWorkspaceFolders -workspaceFolder $workspaceFolders -appFolder 'newfolder') (ConvertTo-Json -InputObject $workspaceFolders -Compress) | Should -Be '[{"path":"newfolder"}]' } diff --git a/Tests/CalculateArtifactNames.Test.ps1 b/Tests/CalculateArtifactNames.Test.ps1 index c34dead47..a2b000893 100644 --- a/Tests/CalculateArtifactNames.Test.ps1 +++ b/Tests/CalculateArtifactNames.Test.ps1 @@ -1,4 +1,4 @@ -Get-Module TestActionsHelper | Remove-Module -Force +Get-Module TestActionsHelper | Remove-Module -Force Import-Module (Join-Path $PSScriptRoot 'TestActionsHelper.psm1') Describe 'CalculateArtifactNames Action Tests' { @@ -7,7 +7,9 @@ Describe 'CalculateArtifactNames Action Tests' { $actionName = "CalculateArtifactNames" $scriptRoot = Join-Path $PSScriptRoot "..\Actions\$actionName" -Resolve $scriptName = "$actionName.ps1" + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'scriptPath', Justification = 'False positive.')] $scriptPath = Join-Path $scriptRoot $scriptName + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'actionScript', Justification = 'False positive.')] $actionScript = GetActionScript -scriptRoot $scriptRoot -scriptName $scriptName $env:Settings = '{ "appBuild": 123, "repoVersion": "22.0", "appRevision": 0,"repoName": "AL-GO"}' @@ -30,7 +32,7 @@ Describe 'CalculateArtifactNames Action Tests' { -project $project ` -buildMode $buildMode ` -branchName $branchName - + $generatedOutPut = Get-Content $env:GITHUB_OUTPUT -Encoding UTF8 $generatedOutPut | Should -Contain "ThisBuildAppsArtifactsName=thisbuild-ALGOProject-CleanApps" $generatedOutPut | Should -Contain "ThisBuildTestAppsArtifactsName=thisbuild-ALGOProject-CleanTestApps" @@ -52,7 +54,7 @@ Describe 'CalculateArtifactNames Action Tests' { -project $project ` -buildMode $buildMode ` -branchName $branchName - + $generatedOutPut = Get-Content $env:GITHUB_OUTPUT -Encoding UTF8 $generatedOutPut | Should -Contain "ThisBuildAppsArtifactsName=thisbuild-ALGOProject-Apps" $generatedOutPut | Should -Contain "ThisBuildTestAppsArtifactsName=thisbuild-ALGOProject-TestApps" @@ -72,7 +74,7 @@ Describe 'CalculateArtifactNames Action Tests' { -project $project ` -buildMode $buildMode ` -branchName $branchName - + $generatedOutPut = Get-Content $env:GITHUB_OUTPUT -Encoding UTF8 $generatedOutPut | Should -Contain "ThisBuildAppsArtifactsName=thisbuild-ALGOProject-Apps" $generatedOutPut | Should -Contain "ThisBuildTestAppsArtifactsName=thisbuild-ALGOProject-TestApps" @@ -97,7 +99,7 @@ Describe 'CalculateArtifactNames Action Tests' { # In rare cases, when this test is run at the end of the day, the date will change between the time the script is run and the time the test is run. $currentDate = [DateTime]::UtcNow.ToString('yyyyMMdd') - + $generatedOutPut = Get-Content $env:GITHUB_OUTPUT -Encoding UTF8 $generatedOutPut | Should -Contain "ThisBuildAppsArtifactsName=thisbuild-ALGOProject-Apps" $generatedOutPut | Should -Contain "ThisBuildTestAppsArtifactsName=thisbuild-ALGOProject-TestApps" @@ -124,7 +126,7 @@ Describe 'CalculateArtifactNames Action Tests' { # In rare cases, when this test is run at the end of the day, the date will change between the time the script is run and the time the test is run. $currentDate = [DateTime]::UtcNow.ToString('yyyyMMdd') - + $generatedOutPut = Get-Content $env:GITHUB_OUTPUT -Encoding UTF8 $generatedOutPut | Should -Contain "ThisBuildAppsArtifactsName=thisbuild-ALGOProject_øåæ-Apps" $generatedOutPut | Should -Contain "ThisBuildTestAppsArtifactsName=thisbuild-ALGOProject_øåæ-TestApps" diff --git a/Tests/CheckForUpdates.Action.Test.ps1 b/Tests/CheckForUpdates.Action.Test.ps1 index 8b0f4177a..2d7bdd77b 100644 --- a/Tests/CheckForUpdates.Action.Test.ps1 +++ b/Tests/CheckForUpdates.Action.Test.ps1 @@ -26,7 +26,7 @@ Describe "CheckForUpdates Action Tests" { It 'Test YamlClass' { . (Join-Path $scriptRoot "yamlclass.ps1") $yaml = [Yaml]::load((Join-Path $PSScriptRoot 'YamlSnippet.txt')) - + # Yaml file should have 77 entries $yaml.content.Count | Should -be 77 @@ -35,41 +35,41 @@ Describe "CheckForUpdates Action Tests" { $yaml.Find('permissions:', [ref] $start, [ref] $count) | Should -be $true $start | Should -be 17 $count | Should -be 5 - + # Locate lines for permissions section (excluding permissions: line) $yaml.Find('permissions:/', [ref] $start, [ref] $count) | Should -be $true $start | Should -be 18 $count | Should -be 4 - + # Get Yaml class for permissions section (excluding permissions: line) $yaml.Get('permissions:/').content | ForEach-Object { $_ | Should -not -belike ' *' } - + # Locate section called permissionos (should return false) $yaml.Find('permissionos:', [ref] $start, [ref] $count) | Should -Not -be $true - + # Check checkout step ($yaml.Get('jobs:/Initialization:/steps:/- name: Checkout').content -join '') | Should -be "- name: Checkout uses: actions/checkout@v3 with: lfs: true" - + # Get Shell line in read Settings step ($yaml.Get('jobs:/Initialization:/steps:/- name: Read settings/with:/shell:').content -join '') | Should -be "shell: powershell" - + # Get Jobs section (without the jobs: line) $jobsYaml = $yaml.Get('jobs:/') - + # Locate CheckForUpdates $jobsYaml.Find('CheckForUpdates:', [ref] $start, [ref] $count) | Should -be $true $start | Should -be 25 $count | Should -be 21 - + # Replace all occurances of 'shell: powershell' with 'shell: pwsh' $yaml.ReplaceAll('shell: powershell','shell: pwsh') $yaml.content[46].Trim() | Should -be 'shell: pwsh' - + # Replace Permissions $yaml.Replace('Permissions:/',@('contents: write','actions: read')) $yaml.content[44].Trim() | Should -be 'shell: pwsh' $yaml.content.Count | Should -be 75 - + # Get Jobs section (without the jobs: line) $jobsYaml = $yaml.Get('jobs:/') ($jobsYaml.Get('Initialization:/steps:/- name: Read settings/with:/shell:').content -join '') | Should -be "shell: pwsh" diff --git a/Tests/CreateApp.Action.Test.ps1 b/Tests/CreateApp.Action.Test.ps1 index b678d40b2..1b2c89857 100644 --- a/Tests/CreateApp.Action.Test.ps1 +++ b/Tests/CreateApp.Action.Test.ps1 @@ -6,7 +6,9 @@ Describe "CreateApp Action Tests" { $actionName = "CreateApp" $scriptRoot = Join-Path $PSScriptRoot "..\Actions\$actionName" -Resolve $scriptName = "$actionName.ps1" + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'scriptPath', Justification = 'False positive.')] $scriptPath = Join-Path $scriptRoot $scriptName + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'actionScript', Justification = 'False positive.')] $actionScript = GetActionScript -scriptRoot $scriptRoot -scriptName $scriptName } diff --git a/Tests/CreateDevelopmentEnvironment.Action.Test.ps1 b/Tests/CreateDevelopmentEnvironment.Action.Test.ps1 index 313641e99..ec45cffa9 100644 --- a/Tests/CreateDevelopmentEnvironment.Action.Test.ps1 +++ b/Tests/CreateDevelopmentEnvironment.Action.Test.ps1 @@ -6,7 +6,9 @@ Describe "CreateDevelopmentEnvironment Action Tests" { $actionName = "CreateDevelopmentEnvironment" $scriptRoot = Join-Path $PSScriptRoot "..\Actions\$actionName" -Resolve $scriptName = "$actionName.ps1" + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'scriptPath', Justification = 'False positive.')] $scriptPath = Join-Path $scriptRoot $scriptName + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'actionScript', Justification = 'False positive.')] $actionScript = GetActionScript -scriptRoot $scriptRoot -scriptName $scriptName } diff --git a/Tests/CreateReleaseNotes.Test.ps1 b/Tests/CreateReleaseNotes.Test.ps1 index 2e352768c..78ae551d5 100644 --- a/Tests/CreateReleaseNotes.Test.ps1 +++ b/Tests/CreateReleaseNotes.Test.ps1 @@ -1,4 +1,4 @@ -Get-Module Github-Helper | Remove-Module -Force +Get-Module Github-Helper | Remove-Module -Force Import-Module (Join-Path $PSScriptRoot '..\Actions\Github-Helper.psm1' -Resolve) Get-Module TestActionsHelper | Remove-Module -Force Import-Module (Join-Path $PSScriptRoot 'TestActionsHelper.psm1') @@ -15,7 +15,9 @@ Describe 'CreateReleaseNotes Tests' { $actionName = "CreateReleaseNotes" $scriptRoot = Join-Path $PSScriptRoot "..\Actions\$actionName" -Resolve $scriptName = "$actionName.ps1" + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'scriptPath', Justification = 'False positive.')] $scriptPath = Join-Path $scriptRoot $scriptName + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'actionScript', Justification = 'False positive.')] $actionScript = GetActionScript -scriptRoot $scriptRoot -scriptName $scriptName } @@ -34,9 +36,9 @@ Describe 'CreateReleaseNotes Tests' { } YamlTest -scriptRoot $scriptRoot -actionName $actionName -actionScript $actionScript -permissions $permissions -outputs $outputs } - + It 'Confirms that right functions are called' { - Mock GetLatestRelease { return "{""tag_name"" : ""1.0.0.0""}" | ConvertFrom-Json } + Mock GetLatestRelease { return "{""tag_name"" : ""1.0.0.0""}" | ConvertFrom-Json } Mock GetReleaseNotes { return "{ ""name"": ""tagname"", ""body"": ""Mocked notes"" @@ -45,15 +47,15 @@ Describe 'CreateReleaseNotes Tests' { Mock CreateScope {} . $scriptPath -token "" -actor "" -tag_name "1.0.5" -parentTelemetryScopeJson "{}" - - Should -Invoke -CommandName GetLatestRelease -Exactly -Times 1 + + 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" } $releaseNotes | Should -Be "Mocked notes" } It 'Confirm right parameters are passed' { - Mock GetLatestRelease { return $null } + Mock GetLatestRelease { return $null } Mock GetReleaseNotes {return "{ ""name"": ""tagname"", ""body"": ""Mocked notes"" @@ -62,8 +64,8 @@ Describe 'CreateReleaseNotes Tests' { Mock CreateScope {} . $scriptPath -token "" -actor "" -tag_name "1.0.5" -parentTelemetryScopeJson "{}" - - Should -Invoke -CommandName GetLatestRelease -Exactly -Times 1 + + 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 "" } $releaseNotes | Should -Be "Mocked notes" diff --git a/Tests/Deliver.Action.Test.ps1 b/Tests/Deliver.Action.Test.ps1 index fc7d1f8fc..2b10d5103 100644 --- a/Tests/Deliver.Action.Test.ps1 +++ b/Tests/Deliver.Action.Test.ps1 @@ -6,7 +6,9 @@ Describe "Deliver Action Tests" { $actionName = "Deliver" $scriptRoot = Join-Path $PSScriptRoot "..\Actions\$actionName" -Resolve $scriptName = "$actionName.ps1" + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'scriptPath', Justification = 'False positive.')] $scriptPath = Join-Path $scriptRoot $scriptName + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'actionScript', Justification = 'False positive.')] $actionScript = GetActionScript -scriptRoot $scriptRoot -scriptName $scriptName } diff --git a/Tests/Deploy.Action.Test.ps1 b/Tests/Deploy.Action.Test.ps1 index 0c9aa299c..ee5938abd 100644 --- a/Tests/Deploy.Action.Test.ps1 +++ b/Tests/Deploy.Action.Test.ps1 @@ -6,7 +6,9 @@ Describe "Deploy Action Tests" { $actionName = "Deploy" $scriptRoot = Join-Path $PSScriptRoot "..\Actions\$actionName" -Resolve $scriptName = "$actionName.ps1" + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'scriptPath', Justification = 'False positive.')] $scriptPath = Join-Path $scriptRoot $scriptName + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'actionScript', Justification = 'False positive.')] $actionScript = GetActionScript -scriptRoot $scriptRoot -scriptName $scriptName } diff --git a/Tests/DetermineArtifactUrl.Test.ps1 b/Tests/DetermineArtifactUrl.Test.ps1 index fbab90c00..cead7ed1e 100644 --- a/Tests/DetermineArtifactUrl.Test.ps1 +++ b/Tests/DetermineArtifactUrl.Test.ps1 @@ -1,4 +1,4 @@ -Import-Module (Join-Path $PSScriptRoot 'TestActionsHelper.psm1') -Force +Import-Module (Join-Path $PSScriptRoot 'TestActionsHelper.psm1') -Force # Settings, which affects the behavior of DetermineArtifactUrl # - artifact - specifies an artifactUrl (or pattern) to use @@ -119,6 +119,7 @@ Describe "DetermineArtifactUrl Action Test" { $actionName = "DetermineArtifactUrl" $scriptRoot = Join-Path $PSScriptRoot "..\Actions\$actionName" -Resolve $scriptName = "$actionName.ps1" + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'actionScript', Justification = 'False positive.')] $actionScript = GetActionScript -scriptRoot $scriptRoot -scriptName $scriptName } diff --git a/Tests/DetermineDeliveryTargets.Test.ps1 b/Tests/DetermineDeliveryTargets.Test.ps1 index f15fda3b4..c9c2fc64f 100644 --- a/Tests/DetermineDeliveryTargets.Test.ps1 +++ b/Tests/DetermineDeliveryTargets.Test.ps1 @@ -1,10 +1,11 @@ -Import-Module (Join-Path $PSScriptRoot 'TestActionsHelper.psm1') -Force +Import-Module (Join-Path $PSScriptRoot 'TestActionsHelper.psm1') -Force Describe "DetermineDeliveryTargets Action Test" { BeforeAll { $actionName = "DetermineDeliveryTargets" $scriptRoot = Join-Path $PSScriptRoot "..\Actions\$actionName" -Resolve $scriptName = "$actionName.ps1" + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'actionScript', Justification = 'False positive.')] $actionScript = GetActionScript -scriptRoot $scriptRoot -scriptName $scriptName } diff --git a/Tests/DetermineDeploymentEnvironments.Test.ps1 b/Tests/DetermineDeploymentEnvironments.Test.ps1 index 67ccec06a..f285f9c59 100644 --- a/Tests/DetermineDeploymentEnvironments.Test.ps1 +++ b/Tests/DetermineDeploymentEnvironments.Test.ps1 @@ -1,10 +1,11 @@ -Import-Module (Join-Path $PSScriptRoot 'TestActionsHelper.psm1') -Force +Import-Module (Join-Path $PSScriptRoot 'TestActionsHelper.psm1') -Force Describe "DetermineDeploymentEnvironments Action Test" { BeforeAll { $actionName = "DetermineDeploymentEnvironments" $scriptRoot = Join-Path $PSScriptRoot "..\Actions\$actionName" -Resolve $scriptName = "$actionName.ps1" + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'actionScript', Justification = 'False positive.')] $actionScript = GetActionScript -scriptRoot $scriptRoot -scriptName $scriptName function PassGeneratedOutput() { diff --git a/Tests/DetermineProjectsToBuild.Test.ps1 b/Tests/DetermineProjectsToBuild.Test.ps1 index 1d5fa51ef..573cfd183 100644 --- a/Tests/DetermineProjectsToBuild.Test.ps1 +++ b/Tests/DetermineProjectsToBuild.Test.ps1 @@ -1,4 +1,4 @@ -Import-Module (Join-Path $PSScriptRoot 'TestActionsHelper.psm1') -Force +Import-Module (Join-Path $PSScriptRoot 'TestActionsHelper.psm1') -Force Describe "Get-ProjectsToBuild" { BeforeAll { diff --git a/Tests/GitHub-Helper.Test.ps1 b/Tests/GitHub-Helper.Test.ps1 index 322832e69..4751969ba 100644 --- a/Tests/GitHub-Helper.Test.ps1 +++ b/Tests/GitHub-Helper.Test.ps1 @@ -1,4 +1,4 @@ -Describe "GitHub-Helper Tests" { +Describe "GitHub-Helper Tests" { BeforeAll { . (Join-Path $PSScriptRoot '../Actions/AL-Go-Helper.ps1') } diff --git a/Tests/IncrementVersionNumber.Action.Test.ps1 b/Tests/IncrementVersionNumber.Action.Test.ps1 index ee093d3c2..a2ef7485a 100644 --- a/Tests/IncrementVersionNumber.Action.Test.ps1 +++ b/Tests/IncrementVersionNumber.Action.Test.ps1 @@ -6,7 +6,9 @@ Describe "IncrementVersionNumber Action Tests" { $actionName = "IncrementVersionNumber" $scriptRoot = Join-Path $PSScriptRoot "..\Actions\$actionName" -Resolve $scriptName = "$actionName.ps1" + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'scriptPath', Justification = 'False positive.')] $scriptPath = Join-Path $scriptRoot $scriptName + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'actionScript', Justification = 'False positive.')] $actionScript = GetActionScript -scriptRoot $scriptRoot -scriptName $scriptName } diff --git a/Tests/PipelineCleanup.Action.Test.ps1 b/Tests/PipelineCleanup.Action.Test.ps1 index 588c211ae..c3059067d 100644 --- a/Tests/PipelineCleanup.Action.Test.ps1 +++ b/Tests/PipelineCleanup.Action.Test.ps1 @@ -6,7 +6,9 @@ Describe "PipelineCleanup Action Tests" { $actionName = "PipelineCleanup" $scriptRoot = Join-Path $PSScriptRoot "..\Actions\$actionName" -Resolve $scriptName = "$actionName.ps1" + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'scriptPath', Justification = 'False positive.')] $scriptPath = Join-Path $scriptRoot $scriptName + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'actionScript', Justification = 'False positive.')] $actionScript = GetActionScript -scriptRoot $scriptRoot -scriptName $scriptName } diff --git a/Tests/PullRequestStatusCheck.Test.ps1 b/Tests/PullRequestStatusCheck.Test.ps1 index 7dca1bcbf..7c05bb30e 100644 --- a/Tests/PullRequestStatusCheck.Test.ps1 +++ b/Tests/PullRequestStatusCheck.Test.ps1 @@ -6,7 +6,9 @@ Describe "PullRequestStatusCheck Action Tests" { $actionName = "PullRequestStatusCheck" $scriptRoot = Join-Path $PSScriptRoot "..\Actions\$actionName" -Resolve $scriptName = "$actionName.ps1" + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'scriptPath', Justification = 'False positive.')] $scriptPath = Join-Path $scriptRoot $scriptName + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'actionScript', Justification = 'False positive.')] $actionScript = GetActionScript -scriptRoot $scriptRoot -scriptName $scriptName $ENV:GITHUB_REPOSITORY = "organization/repository" $ENV:GITHUB_RUN_ID = "123456" diff --git a/Tests/ReadSecrets.Action.Test.ps1 b/Tests/ReadSecrets.Action.Test.ps1 index 6873eebc2..8eba15497 100644 --- a/Tests/ReadSecrets.Action.Test.ps1 +++ b/Tests/ReadSecrets.Action.Test.ps1 @@ -6,7 +6,9 @@ Describe "ReadSecrets Action Tests" { $actionName = "ReadSecrets" $scriptRoot = Join-Path $PSScriptRoot "..\Actions\$actionName" -Resolve $scriptName = "$actionName.ps1" + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'scriptPath', Justification = 'False positive.')] $scriptPath = Join-Path $scriptRoot $scriptName + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'actionScript', Justification = 'False positive.')] $actionScript = GetActionScript -scriptRoot $scriptRoot -scriptName $scriptName } diff --git a/Tests/ReadSettings.Action.Test.ps1 b/Tests/ReadSettings.Action.Test.ps1 index a449af16c..a803b9aab 100644 --- a/Tests/ReadSettings.Action.Test.ps1 +++ b/Tests/ReadSettings.Action.Test.ps1 @@ -6,7 +6,9 @@ Describe "ReadSettings Action Tests" { $actionName = "ReadSettings" $scriptRoot = Join-Path $PSScriptRoot "..\Actions\$actionName" -Resolve $scriptName = "$actionName.ps1" + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'scriptPath', Justification = 'False positive.')] $scriptPath = Join-Path $scriptRoot $scriptName + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'actionScript', Justification = 'False positive.')] $actionScript = GetActionScript -scriptRoot $scriptRoot -scriptName $scriptName } diff --git a/Tests/ResolveProjectFolders.Test.ps1 b/Tests/ResolveProjectFolders.Test.ps1 index de8e0ff33..301090ad8 100644 --- a/Tests/ResolveProjectFolders.Test.ps1 +++ b/Tests/ResolveProjectFolders.Test.ps1 @@ -1,4 +1,4 @@ -Describe "ResolveProjectFolders" { +Describe "ResolveProjectFolders" { BeforeAll { . (Join-Path $PSScriptRoot '../Actions/AL-Go-Helper.ps1') @@ -59,7 +59,7 @@ Describe "ResolveProjectFolders" { ) } - $alGoSettingsContent = $ALGoSettings | ConvertTo-Json -Depth 99 + $alGoSettingsContent = $ALGoSettings | ConvertTo-Json -Depth 99 New-Item -Path $ALGoSettingsFile -Value $alGoSettingsContent -Force # Create the app folders @@ -72,7 +72,7 @@ Describe "ResolveProjectFolders" { "testApp2" ) $apps = @{} - + $appFolders | ForEach-Object { $appFolder = Join-Path $ALGoProjectFolder $_ New-Item $appFolder -ItemType Directory | Out-Null @@ -84,7 +84,7 @@ Describe "ResolveProjectFolders" { "name" = $_ "dependencies" = @() } - $appJsonContent = $app | ConvertTo-Json -Depth 99 + $appJsonContent = $app | ConvertTo-Json -Depth 99 New-Item -Path $appJson -Value $appJsonContent -Force $apps.Add($_, $app) @@ -139,7 +139,7 @@ Describe "ResolveProjectFolders" { $projectSettings = @{ 'appFolders' = @('app1'); 'testFolders' = @(); 'bcptTestFolders' = @()} ResolveProjectFolders -baseFolder $baseFolder -project $ALGoProject -projectSettings ([ref] $projectSettings) - + $projectSettings.appFolders | Should -HaveCount 1 $projectSettings.appFolders | Should -Contain $(Join-Path '.' 'app1') @@ -152,7 +152,7 @@ Describe "ResolveProjectFolders" { $projectSettings = @{ 'appFolders' = @('nonExistingApp', 'app1'); 'testFolders' = @('nonExistingTestApp'); 'bcptTestFolders' = @('nonExistingBCPTApp')} ResolveProjectFolders -baseFolder $baseFolder -project $ALGoProject -projectSettings ([ref] $projectSettings) - + $projectSettings.appFolders | Should -HaveCount 1 $projectSettings.appFolders | Should -Contain $(Join-Path '.' 'app1') @@ -165,7 +165,7 @@ Describe "ResolveProjectFolders" { $projectSettings = @{ 'appFolders' = @('nonExistingApp'); 'testFolders' = @('nonExistingTestApp'); 'bcptTestFolders' = @()} ResolveProjectFolders -baseFolder $baseFolder -project $ALGoProject -projectSettings ([ref] $projectSettings) - + $projectSettings.appFolders | Should -HaveCount 0 $projectSettings.testFolders | Should -HaveCount 0 @@ -186,7 +186,7 @@ Describe "ResolveProjectFolders" { $projectSettings.bcptTestFolders | Should -HaveCount 1 $projectSettings.bcptTestFolders | Should -Contain $(Join-Path '.' 'bcptApp2') } - + AfterAll { Pop-Location Remove-Item -Path $baseFolder -Recurse -Force diff --git a/Tests/RunPipeline.Action.Test.ps1 b/Tests/RunPipeline.Action.Test.ps1 index 0651b5f51..228232421 100644 --- a/Tests/RunPipeline.Action.Test.ps1 +++ b/Tests/RunPipeline.Action.Test.ps1 @@ -6,7 +6,9 @@ Describe "RunPipeline Action Tests" { $actionName = "RunPipeline" $scriptRoot = Join-Path $PSScriptRoot "..\Actions\$actionName" -Resolve $scriptName = "$actionName.ps1" + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'scriptPath', Justification = 'False positive.')] $scriptPath = Join-Path $scriptRoot $scriptName + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'actionScript', Justification = 'False positive.')] $actionScript = GetActionScript -scriptRoot $scriptRoot -scriptName $scriptName } diff --git a/Tests/Sign.Test.ps1 b/Tests/Sign.Test.ps1 index 94ef05a61..e181fbafc 100644 --- a/Tests/Sign.Test.ps1 +++ b/Tests/Sign.Test.ps1 @@ -6,7 +6,9 @@ Describe "Sign Action Tests" { $actionName = "Sign" $scriptRoot = Join-Path $PSScriptRoot "..\Actions\$actionName" -Resolve $scriptName = "$actionName.ps1" + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'scriptPath', Justification = 'False positive.')] $scriptPath = Join-Path $scriptRoot $scriptName + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'actionScript', Justification = 'False positive.')] $actionScript = GetActionScript -scriptRoot $scriptRoot -scriptName $scriptName } diff --git a/Tests/TestActionsHelper.psm1 b/Tests/TestActionsHelper.psm1 index f8a754ff2..9913b8139 100644 --- a/Tests/TestActionsHelper.psm1 +++ b/Tests/TestActionsHelper.psm1 @@ -53,7 +53,7 @@ function YamlTest { $systemParameters = @($emptyCmd.Parameters.Keys.GetEnumerator() | ForEach-Object { $_ }) Invoke-Expression $actionScript - + $yaml = [System.Text.StringBuilder]::new() $yaml.AppendLine("name: *") | Out-Null $yaml.AppendLine("author: *") | Out-Null @@ -151,7 +151,7 @@ function YamlTest { $yaml.AppendLine("branding:") | Out-Null $yaml.AppendLine(" icon: terminal") | Out-Null $yaml.Append(" color: blue") | Out-Null - + $yamlLines = $yaml.ToString().Replace("`r","").Split("`n") $actualYaml = @(Get-Content -path (Join-Path $scriptRoot "action.yaml")) diff --git a/Tests/VerifyPRChanges.Action.Test.ps1 b/Tests/VerifyPRChanges.Action.Test.ps1 index 14c7a7f59..a7a8f6162 100644 --- a/Tests/VerifyPRChanges.Action.Test.ps1 +++ b/Tests/VerifyPRChanges.Action.Test.ps1 @@ -1,4 +1,4 @@ -Get-Module TestActionsHelper | Remove-Module -Force +Get-Module TestActionsHelper | Remove-Module -Force Import-Module (Join-Path $PSScriptRoot 'TestActionsHelper.psm1') Describe 'VerifyPRChanges Action Tests' { @@ -7,7 +7,9 @@ Describe 'VerifyPRChanges Action Tests' { $actionName = "VerifyPRChanges" $scriptRoot = Join-Path $PSScriptRoot "..\Actions\$actionName" -Resolve $scriptName = "$actionName.ps1" + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'scriptPath', Justification = 'False positive.')] $scriptPath = Join-Path $scriptRoot $scriptName + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'actionScript', Justification = 'False positive.')] $actionScript = GetActionScript -scriptRoot $scriptRoot -scriptName $scriptName } @@ -15,11 +17,11 @@ Describe 'VerifyPRChanges Action Tests' { Mock -CommandName Invoke-WebRequest -MockWith { '{ "changed_files": 1 }' } -ParameterFilter { $Uri -and $Uri -notmatch "/files"} Mock -CommandName Invoke-WebRequest -MockWith { '[{"filename": "Scripts/BuildScript.ps1", "status": "modified"}]' } -ParameterFilter { $Uri -and $Uri -match "/files"} - { + { & $scriptPath ` -prBaseRepository "microsoft/AL-Go" ` -pullRequestId "123456" ` - -token "ABC" + -token "ABC" } | Should -Throw } @@ -27,11 +29,11 @@ Describe 'VerifyPRChanges Action Tests' { Mock -CommandName Invoke-WebRequest -MockWith { '{ "changed_files": 1 }' } -ParameterFilter { $Uri -and $Uri -notmatch "/files"} Mock -CommandName Invoke-WebRequest -MockWith { '[{"filename":"Scripts/BuildScript.ps1", "status": "added"}]' } -ParameterFilter { $Uri -and $Uri -match "/files"} - { + { & $scriptPath ` -prBaseRepository "microsoft/AL-Go" ` -pullRequestId "123456" ` - -token "ABC" + -token "ABC" } | Should -Throw } @@ -39,11 +41,11 @@ Describe 'VerifyPRChanges Action Tests' { Mock -CommandName Invoke-WebRequest -MockWith { '{ "changed_files": 1 }' } -ParameterFilter { $Uri -and $Uri -notmatch "/files"} Mock -CommandName Invoke-WebRequest -MockWith { '[{"filename":"Scripts/BuildScript.ps1","status":"removed"}]' } -ParameterFilter { $Uri -and $Uri -match "/files"} - { + { & $scriptPath ` -prBaseRepository "microsoft/AL-Go" ` -pullRequestId "123456" ` - -token "ABC" + -token "ABC" } | Should -Throw } @@ -51,11 +53,11 @@ Describe 'VerifyPRChanges Action Tests' { Mock -CommandName Invoke-WebRequest -MockWith { '{ "changed_files": 1 }' } -ParameterFilter { $Uri -and $Uri -notmatch "/files"} Mock -CommandName Invoke-WebRequest -MockWith { '[{"filename":"CODEOWNERS","status":"modified"}]' } -ParameterFilter { $Uri -and $Uri -match "/files"} - { + { & $scriptPath ` -prBaseRepository "microsoft/AL-Go" ` -pullRequestId "123456" ` - -token "ABC" + -token "ABC" } | Should -Throw } @@ -63,11 +65,11 @@ Describe 'VerifyPRChanges Action Tests' { Mock -CommandName Invoke-WebRequest -MockWith { '{ "changed_files": 1 }' } -ParameterFilter { $Uri -and $Uri -notmatch "/files"} Mock -CommandName Invoke-WebRequest -MockWith { '[{"filename":".github/Settings.json","status":"modified"}]' } -ParameterFilter { $Uri -and $Uri -match "/files"} - { + { & $scriptPath ` -prBaseRepository "microsoft/AL-Go" ` -pullRequestId "123456" ` - -token "ABC" + -token "ABC" } | Should -Throw } @@ -75,11 +77,11 @@ Describe 'VerifyPRChanges Action Tests' { Mock -CommandName Invoke-WebRequest -MockWith { '{ "changed_files": 1 }' } -ParameterFilter { $Uri -and $Uri -notmatch "/files"} Mock -CommandName Invoke-WebRequest -MockWith { '[{"filename":".github/workflows/test.yaml","status":"modified"}]' } -ParameterFilter { $Uri -and $Uri -match "/files"} - { + { & $scriptPath ` -prBaseRepository "microsoft/AL-Go" ` -pullRequestId "123456" ` - -token "ABC" + -token "ABC" } | Should -Throw } @@ -91,7 +93,7 @@ Describe 'VerifyPRChanges Action Tests' { & $scriptPath ` -prBaseRepository "microsoft/AL-Go" ` -pullRequestId "123456" ` - -token "ABC" + -token "ABC" Assert-MockCalled Write-Host -Exactly 1 -Scope It -ParameterFilter { $Object -eq "Verification completed successfully." } } @@ -103,7 +105,7 @@ Describe 'VerifyPRChanges Action Tests' { & $scriptPath ` -prBaseRepository "microsoft/AL-Go" ` -pullRequestId "123456" ` - -token "ABC" + -token "ABC" Assert-MockCalled Write-Host -Exactly 1 -Scope It -ParameterFilter { $Object -eq "Verification completed successfully." } } @@ -115,18 +117,18 @@ Describe 'VerifyPRChanges Action Tests' { & $scriptPath ` -prBaseRepository "microsoft/AL-Go" ` -pullRequestId "123456" ` - -token "ABC" + -token "ABC" Assert-MockCalled Write-Host -Exactly 1 -Scope It -ParameterFilter { $Object -eq "Verification completed successfully." } } It 'should fail if the PR is from a fork and changes more than 3000 files' { Mock -CommandName Invoke-WebRequest -MockWith { '{ "changed_files": 5001 }' } -ParameterFilter { $Uri -and $Uri -notmatch "/files"} - { + { & $scriptPath ` -prBaseRepository "microsoft/AL-Go" ` -pullRequestId "123456" ` - -token "ABC" + -token "ABC" } | Should -Throw } diff --git a/Tests/WorkflowInitialize.Test.ps1 b/Tests/WorkflowInitialize.Test.ps1 index aa1432f8a..4fab4d6f7 100644 --- a/Tests/WorkflowInitialize.Test.ps1 +++ b/Tests/WorkflowInitialize.Test.ps1 @@ -6,7 +6,9 @@ Describe "WorkflowInitialize Action Tests" { $actionName = "WorkflowInitialize" $scriptRoot = Join-Path $PSScriptRoot "..\Actions\$actionName" -Resolve $scriptName = "$actionName.ps1" + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'scriptPath', Justification = 'False positive.')] $scriptPath = Join-Path $scriptRoot $scriptName + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'actionScript', Justification = 'False positive.')] $actionScript = GetActionScript -scriptRoot $scriptRoot -scriptName $scriptName } diff --git a/Tests/WorkflowPostProcess.Test.ps1 b/Tests/WorkflowPostProcess.Test.ps1 index 365c41e62..5717a882b 100644 --- a/Tests/WorkflowPostProcess.Test.ps1 +++ b/Tests/WorkflowPostProcess.Test.ps1 @@ -6,7 +6,9 @@ Describe "WorkflowPostProcess Action Tests" { $actionName = "WorkflowPostProcess" $scriptRoot = Join-Path $PSScriptRoot "..\Actions\$actionName" -Resolve $scriptName = "$actionName.ps1" + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'scriptPath', Justification = 'False positive.')] $scriptPath = Join-Path $scriptRoot $scriptName + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'actionScript', Justification = 'False positive.')] $actionScript = GetActionScript -scriptRoot $scriptRoot -scriptName $scriptName } diff --git a/Tests/WorkflowSanitation/WorkflowFileExtensions.Test.ps1 b/Tests/WorkflowSanitation/WorkflowFileExtensions.Test.ps1 index 02c25498a..c41ad529d 100644 --- a/Tests/WorkflowSanitation/WorkflowFileExtensions.Test.ps1 +++ b/Tests/WorkflowSanitation/WorkflowFileExtensions.Test.ps1 @@ -1,20 +1,15 @@ -Get-Module TestActionsHelper | Remove-Module -Force +Get-Module TestActionsHelper | Remove-Module -Force Import-Module (Join-Path $PSScriptRoot '../TestActionsHelper.psm1') Describe "All AL-GO workflows should have the .yaml extension" { - BeforeAll { - $AppSourceWorkflows = (Join-Path $PSScriptRoot "..\..\Templates\AppSource App\.github\workflows\" -Resolve) | GetWorkflowsInPath - $PTEWorkflows = (Join-Path $PSScriptRoot "..\..\Templates\Per Tenant Extension\.github\workflows\" -Resolve) | GetWorkflowsInPath - } - It 'All PTE workflows should have the .yaml extension' { - $PTEWorkflows | ForEach-Object { + (Join-Path $PSScriptRoot "..\..\Templates\Per Tenant Extension\.github\workflows\" -Resolve) | GetWorkflowsInPath | ForEach-Object { $_.Extension | Should -Be '.yaml' } } It 'All AppSource workflows should have the .yaml extension' { - $AppSourceWorkflows | ForEach-Object { + (Join-Path $PSScriptRoot "..\..\Templates\AppSource App\.github\workflows\" -Resolve) | GetWorkflowsInPath | ForEach-Object { $_.Extension | Should -Be '.yaml' } } diff --git a/Tests/WorkflowSanitation/WorkflowReferences.Test.ps1 b/Tests/WorkflowSanitation/WorkflowReferences.Test.ps1 index 029971f01..e727f733e 100644 --- a/Tests/WorkflowSanitation/WorkflowReferences.Test.ps1 +++ b/Tests/WorkflowSanitation/WorkflowReferences.Test.ps1 @@ -1,39 +1,29 @@ -Get-Module TestActionsHelper | Remove-Module -Force +Get-Module TestActionsHelper | Remove-Module -Force Import-Module (Join-Path $PSScriptRoot '../TestActionsHelper.psm1') Describe "All AL-GO workflows should reference actions that come from the microsoft/AL-Go-Actions or actions/ (by GitHub)" { - BeforeAll { - $AppSourceWorkflows = (Join-Path $PSScriptRoot "..\..\Templates\AppSource App\.github\workflows\" -Resolve) | GetWorkflowsInPath - $PTEWorkflows = (Join-Path $PSScriptRoot "..\..\Templates\Per Tenant Extension\.github\workflows\" -Resolve) | GetWorkflowsInPath - } - It 'All PTE workflows are referencing actions that come from the microsoft/AL-Go-Actions or actions/ (by GitHub)' { - $PTEWorkflows | ForEach-Object { + (Join-Path $PSScriptRoot "..\..\Templates\Per Tenant Extension\.github\workflows\" -Resolve) | GetWorkflowsInPath | ForEach-Object { TestActionsReferences -YamlPath $_.FullName } } It 'All AppSource workflows are referencing actions that come from the microsoft/AL-Go-Actions or actions/ (by GitHub)' { - $AppSourceWorkflows | ForEach-Object { + (Join-Path $PSScriptRoot "..\..\Templates\AppSource App\.github\workflows\" -Resolve) | GetWorkflowsInPath | ForEach-Object { TestActionsReferences -YamlPath $_.FullName } } } Describe "All AL-GO workflows should reference reusable workflows from the same repository" { - BeforeAll { - $AppSourceWorkflows = (Join-Path $PSScriptRoot "..\..\Templates\AppSource App\.github\workflows\" -Resolve) | GetWorkflowsInPath - $PTEWorkflows = (Join-Path $PSScriptRoot "..\..\Templates\Per Tenant Extension\.github\workflows\" -Resolve) | GetWorkflowsInPath - } - It 'All PTE workflows are referencing reusable workflows from the same repository ' { - $PTEWorkflows | ForEach-Object { + (Join-Path $PSScriptRoot "..\..\Templates\Per Tenant Extension\.github\workflows\" -Resolve) | GetWorkflowsInPath | ForEach-Object { TestWorkflowReferences -YamlPath $_.FullName } } It 'All AppSource workflows are referencing reusable workflows from the same repository ' { - $AppSourceWorkflows | ForEach-Object { + (Join-Path $PSScriptRoot "..\..\Templates\AppSource App\.github\workflows\" -Resolve) | GetWorkflowsInPath | ForEach-Object { TestWorkflowReferences -YamlPath $_.FullName } } diff --git a/Tests/YamlSnippet.txt b/Tests/YamlSnippet.txt index a17cc4bd4..d56930d90 100644 --- a/Tests/YamlSnippet.txt +++ b/Tests/YamlSnippet.txt @@ -39,7 +39,7 @@ jobs: uses: actions/checkout@v3 with: lfs: true - + - name: Initialize the workflow id: init uses: microsoft/AL-Go-Actions/WorkflowInitialize@main diff --git a/Workshop/GetStarted.md b/Workshop/GetStarted.md index d0c647646..e6da744dd 100644 --- a/Workshop/GetStarted.md +++ b/Workshop/GetStarted.md @@ -20,7 +20,7 @@ Click **Actions**, select the **CI/CD** workflow, click **Run workflow** and run | ![image](https://user-images.githubusercontent.com/10775043/231540402-05af1336-0f60-45e7-a86c-501a95a657de.png) | |-| -Note the three warnings explaining that no apps have been added. The CI/CD workflow doesn't have anything to compile yet as you didn't add any source code. +Note the three warnings explaining that no apps have been added. The CI/CD workflow doesn't have anything to compile yet as you didn't add any source code. After this step, we are done setting up a basic AL-Go for GitHub repository and we only need to add our apps. diff --git a/Workshop/Projects.md b/Workshop/Projects.md index 8bf5f11c3..adbcb0de2 100644 --- a/Workshop/Projects.md +++ b/Workshop/Projects.md @@ -100,7 +100,7 @@ Before running **Update AL-Go System Files** however, let's make some changes to |-| Open **VS Code** and run **Git Clone** to clone your repository to your local machine: - + | ![image](https://user-images.githubusercontent.com/10775043/231759374-671a9933-9602-4ec0-bc06-ea5c7236b457.png) | |-| diff --git a/e2eTests/RemoveRepositories.ps1 b/e2eTests/RemoveRepositories.ps1 index aee6f11d6..b5b78388f 100644 --- a/e2eTests/RemoveRepositories.ps1 +++ b/e2eTests/RemoveRepositories.ps1 @@ -5,7 +5,6 @@ [string] $actionsRepo, [string] $perTenantExtensionRepo, [string] $appSourceAppRepo - ) $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0 diff --git a/e2eTests/Test-AL-Go-Upgrade.ps1 b/e2eTests/Test-AL-Go-Upgrade.ps1 index c09e6c64f..50de12bb9 100644 --- a/e2eTests/Test-AL-Go-Upgrade.ps1 +++ b/e2eTests/Test-AL-Go-Upgrade.ps1 @@ -1,4 +1,5 @@ -Param( +[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidGlobalVars', '', Justification = 'Global vars used for local test execution only.')] +Param( [switch] $github, [string] $githubOwner = $global:E2EgithubOwner, [string] $repoName = [System.IO.Path]::GetFileNameWithoutExtension([System.IO.Path]::GetTempFileName()), @@ -12,14 +13,14 @@ ) Write-Host -ForegroundColor Yellow @' -# ______ _ ___ _ _ _ _ _ _ _ -# | ____| | |__ \ | | | | | | | | | | | | (_) -# | |__ _ __ __| | ) |___ _ __ __| | | | | |_ __ __ _ _ __ __ _ __| | ___ | |_ ___ ___| |_ ___ ___ ___ _ __ __ _ _ __ _ ___ -# | __| | '_ \ / _` | / // _ \ '_ \ / _` | | | | | '_ \ / _` | '__/ _` |/ _` |/ _ \ | __/ _ \ __| __| / __|/ __/ _ \ '_ \ / _` | '__| |/ _ \ +# ______ _ ___ _ _ _ _ _ _ _ +# | ____| | |__ \ | | | | | | | | | | | | (_) +# | |__ _ __ __| | ) |___ _ __ __| | | | | |_ __ __ _ _ __ __ _ __| | ___ | |_ ___ ___| |_ ___ ___ ___ _ __ __ _ _ __ _ ___ +# | __| | '_ \ / _` | / // _ \ '_ \ / _` | | | | | '_ \ / _` | '__/ _` |/ _` |/ _ \ | __/ _ \ __| __| / __|/ __/ _ \ '_ \ / _` | '__| |/ _ \ # | |____| | | | (_| |/ /_ __/ | | | (_| | | |__| | |_) | (_| | | | (_| | (_| | __/ | |_ __\__ \ |_ \__ \ (__ __/ | | | (_| | | | | (_) | -# |______|_| |_|\__,_|____\___|_| |_|\__,_| \____/| .__/ \__, |_| \__,_|\__,_|\___| \__\___|___/\__| |___/\___\___|_| |_|\__,_|_| |_|\___/ -# | | __/ | -# |_| |___/ +# |______|_| |_|\__,_|____\___|_| |_|\__,_| \____/| .__/ \__, |_| \__,_|\__,_|\___| \__\___|___/\__| |___/\___\___|_| |_|\__,_|_| |_|\___/ +# | | __/ | +# |_| |___/ # # This scenario runs for every previously released version of GitHub Go - both for PTEs and AppSource Apps # The scenario tests that we do not break existing CI/CD workflows and that existing repositories can upgrade to newest version @@ -98,7 +99,7 @@ $run = Run-CICD -wait -branch $branch Test-ArtifactsFromRun -runid $run.id -expectedArtifacts @{"Apps"=1;"TestApps"=1} -expectedNumberOfTests 1 -folder 'artifacts' -repoVersion '1.0' -appVersion '' # Expected Run: CI/CD triggered on workflow_dispatch -$runs++ +$runs++ # Update AL-Go System Files SetRepositorySecret -repository $repository -name 'GHTOKENWORKFLOW' -value $token @@ -112,11 +113,11 @@ Start-Sleep -seconds 100 MergePRandPull -branch $branch | Out-Null if ($releaseVersion -ge [System.Version]"2.2") { # Expected Run: Pull Request Handler triggered by pull_request_target - $runs++ - + $runs++ + if ($releaseVersion -le [System.Version]"2.4") { # Expected Run: CICD triggered by workflow_run (after Pull Request Handler has finished) - $runs++ + $runs++ } } # Expected Run: CICD run on push (after PR is merged) diff --git a/e2eTests/Test-AL-Go.ps1 b/e2eTests/Test-AL-Go.ps1 index a807af017..458017198 100644 --- a/e2eTests/Test-AL-Go.ps1 +++ b/e2eTests/Test-AL-Go.ps1 @@ -1,4 +1,5 @@ -Param( +[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidGlobalVars', '', Justification = 'Global vars used for local test execution only.')] +Param( [switch] $github, [string] $githubOwner = $global:E2EgithubOwner, [string] $repoName = [System.IO.Path]::GetFileNameWithoutExtension([System.IO.Path]::GetTempFileName()), @@ -15,15 +16,15 @@ ) Write-Host -ForegroundColor Yellow @' -# ______ _ ___ _ _ _ _ -# | ____| | |__ \ | | | | | | (_) -# | |__ _ __ __| | ) |___ _ __ __| | | |_ ___ ___| |_ ___ ___ ___ _ __ __ _ _ __ _ ___ -# | __| | '_ \ / _` | / // _ \ '_ \ / _` | | __/ _ \ __| __| / __|/ __/ _ \ '_ \ / _` | '__| |/ _ \ +# ______ _ ___ _ _ _ _ +# | ____| | |__ \ | | | | | | (_) +# | |__ _ __ __| | ) |___ _ __ __| | | |_ ___ ___| |_ ___ ___ ___ _ __ __ _ _ __ _ ___ +# | __| | '_ \ / _` | / // _ \ '_ \ / _` | | __/ _ \ __| __| / __|/ __/ _ \ '_ \ / _` | '__| |/ _ \ # | |____| | | | (_| |/ /_ __/ | | | (_| | | |_ __\__ \ |_ \__ \ (__ __/ | | | (_| | | | | (_) | -# |______|_| |_|\__,_|____\___|_| |_|\__,_| \__\___|___/\__| |___/\___\___|_| |_|\__,_|_| |_|\___/ +# |______|_| |_|\__,_|____\___|_| |_|\__,_| \__\___|___/\__| |___/\___\___|_| |_|\__,_|_| |_|\___/ # # This scenario runs for both PTE template and AppSource App template and as single project and multi project repositories -# +# # - Login to GitHub # - Create a new repository based on the selected template # - If (AppSource App) Create a licensefileurl secret @@ -59,7 +60,7 @@ Write-Host -ForegroundColor Yellow @' # - Cleanup repositories # '@ - + $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0 $prevLocation = Get-Location @@ -137,7 +138,7 @@ $runs++ $run = Run-CICD -wait -branch $branch $runs++ -if ($useCompilerFolder) { +if ($useCompilerFolder) { # If using compiler folder duing tests, doNotPublishApps is also set to true (for now), which means that apps are not published and tests are not run # Later we will fix this to include test runs as well, but for now, expected number of tests is 0 $expectedNumberOfTests = 0 diff --git a/e2eTests/Test-Functions.ps1 b/e2eTests/Test-Functions.ps1 index c92d90a73..266ff0c50 100644 --- a/e2eTests/Test-Functions.ps1 +++ b/e2eTests/Test-Functions.ps1 @@ -78,7 +78,7 @@ function Test-ArtifactsFromRun { $expected = $expectedArtifacts."$type" Write-Host "Type: $type, Expected: $expected" if ($type -eq 'thisbuild') { - $actual = @(Get-ChildItem -Path $path -File -Recurse | Where-Object { + $actual = @(Get-ChildItem -Path $path -File -Recurse | Where-Object { $_.FullName.Substring($path.Length+1) -like "thisbuild-*-Apps?*$appVersion.*.*.app" }).Count } diff --git a/e2eTests/e2eTestHelper.psm1 b/e2eTests/e2eTestHelper.psm1 index 09c42f34b..d4ee21946 100644 --- a/e2eTests/e2eTestHelper.psm1 +++ b/e2eTests/e2eTestHelper.psm1 @@ -90,7 +90,7 @@ function Add-PropertiesToJsonFile { $run = (InvokeWebRequest -Method Get -Headers $headers -Uri $url -retry | ConvertFrom-Json).workflow_runs | Where-Object { $_.event -eq 'push' } | Where-Object { $previousrunids -notcontains $_.id } if ($run) { break - } + } Write-Host "Run not started, waiting..." } WaitWorkflow -repository $repository -runid $run.id @@ -161,7 +161,7 @@ function RunWorkflow { else { Write-Host "No previous run found" } - + Write-Host "Run workflow" $url = "https://api.github.com/repos/$repository/actions/workflows/$($workflow.id)/dispatches" Write-Host $url @@ -351,7 +351,7 @@ function CreateAlGoRepository { Write-Host "Downloading template from $templateUrl" $zipFileName = Join-Path $tempPath "$([GUID]::NewGuid().ToString()).zip" [System.Net.WebClient]::new().DownloadFile($templateUrl, $zipFileName) - + $tempRepoPath = Join-Path $tempPath ([GUID]::NewGuid().ToString()) Expand-Archive -Path $zipFileName -DestinationPath $tempRepoPath Copy-Item (Join-Path (Get-Item "$tempRepoPath/*/$templateFolder").FullName '*') -Destination . -Recurse -Force @@ -363,17 +363,17 @@ function CreateAlGoRepository { Get-ChildItem -Path . -File -Recurse | ForEach-Object { $file = $_.FullName $lines = Get-Content -Encoding UTF8 -path $file - + # Replace URL's to actions repository first $regex = "^(.*)https:\/\/raw\.githubusercontent\.com\/microsoft\/AL-Go-Actions\/main(.*)$" $replace = "`${1}https://raw.githubusercontent.com/$($templateOwner)/AL-Go/$($templateBranch)/Actions`${2}" $lines = $lines | ForEach-Object { $_ -replace $regex, $replace } - + # Replace AL-Go-Actions references $regex = "^(.*)microsoft\/AL-Go-Actions(.*)main(.*)$" $replace = "`${1}$($templateOwner)/AL-Go/Actions`${2}$($templateBranch)`${3}" $lines = $lines | ForEach-Object { $_ -replace $regex, $replace } - + $content = "$($lines -join "`n")`n" # Update Template references in test apps @@ -504,7 +504,7 @@ function MergePRandPull { $run = (InvokeWebRequest -Method Get -Headers $headers -Uri $url -retry | ConvertFrom-Json).workflow_runs | Where-Object { $_.event -eq 'push' } | Where-Object { $previousrunids -notcontains $_.id } if ($run) { break - } + } Write-Host "Run not started, waiting..." } if ($wait) { diff --git a/e2eTests/scenarios/BuildModes/runtest.ps1 b/e2eTests/scenarios/BuildModes/runtest.ps1 index 5325b6a3d..886874e7b 100644 --- a/e2eTests/scenarios/BuildModes/runtest.ps1 +++ b/e2eTests/scenarios/BuildModes/runtest.ps1 @@ -1,4 +1,6 @@ -Param( +[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidGlobalVars', '', Justification = 'Global vars used for local test execution only.')] +[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', '', Justification = 'All scenario tests have equal parameter set.')] +Param( [switch] $github, [string] $githubOwner = $global:E2EgithubOwner, [string] $repoName = [System.IO.Path]::GetFileNameWithoutExtension([System.IO.Path]::GetTempFileName()), @@ -11,16 +13,16 @@ ) Write-Host -ForegroundColor Yellow @' -# ____ _ _ _ __ __ _ -# | _ \ (_) | | | \/ | | | -# | |_) |_ _ _| | __| | \ / | ___ __| | ___ ___ +# ____ _ _ _ __ __ _ +# | _ \ (_) | | | \/ | | | +# | |_) |_ _ _| | __| | \ / | ___ __| | ___ ___ # | _ <| | | | | |/ _` | |\/| |/ _ \ / _` |/ _ \/ __| # | |_) | |_| | | | (_| | | | | (_) | (_| | __/\__ \ # |____/ \__,_|_|_|\__,_|_| |_|\___/ \__,_|\___||___/ -# +# # # This test tests the following scenario: -# +# # - Create a new repository based on the PTE template with a single project HelloWorld app # - add BuildModes and CleanModePreprocessorSymbols to the repo settings # - Run the "CI/CD" workflow @@ -28,7 +30,7 @@ Write-Host -ForegroundColor Yellow @' # - Cleanup repositories # '@ - + $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0 $prevLocation = Get-Location $repoPath = "" diff --git a/e2eTests/scenarios/GitHubPackages/runtest.ps1 b/e2eTests/scenarios/GitHubPackages/runtest.ps1 index 43b9de161..95285bc09 100644 --- a/e2eTests/scenarios/GitHubPackages/runtest.ps1 +++ b/e2eTests/scenarios/GitHubPackages/runtest.ps1 @@ -1,4 +1,6 @@ -Param( +[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidGlobalVars', '', Justification = 'Global vars used for local test execution only.')] +[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', '', Justification = 'All scenario tests have equal parameter set.')] +Param( [switch] $github, [string] $githubOwner = $global:E2EgithubOwner, [string] $repoName = [System.IO.Path]::GetFileNameWithoutExtension([System.IO.Path]::GetTempFileName()), @@ -11,16 +13,16 @@ ) Write-Host -ForegroundColor Yellow @' -# _____ _ _ _ _ _ _____ _ -# / ____(_) | | | | | | | | __ \ | | -# | | __ _| |_| |__| |_ _| |__ | |__) |_ _ ___| | ____ _ __ _ ___ ___ +# _____ _ _ _ _ _ _____ _ +# / ____(_) | | | | | | | | __ \ | | +# | | __ _| |_| |__| |_ _| |__ | |__) |_ _ ___| | ____ _ __ _ ___ ___ # | | |_ | | __| __ | | | | '_ \| ___/ _` |/ __| |/ / _` |/ _` |/ _ \/ __| # | |__| | | |_| | | | |_| | |_) | | | (_| | (__| < (_| | (_| | __/\__ \ # \_____|_|\__|_| |_|\__,_|_.__/|_| \__,_|\___|_|\_\__,_|\__, |\___||___/ -# __/ | -# |___/ +# __/ | +# |___/ # This test tests the following scenario: -# +# # - Create a new repository (repository1) based on the PTE template with 3 apps # - app1 with dependency to app2 # - app2 with no dependencies @@ -42,7 +44,7 @@ Write-Host -ForegroundColor Yellow @' # - Cleanup repositories # '@ - + $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0 $prevLocation = Get-Location $repoPath = "" @@ -75,9 +77,9 @@ CreateAlGoRepository ` -branch $branch ` -contentScript { Param([string] $path) - $global:id2 = CreateNewAppInFolder -folder $path -name app2 -objID 50002 - $global:id1 = CreateNewAppInFolder -folder $path -name app1 -objID 50001 -dependencies @( @{ "id" = $global:id2; "name" = "app2"; "publisher" = (GetDefaultPublisher); "version" = "1.0.0.0" } ) - $global:id3 = CreateNewAppInFolder -folder $path -name app3 -objID 50003 -dependencies @( @{ "id" = $global:id1; "name" = "app1"; "publisher" = (GetDefaultPublisher); "version" = "1.0.0.0" }, @{ "id" = $global:id2; "name" = "app2"; "publisher" = (GetDefaultPublisher); "version" = "1.0.0.0" } ) + $script:id2 = CreateNewAppInFolder -folder $path -name app2 -objID 50002 + $script:id1 = CreateNewAppInFolder -folder $path -name app1 -objID 50001 -dependencies @( @{ "id" = $script:id2; "name" = "app2"; "publisher" = (GetDefaultPublisher); "version" = "1.0.0.0" } ) + $script:id3 = CreateNewAppInFolder -folder $path -name app3 -objID 50003 -dependencies @( @{ "id" = $script:id1; "name" = "app1"; "publisher" = (GetDefaultPublisher); "version" = "1.0.0.0" }, @{ "id" = $script:id2; "name" = "app2"; "publisher" = (GetDefaultPublisher); "version" = "1.0.0.0" } ) Add-PropertiesToJsonFile -path (Join-Path $path '.AL-Go\settings.json') -properties @{ "country" = "w1" } } SetRepositorySecret -repository $repository1 -name 'GitHubPackagesContext' -value $githubPackagesContextJson @@ -93,7 +95,7 @@ CreateAlGoRepository ` -addRepoSettings @{ "useCompilerFolder" = $true; "doNotPublishApps" = $true } ` -contentScript { Param([string] $path) - $global:id4 = CreateNewAppInFolder -folder $path -name app4 -objID 50004 -dependencies @( @{ "id" = $global:id1; "name" = "app1"; "publisher" = (GetDefaultPublisher); "version" = "1.0.0.0" } ) + $script:id4 = CreateNewAppInFolder -folder $path -name app4 -objID 50004 -dependencies @( @{ "id" = $script:id1; "name" = "app1"; "publisher" = (GetDefaultPublisher); "version" = "1.0.0.0" } ) Add-PropertiesToJsonFile -path (Join-Path $path '.AL-Go\settings.json') -properties @{ "country" = "dk" } } SetRepositorySecret -repository $repository2 -name 'GitHubPackagesContext' -value $githubPackagesContextJson @@ -108,7 +110,7 @@ CreateAlGoRepository ` -addRepoSettings @{ "generateDependencyArtifact" = $true } ` -contentScript { Param([string] $path) - $global:id5 = CreateNewAppInFolder -folder $path -name app5 -objID 50005 -dependencies @( @{ "id" = $global:id4; "name" = "app4"; "publisher" = (GetDefaultPublisher); "version" = "1.0.0.0" }; @{ "id" = $global:id3; "name" = "app3"; "publisher" = (GetDefaultPublisher); "version" = "1.0.0.0" } ) + $script:id5 = CreateNewAppInFolder -folder $path -name app5 -objID 50005 -dependencies @( @{ "id" = $script:id4; "name" = "app4"; "publisher" = (GetDefaultPublisher); "version" = "1.0.0.0" }; @{ "id" = $script:id3; "name" = "app3"; "publisher" = (GetDefaultPublisher); "version" = "1.0.0.0" } ) Add-PropertiesToJsonFile -path (Join-Path $path '.AL-Go\settings.json') -properties @{ "country" = "dk" } } SetRepositorySecret -repository $repository -name 'GitHubPackagesContext' -value $githubPackagesContextJson diff --git a/e2eTests/scenarios/IncludeDependencies/runtest.ps1 b/e2eTests/scenarios/IncludeDependencies/runtest.ps1 index 8398e4cf7..e7f939177 100644 --- a/e2eTests/scenarios/IncludeDependencies/runtest.ps1 +++ b/e2eTests/scenarios/IncludeDependencies/runtest.ps1 @@ -1,4 +1,6 @@ -Param( +[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidGlobalVars', '', Justification = 'Global vars used for local test execution only.')] +[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', '', Justification = 'All scenario tests have equal parameter set.')] +Param( [switch] $github, [string] $githubOwner = $global:E2EgithubOwner, [string] $repoName = [System.IO.Path]::GetFileNameWithoutExtension([System.IO.Path]::GetTempFileName()), @@ -11,16 +13,16 @@ ) Write-Host -ForegroundColor Yellow @' -# _____ _ _ _____ _ _ -# |_ _| | | | | | __ \ | | (_) -# | | _ __ ___| |_ _ __| | ___| | | | ___ _ __ ___ _ __ __| | ___ _ __ ___ _ ___ ___ +# _____ _ _ _____ _ _ +# |_ _| | | | | | __ \ | | (_) +# | | _ __ ___| |_ _ __| | ___| | | | ___ _ __ ___ _ __ __| | ___ _ __ ___ _ ___ ___ # | | | '_ \ / __| | | | |/ _` |/ _ \ | | |/ _ \ '_ \ / _ \ '_ \ / _` |/ _ \ '_ \ / __| |/ _ \/ __| # _| |_| | | | (__| | |_| | (_| | __/ |__| | __/ |_) | __/ | | | (_| | __/ | | | (__| | __/\__ \ # |_____|_| |_|\___|_|\__,_|\__,_|\___|_____/ \___| .__/ \___|_| |_|\__,_|\___|_| |_|\___|_|\___||___/ -# | | +# | | # |_| # # This test tests the following scenario: -# +# # - Create a new repository based on the PTE template, running Windows with 5 projects, using appDependencyProbingPaths with release_status set to 'include' # - P1/app1 with dependency to P1/app2 # - P1/app2 with no dependencies @@ -37,7 +39,7 @@ Write-Host -ForegroundColor Yellow @' # - Cleanup repositories # '@ - + $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0 $prevLocation = Get-Location $repoPath = "" @@ -69,9 +71,9 @@ CreateAlGoRepository ` Add-PropertiesToJsonFile -path (Join-Path $path 'P2\.AL-Go\settings.json') -properties @{ "country" = "w1"; "appDependencyProbingPaths" = @( @{ "repo" = "."; "release_status" = "include"; "projects" = "P1" } ) } $id4 = CreateNewAppInFolder -folder (Join-Path $path 'P3') -name app4 -objID 50004 -dependencies @( @{ "id" = $id1; "name" = "app1"; "publisher" = (GetDefaultPublisher); "version" = "1.0.0.0" } ) Add-PropertiesToJsonFile -path (Join-Path $path 'P3\.AL-Go\settings.json') -properties @{ "country" = "w1"; "appDependencyProbingPaths" = @( @{ "repo" = "."; "release_status" = "include"; "projects" = "P1" } ) } - $id5 = CreateNewAppInFolder -folder (Join-Path $path 'P4') -name app5 -objID 50005 -dependencies @( @{ "id" = $id4; "name" = "app4"; "publisher" = (GetDefaultPublisher); "version" = "1.0.0.0" }; @{ "id" = $id3; "name" = "app3"; "publisher" = (GetDefaultPublisher); "version" = "1.0.0.0" } ) + $null = CreateNewAppInFolder -folder (Join-Path $path 'P4') -name app5 -objID 50005 -dependencies @( @{ "id" = $id4; "name" = "app4"; "publisher" = (GetDefaultPublisher); "version" = "1.0.0.0" }; @{ "id" = $id3; "name" = "app3"; "publisher" = (GetDefaultPublisher); "version" = "1.0.0.0" } ) Add-PropertiesToJsonFile -path (Join-Path $path 'P4\.AL-Go\settings.json') -properties @{ "country" = "it"; "appDependencyProbingPaths" = @( @{ "repo" = "."; "release_status" = "include"; "projects" = "P2,P3" } ) } - $id6 = CreateNewAppInFolder -folder (Join-Path $path 'P0') -name app6 -objID 50006 -dependencies @( @{ "id" = $id4; "name" = "app4"; "publisher" = (GetDefaultPublisher); "version" = "1.0.0.0" }; @{ "id" = $id3; "name" = "app3"; "publisher" = (GetDefaultPublisher); "version" = "1.0.0.0" } ) + $null = CreateNewAppInFolder -folder (Join-Path $path 'P0') -name app6 -objID 50006 -dependencies @( @{ "id" = $id4; "name" = "app4"; "publisher" = (GetDefaultPublisher); "version" = "1.0.0.0" }; @{ "id" = $id3; "name" = "app3"; "publisher" = (GetDefaultPublisher); "version" = "1.0.0.0" } ) Add-PropertiesToJsonFile -path (Join-Path $path 'P0\.AL-Go\settings.json') -properties @{ "country" = "dk"; "appDependencyProbingPaths" = @( @{ "repo" = "."; "release_status" = "include"; "projects" = "P3,P2" } ) } } @@ -105,10 +107,10 @@ $repoPath = (Get-Location).Path # Set GitHubRunner and runs-on to ubuntu-latest (and use CompilerFolder) Add-PropertiesToJsonFile -path '.github/AL-Go-Settings.json' -properties @{ "runs-on" = "ubuntu-latest"; "gitHubRunner" = "ubuntu-latest"; "UseCompilerFolder" = $true; "doNotPublishApps" = $true } - + # Push CommitAndPush -commitMessage 'Shift to Linux' - + # Upgrade AL-Go System Files Run-UpdateAlGoSystemFiles -directCommit -commitMessage 'Update system files' -wait -templateUrl $template } diff --git a/e2eTests/scenarios/ReleaseBranches/runtest.ps1 b/e2eTests/scenarios/ReleaseBranches/runtest.ps1 index 644b64ce4..b669b51e2 100644 --- a/e2eTests/scenarios/ReleaseBranches/runtest.ps1 +++ b/e2eTests/scenarios/ReleaseBranches/runtest.ps1 @@ -1,4 +1,6 @@ -Param( +[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidGlobalVars', '', Justification = 'Global vars used for local test execution only.')] +[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', '', Justification = 'All scenario tests have equal parameter set.')] +Param( [switch] $github, [string] $githubOwner = $global:E2EgithubOwner, [string] $repoName = [System.IO.Path]::GetFileNameWithoutExtension([System.IO.Path]::GetTempFileName()), @@ -11,16 +13,16 @@ ) Write-Host -ForegroundColor Yellow @' -# _____ _ ____ _ -#| __ \ | | | _ \ | | -#| |__) |___| | ___ __ _ ___ ___| |_) |_ __ __ _ _ __ ___| |__ ___ ___ +# _____ _ ____ _ +#| __ \ | | | _ \ | | +#| |__) |___| | ___ __ _ ___ ___| |_) |_ __ __ _ _ __ ___| |__ ___ ___ #| _ // _ \ |/ _ \/ _` / __|/ _ \ _ <| '__/ _` | '_ \ / __| '_ \ / _ \/ __| #| | \ \ __/ | __/ (_| \__ \ __/ |_) | | | (_| | | | | (__| | | | __/\__ \ #|_| \_\___|_|\___|\__,_|___/\___|____/|_| \__,_|_| |_|\___|_| |_|\___||___/ -# +# # # This test tests the following scenario: -# +# # - Create a new repository based on the PTE template with a single project HelloWorld app # - Run the "CI/CD" workflow # - Check that no previous release was found @@ -46,7 +48,7 @@ Write-Host -ForegroundColor Yellow @' # - Cleanup repositories # '@ - + $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0 $prevLocation = Get-Location $repoPath = "" diff --git a/e2eTests/scenarios/SpecialCharacters/runtest.ps1 b/e2eTests/scenarios/SpecialCharacters/runtest.ps1 index e13739150..bfa049aef 100644 --- a/e2eTests/scenarios/SpecialCharacters/runtest.ps1 +++ b/e2eTests/scenarios/SpecialCharacters/runtest.ps1 @@ -1,4 +1,6 @@ -Param( +[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidGlobalVars', '', Justification = 'Global vars used for local test execution only.')] +[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', '', Justification = 'All scenario tests have equal parameter set.')] +Param( [switch] $github, [string] $githubOwner = $global:E2EgithubOwner, [string] $repoName = [System.IO.Path]::GetFileNameWithoutExtension([System.IO.Path]::GetTempFileName()), @@ -11,16 +13,16 @@ ) Write-Host -ForegroundColor Yellow @' -# _____ _ _ _____ _ _ -# / ____| (_) | | / ____| | | | -# | (___ _ __ ___ ___ _ __ _| | | | | |__ __ _ _ __ __ _ ___| |_ ___ _ __ ___ +# _____ _ _ _____ _ _ +# / ____| (_) | | / ____| | | | +# | (___ _ __ ___ ___ _ __ _| | | | | |__ __ _ _ __ __ _ ___| |_ ___ _ __ ___ # \___ \| '_ \ / _ \/ __| |/ _` | | | | | '_ \ / _` | '__/ _` |/ __| __/ _ \ '__/ __| # ____) | |_) | __/ (__| | (_| | | | |____| | | | (_| | | | (_| | (__| || __/ | \__ \ # |_____/| .__/ \___|\___|_|\__,_|_| \_____|_| |_|\__,_|_| \__,_|\___|\__\___|_| |___/ -# | | -# |_| +# | | +# |_| # This test tests the following scenario: -# +# # - Create a new repository based on the PTE template with 1 app # - Æøå-app with publisher Süß # - Set RepoName to Privé @@ -32,7 +34,7 @@ Write-Host -ForegroundColor Yellow @' # - Cleanup repositories # '@ - + $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0 $prevLocation = Get-Location diff --git a/e2eTests/scenarios/UseProjectDependencies/runtest.ps1 b/e2eTests/scenarios/UseProjectDependencies/runtest.ps1 index b8b121451..e431ed644 100644 --- a/e2eTests/scenarios/UseProjectDependencies/runtest.ps1 +++ b/e2eTests/scenarios/UseProjectDependencies/runtest.ps1 @@ -1,4 +1,6 @@ -Param( +[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidGlobalVars', '', Justification = 'Global vars used for local test execution only.')] +[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', '', Justification = 'All scenario tests have equal parameter set.')] +Param( [switch] $github, [string] $githubOwner = $global:E2EgithubOwner, [string] $repoName = [System.IO.Path]::GetFileNameWithoutExtension([System.IO.Path]::GetTempFileName()), @@ -11,17 +13,17 @@ ) Write-Host -ForegroundColor Yellow @' -# _ _ _____ _ _ _____ _ _ -# | | | | | __ \ (_) | | | __ \ | | (_) -# | | | |___ ___| |__) | __ ___ _ ___ ___| |_| | | | ___ _ __ ___ _ __ __| | ___ _ __ ___ _ ___ ___ +# _ _ _____ _ _ _____ _ _ +# | | | | | __ \ (_) | | | __ \ | | (_) +# | | | |___ ___| |__) | __ ___ _ ___ ___| |_| | | | ___ _ __ ___ _ __ __| | ___ _ __ ___ _ ___ ___ # | | | / __|/ _ \ ___/ '__/ _ \| |/ _ \/ __| __| | | |/ _ \ '_ \ / _ \ '_ \ / _` |/ _ \ '_ \ / __| |/ _ \/ __| # | |__| \__ \ __/ | | | | (_) | | __/ (__| |_| |__| | __/ |_) | __/ | | | (_| | __/ | | | (__| | __/\__ \ # \____/|___/\___|_| |_| \___/| |\___|\___|\__|_____/ \___| .__/ \___|_| |_|\__,_|\___|_| |_|\___|_|\___||___/ -# _/ | | | +# _/ | | | # |__/ |_| # # This test tests the following scenario: -# +# # - Create a new repository based on the PTE template with 5 projects and useProjectDependencies set to true # - P1/app1 with dependency to P1/app2 # - P1/app2 with no dependencies @@ -38,7 +40,7 @@ Write-Host -ForegroundColor Yellow @' # - Cleanup repositories # '@ - + $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0 $prevLocation = Get-Location $repoPath = "" @@ -72,9 +74,9 @@ CreateAlGoRepository ` Add-PropertiesToJsonFile -path (Join-Path $path 'P2\.AL-Go\settings.json') -properties @{ "country" = "w1" } $id4 = CreateNewAppInFolder -folder (Join-Path $path 'P3') -name app4 -objID 50004 -dependencies @( @{ "id" = $id1; "name" = "app1"; "publisher" = (GetDefaultPublisher); "version" = "1.0.0.0" } ) Add-PropertiesToJsonFile -path (Join-Path $path 'P3\.AL-Go\settings.json') -properties @{ "country" = "w1" } - $id5 = CreateNewAppInFolder -folder (Join-Path $path 'P4') -name app5 -objID 50005 -dependencies @( @{ "id" = $id4; "name" = "app4"; "publisher" = (GetDefaultPublisher); "version" = "1.0.0.0" }; @{ "id" = $id3; "name" = "app3"; "publisher" = (GetDefaultPublisher); "version" = "1.0.0.0" } ) + $null = CreateNewAppInFolder -folder (Join-Path $path 'P4') -name app5 -objID 50005 -dependencies @( @{ "id" = $id4; "name" = "app4"; "publisher" = (GetDefaultPublisher); "version" = "1.0.0.0" }; @{ "id" = $id3; "name" = "app3"; "publisher" = (GetDefaultPublisher); "version" = "1.0.0.0" } ) Add-PropertiesToJsonFile -path (Join-Path $path 'P4\.AL-Go\settings.json') -properties @{ "country" = "it" } - $id6 = CreateNewAppInFolder -folder (Join-Path $path 'P0') -name app6 -objID 50006 -dependencies @( @{ "id" = $id4; "name" = "app4"; "publisher" = (GetDefaultPublisher); "version" = "1.0.0.0" }; @{ "id" = $id3; "name" = "app3"; "publisher" = (GetDefaultPublisher); "version" = "1.0.0.0" } ) + $null = CreateNewAppInFolder -folder (Join-Path $path 'P0') -name app6 -objID 50006 -dependencies @( @{ "id" = $id4; "name" = "app4"; "publisher" = (GetDefaultPublisher); "version" = "1.0.0.0" }; @{ "id" = $id3; "name" = "app3"; "publisher" = (GetDefaultPublisher); "version" = "1.0.0.0" } ) Add-PropertiesToJsonFile -path (Join-Path $path 'P0\.AL-Go\settings.json') -properties @{ "country" = "dk" } }