From 3da1dcd069d0a56167a2032174f7f34e70b7a0c4 Mon Sep 17 00:00:00 2001 From: freddydk Date: Tue, 15 Mar 2022 14:44:47 +0000 Subject: [PATCH 1/4] Collect changes from freddydk/*@main --- Actions/AL-Go-Helper.ps1 | 18 +++++++++++++----- Actions/CheckForUpdates/CheckForUpdates.ps1 | 2 +- .../CreateDevelopmentEnvironment.ps1 | 1 + Actions/ReadSettings/ReadSettings.ps1 | 4 ++-- Actions/ReadSettings/action.yaml | 8 ++++---- Actions/RunPipeline/RunPipeline.ps1 | 10 ++++++---- .../CreateOnlineDevelopmentEnvironment.yaml | 1 + .../CreateOnlineDevelopmentEnvironment.yaml | 1 + 8 files changed, 29 insertions(+), 16 deletions(-) diff --git a/Actions/AL-Go-Helper.ps1 b/Actions/AL-Go-Helper.ps1 index fdd5ad10b..c87d68703 100644 --- a/Actions/AL-Go-Helper.ps1 +++ b/Actions/AL-Go-Helper.ps1 @@ -615,8 +615,10 @@ function AnalyzeRepo { } } - if ([Version]$settings.applicationDependency -gt [Version]$version) { - throw "Application dependency is set to $($settings.applicationDependency), which isn't compatible with the artifact version $version" + if (!$doNotCheckArtifactSetting) { + if ([Version]$settings.applicationDependency -gt [Version]$version) { + throw "Application dependency is set to $($settings.applicationDependency), which isn't compatible with the artifact version $version" + } } # unpack all dependencies and update app- and test dependencies from dependency apps @@ -737,7 +739,7 @@ function CommitFromNewFolder { if ($commitMessage.Length -gt 250) { $commitMessage = "$($commitMessage.Substring(0,250))...)" } - invoke-git commit -m "'$commitMessage'" + invoke-git commit --allow-empty -m "'$commitMessage'" if ($branch) { invoke-git push -u $serverUrl $branch invoke-gh pr create --fill --head $branch --repo $env:GITHUB_REPOSITORY @@ -909,6 +911,7 @@ function CreateDevEnv { [Parameter(Mandatory=$true)] [string] $baseFolder, [string] $userName = $env:Username, + [string] $bcContainerHelperPath = "", [Parameter(ParameterSetName='cloud')] [Hashtable] $bcAuthContext = $null, @@ -935,7 +938,10 @@ function CreateDevEnv { } $runAlPipelineParams = @{} - $BcContainerHelperPath = DownloadAndImportBcContainerHelper -baseFolder $baseFolder + $loadBcContainerHelper = ($bcContainerHelperPath -eq "") + if ($loadBcContainerHelper) { + $BcContainerHelperPath = DownloadAndImportBcContainerHelper -baseFolder $baseFolder + } try { if ($caller -eq "local") { $currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent()) @@ -1174,7 +1180,9 @@ function CreateDevEnv { -keepContainer } finally { - CleanupAfterBcContainerHelper -bcContainerHelperPath $bcContainerHelperPath + if ($loadBcContainerHelper) { + CleanupAfterBcContainerHelper -bcContainerHelperPath $bcContainerHelperPath + } } } diff --git a/Actions/CheckForUpdates/CheckForUpdates.ps1 b/Actions/CheckForUpdates/CheckForUpdates.ps1 index 5436c99ff..895729b50 100644 --- a/Actions/CheckForUpdates/CheckForUpdates.ps1 +++ b/Actions/CheckForUpdates/CheckForUpdates.ps1 @@ -220,7 +220,7 @@ try { if ($status) { $message = "Updated AL-Go System Files" - invoke-git commit -m "'$message'" + invoke-git commit --allow-empty -m "'$message'" if ($directcommit) { invoke-git push $url diff --git a/Actions/CreateDevelopmentEnvironment/CreateDevelopmentEnvironment.ps1 b/Actions/CreateDevelopmentEnvironment/CreateDevelopmentEnvironment.ps1 index 393961b8a..a0fe1a5b3 100644 --- a/Actions/CreateDevelopmentEnvironment/CreateDevelopmentEnvironment.ps1 +++ b/Actions/CreateDevelopmentEnvironment/CreateDevelopmentEnvironment.ps1 @@ -40,6 +40,7 @@ try { -environmentName $environmentName ` -reUseExistingEnvironment:$reUseExistingEnvironment ` -baseFolder $repoBaseFolder ` + -bcContainerHelperPath $bcContainerHelperPath ` -adminCenterApiCredentials ($adminCenterApiCredentials | ConvertFrom-Json | ConvertTo-HashTable) CommitFromNewFolder -serverUrl $serverUrl -commitMessage "Create a development environment $environmentName" -branch $branch diff --git a/Actions/ReadSettings/ReadSettings.ps1 b/Actions/ReadSettings/ReadSettings.ps1 index d6446ae6e..16faac682 100644 --- a/Actions/ReadSettings/ReadSettings.ps1 +++ b/Actions/ReadSettings/ReadSettings.ps1 @@ -9,9 +9,9 @@ Param( [string] $project = ".", [Parameter(HelpMessage = "Indicates whether you want to retrieve the list of project list as well", Mandatory = $false)] [bool] $getprojects, - [Parameter(HelpMessage = "Specifies the pattern of the environments you want to retreive (or empty for no environments)", Mandatory = $false)] + [Parameter(HelpMessage = "Specify the pattern of the environments you want to retreive (or empty for no environments)", Mandatory = $false)] [string] $getenvironments = "", - [Parameter(HelpMessage = "Specifies whether you want to include production environments", Mandatory = $false)] + [Parameter(HelpMessage = "Specify whether you want to include production environments", Mandatory = $false)] [bool] $includeProduction, [Parameter(HelpMessage = "Indicates whether this is called from a release pipeline", Mandatory = $false)] [bool] $release, diff --git a/Actions/ReadSettings/action.yaml b/Actions/ReadSettings/action.yaml index 8183556bf..f5a1ee17f 100644 --- a/Actions/ReadSettings/action.yaml +++ b/Actions/ReadSettings/action.yaml @@ -17,6 +17,10 @@ inputs: description: Project folder required: false default: '.' + release: + description: Indicates whether this is called from a release pipeline + required: false + default: 'N' getprojects: description: Indicates whether you want to retrieve the list of project list as well required: false @@ -29,10 +33,6 @@ inputs: description: Specifies whether you want to include production environments required: false default: 'N' - release: - description: Indicates whether this is called from a release pipeline - required: false - default: 'N' get: description: Specifies which properties to get from the settings file, default is all required: false diff --git a/Actions/RunPipeline/RunPipeline.ps1 b/Actions/RunPipeline/RunPipeline.ps1 index 79ef1ab1a..c4ead81b4 100644 --- a/Actions/RunPipeline/RunPipeline.ps1 +++ b/Actions/RunPipeline/RunPipeline.ps1 @@ -100,14 +100,16 @@ try { else { $storageContext = New-AzureStorageContext -StorageAccountName $storageAccount.StorageAccountName -StorageAccountKey $storageAccount.StorageAccountKey } + Write-Host "Storage Context OK" $storageContainerName = $storageAccount.ContainerName.ToLowerInvariant().replace('{project}',$projectName).ToLowerInvariant() - Get-AzureStorageContainer -Context $storageContext -name $storageContainerName | Out-Null $storageBlobName = $storageAccount.BlobName.ToLowerInvariant() - Write-Host "Storage Context OK" + Write-Host "Storage Container Name is $storageContainerName" + Write-Host "Storage Blob Name is $storageBlobName" + Get-AzureStorageContainer -Context $storageContext -name $storageContainerName | Out-Null } catch { - OutputError -message "StorageContext secret is malformed. Needs to be formatted as Json, containing StorageAccountName, containerName, blobName and sastoken or storageAccountKey, which points to an existing container in a storage account." - exit + OutputWarning -message "StorageContext secret is malformed. Needs to be formatted as Json, containing StorageAccountName, containerName, blobName and sastoken or storageAccountKey, which points to an existing container in a storage account." + $storageContext = $null } } diff --git a/Templates/AppSource App/.github/workflows/CreateOnlineDevelopmentEnvironment.yaml b/Templates/AppSource App/.github/workflows/CreateOnlineDevelopmentEnvironment.yaml index 3cfb873db..5c5fc0739 100644 --- a/Templates/AppSource App/.github/workflows/CreateOnlineDevelopmentEnvironment.yaml +++ b/Templates/AppSource App/.github/workflows/CreateOnlineDevelopmentEnvironment.yaml @@ -81,6 +81,7 @@ jobs: parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }} environmentName: ${{ github.event.inputs.environmentName }} reUseExistingEnvironment: ${{ github.event.inputs.reUseExistingEnvironment }} + directCommit: ${{ github.event.inputs.directCommit }} adminCenterApiCredentials: ${{ env.adminCenterApiCredentials }} PostProcess: diff --git a/Templates/Per Tenant Extension/.github/workflows/CreateOnlineDevelopmentEnvironment.yaml b/Templates/Per Tenant Extension/.github/workflows/CreateOnlineDevelopmentEnvironment.yaml index 3cfb873db..5c5fc0739 100644 --- a/Templates/Per Tenant Extension/.github/workflows/CreateOnlineDevelopmentEnvironment.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/CreateOnlineDevelopmentEnvironment.yaml @@ -81,6 +81,7 @@ jobs: parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }} environmentName: ${{ github.event.inputs.environmentName }} reUseExistingEnvironment: ${{ github.event.inputs.reUseExistingEnvironment }} + directCommit: ${{ github.event.inputs.directCommit }} adminCenterApiCredentials: ${{ env.adminCenterApiCredentials }} PostProcess: From 362c7454862d03181c06e84090d95e7ebdab5401 Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Tue, 15 Mar 2022 15:48:09 +0100 Subject: [PATCH 2/4] Update ReadSettings.ps1 --- Actions/ReadSettings/ReadSettings.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Actions/ReadSettings/ReadSettings.ps1 b/Actions/ReadSettings/ReadSettings.ps1 index 16faac682..d6446ae6e 100644 --- a/Actions/ReadSettings/ReadSettings.ps1 +++ b/Actions/ReadSettings/ReadSettings.ps1 @@ -9,9 +9,9 @@ Param( [string] $project = ".", [Parameter(HelpMessage = "Indicates whether you want to retrieve the list of project list as well", Mandatory = $false)] [bool] $getprojects, - [Parameter(HelpMessage = "Specify the pattern of the environments you want to retreive (or empty for no environments)", Mandatory = $false)] + [Parameter(HelpMessage = "Specifies the pattern of the environments you want to retreive (or empty for no environments)", Mandatory = $false)] [string] $getenvironments = "", - [Parameter(HelpMessage = "Specify whether you want to include production environments", Mandatory = $false)] + [Parameter(HelpMessage = "Specifies whether you want to include production environments", Mandatory = $false)] [bool] $includeProduction, [Parameter(HelpMessage = "Indicates whether this is called from a release pipeline", Mandatory = $false)] [bool] $release, From 253091f025b121bd56b47d655b945abec1a7eb54 Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Tue, 15 Mar 2022 15:49:27 +0100 Subject: [PATCH 3/4] Update action.yaml --- Actions/ReadSettings/action.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Actions/ReadSettings/action.yaml b/Actions/ReadSettings/action.yaml index f5a1ee17f..6d79002f4 100644 --- a/Actions/ReadSettings/action.yaml +++ b/Actions/ReadSettings/action.yaml @@ -17,10 +17,6 @@ inputs: description: Project folder required: false default: '.' - release: - description: Indicates whether this is called from a release pipeline - required: false - default: 'N' getprojects: description: Indicates whether you want to retrieve the list of project list as well required: false @@ -29,6 +25,10 @@ inputs: description: Specifies the pattern of the environments you want to retreive (or empty for no environments) required: false default: '' + release: + description: Indicates whether this is called from a release pipeline + required: false + default: 'N' includeProduction: description: Specifies whether you want to include production environments required: false From 494b2b3ca0d8b1d51e2304bbe975477333027e03 Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Tue, 15 Mar 2022 15:50:00 +0100 Subject: [PATCH 4/4] Update action.yaml --- Actions/ReadSettings/action.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Actions/ReadSettings/action.yaml b/Actions/ReadSettings/action.yaml index 6d79002f4..8183556bf 100644 --- a/Actions/ReadSettings/action.yaml +++ b/Actions/ReadSettings/action.yaml @@ -25,14 +25,14 @@ inputs: description: Specifies the pattern of the environments you want to retreive (or empty for no environments) required: false default: '' - release: - description: Indicates whether this is called from a release pipeline - required: false - default: 'N' includeProduction: description: Specifies whether you want to include production environments required: false default: 'N' + release: + description: Indicates whether this is called from a release pipeline + required: false + default: 'N' get: description: Specifies which properties to get from the settings file, default is all required: false