From a5348272c062afd4955976a04b53e37fda759273 Mon Sep 17 00:00:00 2001 From: freddydk Date: Wed, 17 Jul 2024 08:13:30 +0900 Subject: [PATCH 1/6] use local containerhelper --- Actions/AL-Go-Helper.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Actions/AL-Go-Helper.ps1 b/Actions/AL-Go-Helper.ps1 index a9dbe0f41..60a43768c 100644 --- a/Actions/AL-Go-Helper.ps1 +++ b/Actions/AL-Go-Helper.ps1 @@ -18,7 +18,7 @@ $defaultCICDPushBranches = @( 'main', 'release/*', 'feature/*' ) [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'defaultCICDPullRequestBranches', Justification = 'False positive.')] $defaultCICDPullRequestBranches = @( 'main' ) $runningLocal = $local.IsPresent -$defaultBcContainerHelperVersion = "preview" # Must be double quotes. Will be replaced by BcContainerHelperVersion if necessary in the deploy step - ex. "https://github.com/organization/navcontainerhelper/archive/refs/heads/branch.zip" +$defaultBcContainerHelperVersion = "https://github.com/freddydk/navcontainerhelper/archive/refs/heads/issue1131.zip" # Must be double quotes. Will be replaced by BcContainerHelperVersion if necessary in the deploy step - ex. "https://github.com/organization/navcontainerhelper/archive/refs/heads/branch.zip" $microsoftTelemetryConnectionString = "InstrumentationKey=84bd9223-67d4-4378-8590-9e4a46023be2;IngestionEndpoint=https://westeurope-1.in.applicationinsights.azure.com/" $notSecretProperties = @("Scopes","TenantId","BlobName","ContainerName","StorageAccountName","ServerUrl","ppUserName") From f4e554fa814cd2502c8ab0d66521668ed7917111 Mon Sep 17 00:00:00 2001 From: freddydk Date: Sat, 20 Jul 2024 05:57:58 +0200 Subject: [PATCH 2/6] Bug fixes --- Actions/AL-Go-Helper.ps1 | 2 +- Actions/Deploy/Deploy.ps1 | 8 ++++-- .../DetermineDeploymentEnvironments.ps1 | 2 ++ RELEASENOTES.md | 1 + Scenarios/settings.md | 28 ++++++++++++++----- .../DetermineDeploymentEnvironments.Test.ps1 | 8 +++--- 6 files changed, 35 insertions(+), 14 deletions(-) diff --git a/Actions/AL-Go-Helper.ps1 b/Actions/AL-Go-Helper.ps1 index 60a43768c..a9dbe0f41 100644 --- a/Actions/AL-Go-Helper.ps1 +++ b/Actions/AL-Go-Helper.ps1 @@ -18,7 +18,7 @@ $defaultCICDPushBranches = @( 'main', 'release/*', 'feature/*' ) [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'defaultCICDPullRequestBranches', Justification = 'False positive.')] $defaultCICDPullRequestBranches = @( 'main' ) $runningLocal = $local.IsPresent -$defaultBcContainerHelperVersion = "https://github.com/freddydk/navcontainerhelper/archive/refs/heads/issue1131.zip" # Must be double quotes. Will be replaced by BcContainerHelperVersion if necessary in the deploy step - ex. "https://github.com/organization/navcontainerhelper/archive/refs/heads/branch.zip" +$defaultBcContainerHelperVersion = "preview" # Must be double quotes. Will be replaced by BcContainerHelperVersion if necessary in the deploy step - ex. "https://github.com/organization/navcontainerhelper/archive/refs/heads/branch.zip" $microsoftTelemetryConnectionString = "InstrumentationKey=84bd9223-67d4-4378-8590-9e4a46023be2;IngestionEndpoint=https://westeurope-1.in.applicationinsights.azure.com/" $notSecretProperties = @("Scopes","TenantId","BlobName","ContainerName","StorageAccountName","ServerUrl","ppUserName") diff --git a/Actions/Deploy/Deploy.ps1 b/Actions/Deploy/Deploy.ps1 index 5cb16d620..9e70aaea3 100644 --- a/Actions/Deploy/Deploy.ps1 +++ b/Actions/Deploy/Deploy.ps1 @@ -15,6 +15,10 @@ DownloadAndImportBcContainerHelper $deploymentEnvironments = $deploymentEnvironmentsJson | ConvertFrom-Json | ConvertTo-HashTable -recurse $deploymentSettings = $deploymentEnvironments."$environmentName" +$buildMode = $deploymentSettings.buildMode +if ($null -eq $buildMode -or $buildMode -eq 'default') { + $buildMode = '' +} $envName = $environmentName.Split(' ')[0] $secrets = $env:Secrets | ConvertFrom-Json $settings = $env:Settings | ConvertFrom-Json @@ -43,10 +47,10 @@ if (Test-Path $artifactsFolder -PathType Container) { $project = $_.Replace('\','_').Replace('/','_') $refname = "$ENV:GITHUB_REF_NAME".Replace('/','_') Write-Host "project '$project'" - $projectApps = @((Get-ChildItem -Path $artifactsFolder -Filter "$project-$refname-Apps-*.*.*.*") | ForEach-Object { $_.FullName }) + $projectApps = @((Get-ChildItem -Path $artifactsFolder -Filter "$project-$refname-$($buildMode)Apps-*.*.*.*") | ForEach-Object { $_.FullName }) if (!($projectApps)) { if ($project -ne '*') { - throw "There are no artifacts present in $artifactsFolder matching $project-$refname-Apps-." + throw "There are no artifacts present in $artifactsFolder matching $project-$refname-$($buildMode)Apps-." } } else { diff --git a/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 b/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 index b5bc28125..f63047ff9 100644 --- a/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 +++ b/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 @@ -106,6 +106,7 @@ if (!($environments)) { "Projects" = '*' "SyncMode" = $null "Scope" = $null + "buildMode" = $null "continuousDeployment" = !($getEnvironments -like '* (PROD)' -or $getEnvironments -like '* (Production)' -or $getEnvironments -like '* (FAT)' -or $getEnvironments -like '* (Final Acceptance Test)') "runs-on" = @($settings."runs-on".Split(',').Trim()) "shell" = $settings."shell" @@ -145,6 +146,7 @@ else { "Projects" = '*' "SyncMode" = $null "Scope" = $null + "buildMode" = $null "continuousDeployment" = $null "runs-on" = @($settings."runs-on".Split(',').Trim()) "shell" = $settings."shell" diff --git a/RELEASENOTES.md b/RELEASENOTES.md index a6942f10c..dbc55dbc4 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -27,6 +27,7 @@ In the summary after a Test Run, you now also have the result of performance tes - `deployTo`: is not really new, but has a new property: - **Scope** = specifies the scope of the deployment: Dev, PTE. If not specified, AL-Go for GitHub will always use the Dev Scope for AppSource Apps, but also for PTEs when deploying to sandbox environments when impersonation (refreshtoken) is used for authentication. + - **BuildMode** = specifies which buildMode to use for the deployment. Default is to use the Default buildMode. - **\** = custom properties are now supported and will be transferred to a custom deployment script in the hashtable. - `bcptThresholds` is a JSON object with properties for the default thresholds for the Business Central Performance Toolkit diff --git a/Scenarios/settings.md b/Scenarios/settings.md index 77a0c0de1..3a9753c23 100644 --- a/Scenarios/settings.md +++ b/Scenarios/settings.md @@ -68,7 +68,7 @@ The repository settings are only read from the repository settings file (.github | githubRunnerShell | Specifies which shell is used for build jobs in workflows including a build job. The default is to use the same as defined in **shell**. If the shell setting isn't defined, **powershell** is the default, which results in using _PowerShell 5.1_. Use **pwsh** for _PowerShell 7_. | | environments | Array of logical environment names. You can specify environments in GitHub environments or in the repo settings file. If you specify environments in the settings file, you can create your AUTHCONTEXT secret using **\\_AUTHCONTEXT**. You can specify additional information about environments in a setting called **DeployTo\** | | DeliverTo\ | Structure with additional properties for the deliveryTarget specified. Some properties are deliveryTarget specific. The structure can contain the following properties:
**Branches** = an array of branch patterns, which are allowed to deliver to this deliveryTarget. (Default main)
**CreateContainerIfNotExist** = *\[Only for DeliverToStorage\]* Create Blob Storage Container if it doesn't already exist. (Default false)
| -| DeployTo\ | Structure with additional properties for the environment specified. The structure can contain the following properties:
**EnvironmentType** = specifies the type of environment. The environment type can be used to invoke a custom deployment. (Default SaaS)
**EnvironmentName** = specifies the "real" name of the environment if it differs from the GitHub environment.
**Branches** = an array of branch patterns, which are allowed to deploy to this environment. These branches can also be defined under the environment in GitHub settings and both settings are honored. If neither setting is defined, the default is the **main** branch only.
**Projects** = In multi-project repositories, this property can be a comma separated list of project patterns to deploy to this environment. (Default \*)
**Scope** = Determines the mechanism for deployment to the environment (Dev or PTE). If not specified, AL-Go for GitHub will always use the Dev Scope for AppSource Apps, but also for PTEs when deploying to sandbox environments when impersonation (refreshtoken) is used for authentication.
**SyncMode** = ForceSync if deployment to this environment should happen with ForceSync, else Add. If deploying to the development endpoint you can also specify Development or Clean. (Default Add)
**ContinuousDeployment** = true if this environment should be used for continuous deployment, else false. (Default: AL-Go will continuously deploy to sandbox environments or environments, which doesn't end in (PROD) or (FAT)
**runs-on** = specifies which runner to use when deploying to this environment. (Default is settings.runs-on)
**shell** = specifies which shell to use when deploying to this environment, pwsh or powershell. (Default is settings.shell)
**companyId** = Company Id from Business Central (for PowerPlatform connection)
**ppEnvironmentUrl** = Url of the PowerPlatform environment to deploy to
| +| DeployTo\ | Structure with additional properties for the environment specified. `` refers to the GitHub environment name. The structure can contain the following properties:
**EnvironmentType** = specifies the type of environment. The environment type can be used to invoke a custom deployment. (Default SaaS)
**EnvironmentName** = specifies the "real" name of the environment if it differs from the GitHub environment.
**Branches** = an array of branch patterns, which are allowed to deploy to this environment. These branches can also be defined under the environment in GitHub settings and both settings are honored. If neither setting is defined, the default is the **main** branch only.
**Projects** = In multi-project repositories, this property can be a comma separated list of project patterns to deploy to this environment. (Default \*)
**Scope** = Determines the mechanism for deployment to the environment (Dev or PTE). If not specified, AL-Go for GitHub will always use the Dev Scope for AppSource Apps, but also for PTEs when deploying to sandbox environments when impersonation (refreshtoken) is used for authentication.
**SyncMode** = ForceSync if deployment to this environment should happen with ForceSync, else Add. If deploying to the development endpoint you can also specify Development or Clean. (Default Add)
**BuildMode** = specifies which buildMode to use for the deployment. Default is to use the Default buildMode
**ContinuousDeployment** = true if this environment should be used for continuous deployment, else false. (Default: AL-Go will continuously deploy to sandbox environments or environments, which doesn't end in (PROD) or (FAT)
**runs-on** = specifies which runner to use when deploying to this environment. (Default is settings.runs-on)
**shell** = specifies which shell to use when deploying to this environment, pwsh or powershell. (Default is settings.shell)
**companyId** = Company Id from Business Central (for PowerPlatform connection)
**ppEnvironmentUrl** = Url of the PowerPlatform environment to deploy to
| | alDoc | Structure with properties for the aldoc reference document generation. The structure can contain the following properties:
**continuousDeployment** = Determines if reference documentation will be deployed continuously as part of CI/CD. You can run the **Deploy Reference Documentation** workflow to deploy manually or on a schedule. (Default false)
**deployToGitHubPages** = Determines whether or not the reference documentation site should be deployed to GitHub Pages for the repository. In order to deploy to GitHub Pages, GitHub Pages must be enabled and set to GitHub Actuibs. (Default true)
**maxReleases** = Maximum number of releases to include in the reference documentation. (Default 3)
**groupByProject** = Determines whether projects in multi-project repositories are used as folders in reference documentation
**includeProjects** = An array of projects to include in the reference documentation. (Default all)
**excludeProjects** = An array of projects to exclude in the reference documentation. (Default none)
**header** = Header for the documentation site. (Default: Documentation for...)
**footer** = Footer for the documentation site. (Default: Made with...)
**defaultIndexMD** = Markdown for the landing page of the documentation site. (Default: Reference documentation...)
**defaultReleaseMD** = Markdown for the landing page of the release sites. (Default: Release reference documentation...)
*Note that in header, footer, defaultIndexMD and defaultReleaseMD you can use the following placeholders: {REPOSITORY}, {VERSION}, {INDEXTEMPLATERELATIVEPATH}, {RELEASENOTES}* | | useProjectDependencies | Determines whether your projects are built using a multi-stage built workflow or single stage. After setting useProjectDependencies to true, you need to run Update AL-Go System Files and your workflows including a build job will change to have multiple build jobs, depending on each other. The number of build jobs will be determined by the dependency depth in your projects.
You can change dependencies between your projects, but if the dependency **depth** changes, AL-Go will warn you that updates for your AL-Go System Files are available and you will need to run the workflow. | | CICDPushBranches | CICDPushBranches can be specified as an array of branches, which triggers a CI/CD workflow on commit. You need to run the Update AL-Go System Files workflow for the schedule to take effect.
Default is \[ "main", "release/\*", "feature/\*" \] | @@ -203,9 +203,9 @@ Which will ensure that for all repositories named `bcsamples-*` in this organiza You can override existing AL-Go Delivery functionality or you can define your own custom delivery mechanism for AL-Go for GitHub, by specifying a PowerShell script named DeliverTo\*.ps1 in the .github folder. The following example will spin up a delivery job to SharePoint on CI/CD and Release. -DeliverToSharePoint.ps1 +### DeliverToSharePoint.ps1 -``` +```powershell Param( [Hashtable]$parameters ) @@ -242,11 +242,11 @@ Here are the parameters to use in your custom script: ## Custom Deployment -You can override existing AL-Go Deployment functionality or you can define your own custom deployment mechanism for AL-Go for GitHub. By specifying a PowerShell script named `DeployTo.ps1` in the .github folder. Default Environment Type is SaaS, but you can define your own type by specifying EnvironmentType in the `DeployTo` setting. The following example will spin up a deployment job to SharePoint on CI/CD and Publish To Environment. +You can override existing AL-Go Deployment functionality or you can define your own custom deployment mechanism for AL-Go for GitHub. By specifying a PowerShell script named `DeployTo.ps1` in the .github folder. Default Environment Type is SaaS, but you can define your own type by specifying EnvironmentType in the `DeployTo` setting. The following example will create a script, which would be called by CI/CD and Publish To Environment, when EnvironmentType is set to OnPrem. -DeployToMyEnvironment.ps1 +### DeployToOnPrem.ps1 -``` +```powershell Param( [Hashtable]$parameters ) @@ -255,10 +255,21 @@ Write-Host "Deployment Type (CD or Release): $($parameters.type)" Write-Host "Apps to deploy: $($parameters.apps)" Write-Host "Environment Type: $($parameters.EnvironmentType)" Write-Host "Environment Name: $($parameters.EnvironmentName)" + +$tempPath = Join-Path ([System.IO.Path]::GetTempPath()) ([GUID]::NewGuid().ToString()) +New-Item -ItemType Directory -Path $tempPath | Out-Null +Copy-AppFilesToFolder -appFiles $parameters.apps -folder $tempPath | Out-Null +$appsList = @(Get-ChildItem -Path $tempPath -Filter *.app) +if (-not $appsList -or $appsList.Count -eq 0) { + Write-Host "::error::No apps to publish found." + exit 1 +} +Write-Host "Apps:" +$appsList | ForEach-Object { Write-Host "- $($_.Name)" } ``` > \[!NOTE\] -> You can create one script to override all deployment functionality, by creating a script called Deploy.ps1 in the .github folder. +> You can override existing AL-Go for GitHub deployment functionality by creating a script called f.ex. DeployToSaas.ps1 in the .github folder, as the default deployment type is Saas. Here are the parameters to use in your custom script: @@ -272,6 +283,9 @@ Here are the parameters to use in your custom script: | `$parameters.AuthContext` | AuthContext in a compressed Json structure | {"refreshToken":"mytoken"} | | `$parameters.BranchesFromPolicy` | Branches which should deploy to this environment (from GitHub environments) | main | | `$parameters.Projects` | Projects to deploy to this environment | | +| `$parameters.Scope` | Identifies the scope for the deployment, Dev or PTE | PTE | +| `$parameters.SyncMode` | Is the SyncMode to use for the deployment: ForceSync or Add. If deploying to the dev scope, it can also be Development or Clean | Add | +| `$parameters.BuildMode` | Is the buildMode used for the deployment | Clean | | `$parameters.ContinuousDeployment` | Is this environment setup for continuous deployment | false | | `$parameters."runs-on"` | GitHub runner to be used to run the deployment script | windows-latest | | `$parameters."shell"` | Shell used to run the deployment script, pwsh or powershell | powershell | diff --git a/Tests/DetermineDeploymentEnvironments.Test.ps1 b/Tests/DetermineDeploymentEnvironments.Test.ps1 index 464250a9c..762330453 100644 --- a/Tests/DetermineDeploymentEnvironments.Test.ps1 +++ b/Tests/DetermineDeploymentEnvironments.Test.ps1 @@ -60,13 +60,13 @@ Describe "DetermineDeploymentEnvironments Action Test" { . (Join-Path $scriptRoot $scriptName) -getEnvironments '*' -type 'CD' PassGeneratedOutput $EnvironmentsMatrixJson | ConvertFrom-Json | ConvertTo-HashTable -recurse | Should -MatchHashtable @{"matrix"=@{"include"=@(@{"environment"="another";"os"="[""ubuntu-latest""]";"shell"="pwsh"};@{"environment"="test";"os"="[""ubuntu-latest""]";"shell"="pwsh"})};"fail-fast"=$false} - $DeploymentEnvironmentsJson | ConvertFrom-Json | ConvertTo-HashTable -recurse | Should -MatchHashtable @{"test"=@{"EnvironmentType"="SaaS";"EnvironmentName"="test";"Branches"=@();"BranchesFromPolicy"=@();"Projects"="*";"Scope"=$null;"SyncMode"=$null;"continuousDeployment"=$null;"runs-on"=@("ubuntu-latest");"shell"="pwsh";"ppEnvironmentUrl"="";"companyId"=""};"another"=@{"EnvironmentType"="SaaS";"EnvironmentName"="another";"Branches"=@();"BranchesFromPolicy"=@();"Projects"="*";"Scope"=$null;"SyncMode"=$null;"continuousDeployment"=$null;"runs-on"=@("ubuntu-latest");"shell"="pwsh";"ppEnvironmentUrl"="";"companyId"=""}} + $DeploymentEnvironmentsJson | ConvertFrom-Json | ConvertTo-HashTable -recurse | Should -MatchHashtable @{"test"=@{"EnvironmentType"="SaaS";"EnvironmentName"="test";"Branches"=@();"BranchesFromPolicy"=@();"Projects"="*";"Scope"=$null;"syncMode"=$null;"buildMode"=$null;"continuousDeployment"=$null;"runs-on"=@("ubuntu-latest");"shell"="pwsh";"ppEnvironmentUrl"="";"companyId"=""};"another"=@{"EnvironmentType"="SaaS";"EnvironmentName"="another";"Branches"=@();"BranchesFromPolicy"=@();"Projects"="*";"Scope"=$null;"syncMode"=$null;"buildMode"=$null;"continuousDeployment"=$null;"runs-on"=@("ubuntu-latest");"shell"="pwsh";"ppEnvironmentUrl"="";"companyId"=""}} $EnvironmentCount | Should -Be 2 . (Join-Path $scriptRoot $scriptName) -getEnvironments 'test' -type 'CD' PassGeneratedOutput $EnvironmentsMatrixJson | ConvertFrom-Json | ConvertTo-HashTable -recurse | Should -MatchHashtable @{"matrix"=@{"include"=@(@{"environment"="test";"os"="[""ubuntu-latest""]";"shell"="pwsh"})};"fail-fast"=$false} - $DeploymentEnvironmentsJson | ConvertFrom-Json | ConvertTo-HashTable -recurse | Should -MatchHashtable @{"test"=@{"EnvironmentType"="SaaS";"EnvironmentName"="test";"Branches"=@();"BranchesFromPolicy"=@();"Projects"="*";"Scope"=$null;"SyncMode"=$null;"continuousDeployment"=$null;"runs-on"=@("ubuntu-latest");"shell"="pwsh";"ppEnvironmentUrl"="";"companyId"=""}} + $DeploymentEnvironmentsJson | ConvertFrom-Json | ConvertTo-HashTable -recurse | Should -MatchHashtable @{"test"=@{"EnvironmentType"="SaaS";"EnvironmentName"="test";"Branches"=@();"BranchesFromPolicy"=@();"Projects"="*";"Scope"=$null;"syncMode"=$null;"buildMode"=$null;"continuousDeployment"=$null;"runs-on"=@("ubuntu-latest");"shell"="pwsh";"ppEnvironmentUrl"="";"companyId"=""}} $EnvironmentCount | Should -Be 1 } @@ -83,7 +83,7 @@ Describe "DetermineDeploymentEnvironments Action Test" { . (Join-Path $scriptRoot $scriptName) -getEnvironments '*' -type 'CD' PassGeneratedOutput $EnvironmentsMatrixJson | ConvertFrom-Json | ConvertTo-HashTable -recurse | Should -MatchHashtable @{"matrix"=@{"include"=@(@{"environment"="another";"os"="[""ubuntu-latest""]";"shell"="pwsh"})};"fail-fast"=$false} - $DeploymentEnvironmentsJson | ConvertFrom-Json | ConvertTo-HashTable -recurse | Should -MatchHashtable @{"another"=@{"EnvironmentType"="SaaS";"EnvironmentName"="another";"Branches"=@();"BranchesFromPolicy"=@();"Projects"="*";"Scope"=$null;"SyncMode"=$null;"continuousDeployment"=$null;"runs-on"=@("ubuntu-latest");"shell"="pwsh";"ppEnvironmentUrl"="";"companyId"=""}} + $DeploymentEnvironmentsJson | ConvertFrom-Json | ConvertTo-HashTable -recurse | Should -MatchHashtable @{"another"=@{"EnvironmentType"="SaaS";"EnvironmentName"="another";"Branches"=@();"BranchesFromPolicy"=@();"Projects"="*";"Scope"=$null;"syncMode"=$null;"buildMode"=$null;"continuousDeployment"=$null;"runs-on"=@("ubuntu-latest");"shell"="pwsh";"ppEnvironmentUrl"="";"companyId"=""}} $EnvironmentCount | Should -Be 1 $env:GITHUB_REF_NAME = 'branch' @@ -109,7 +109,7 @@ Describe "DetermineDeploymentEnvironments Action Test" { . (Join-Path $scriptRoot $scriptName) -getEnvironments '*' -type 'CD' PassGeneratedOutput $EnvironmentsMatrixJson | ConvertFrom-Json | ConvertTo-HashTable -recurse | Should -MatchHashtable @{"matrix"=@{"include"=@(@{"environment"="another";"os"="[""ubuntu-latest""]";"shell"="pwsh"})};"fail-fast"=$false} - $DeploymentEnvironmentsJson | ConvertFrom-Json | ConvertTo-HashTable -recurse | Should -MatchHashtable @{"another"=@{"EnvironmentType"="SaaS";"EnvironmentName"="another";"Branches"=@();"BranchesFromPolicy"=@();"Projects"="*";"Scope"=$null;"SyncMode"=$null;"continuousDeployment"=$null;"runs-on"=@("ubuntu-latest");"shell"="pwsh";"ppEnvironmentUrl"="";"companyId"=""}} + $DeploymentEnvironmentsJson | ConvertFrom-Json | ConvertTo-HashTable -recurse | Should -MatchHashtable @{"another"=@{"EnvironmentType"="SaaS";"EnvironmentName"="another";"Branches"=@();"BranchesFromPolicy"=@();"Projects"="*";"Scope"=$null;"syncMode"=$null;"buildMode"=$null;"continuousDeployment"=$null;"runs-on"=@("ubuntu-latest");"shell"="pwsh";"ppEnvironmentUrl"="";"companyId"=""}} $EnvironmentCount | Should -Be 1 ($EnvironmentsMatrixJson | ConvertFrom-Json | ConvertTo-HashTable -recurse).matrix.include.environment | Should -Contain "another" From 36a1f2ad1904c33a45b69bdc33fb08569d96a83c Mon Sep 17 00:00:00 2001 From: freddydk Date: Sat, 20 Jul 2024 06:04:08 +0200 Subject: [PATCH 3/6] issue #1136 --- Actions/ReadSecrets/ReadSecretsHelper.psm1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Actions/ReadSecrets/ReadSecretsHelper.psm1 b/Actions/ReadSecrets/ReadSecretsHelper.psm1 index 9c2c39d99..48e24be6e 100644 --- a/Actions/ReadSecrets/ReadSecretsHelper.psm1 +++ b/Actions/ReadSecrets/ReadSecretsHelper.psm1 @@ -131,6 +131,10 @@ function GetKeyVaultSecret { if ($null -eq $keyVaultCredentials) { return $null } + if ($secretName.Contains('_')) { + # Secret name contains a '_', which is not allowed in Key Vault secret names + return $null + } ConnectAz -azureCredentials $keyVaultCredentials From cc171e2ce2d519d7241f8ac6b0148a72fd34bf3f Mon Sep 17 00:00:00 2001 From: freddydk Date: Mon, 22 Jul 2024 15:21:03 +0200 Subject: [PATCH 4/6] Issue #1147 --- Actions/Sign/Sign.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Actions/Sign/Sign.ps1 b/Actions/Sign/Sign.ps1 index 565189942..7600e8f20 100644 --- a/Actions/Sign/Sign.ps1 +++ b/Actions/Sign/Sign.ps1 @@ -56,7 +56,7 @@ try { } } InstallAzModuleIfNeeded -name 'Az.Accounts' - ConnectAz -azureCredentials $AzureCredentialParams + ConnectAz -azureCredentials $AzureCredentials $description = "Signed with AL-Go for GitHub" $descriptionUrl = "$ENV:GITHUB_SERVER_URL/$ENV:GITHUB_REPOSITORY" From f9014b4299c6f7d5437370aa7b65251140c3fd7d Mon Sep 17 00:00:00 2001 From: freddydk Date: Mon, 22 Jul 2024 16:16:31 +0200 Subject: [PATCH 5/6] issue #1147 --- Scenarios/secrets.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scenarios/secrets.md b/Scenarios/secrets.md index a42636eba..01676892c 100644 --- a/Scenarios/secrets.md +++ b/Scenarios/secrets.md @@ -81,7 +81,7 @@ Example: `{"keyVaultName":"MyKeyVault","clientId":"ed79570c-0384-4826-8099-bf057 #### ClientSecret -ClientSecret can only be used using an app registration. Under Certificates & Secrets in the app registration, you need to create a Client Secret, which you can specify in the AuthContext secret in AL-Go for GitHub. With the ClientId and ClientSecret, anybody can authenticate and perform actions as the connected user inside Business Central. +ClientSecret can only be used using an app registration. Under Certificates & Secrets in the app registration, you need to create a Client Secret, which you can specify in the Azure_Credentials secret in AL-Go for GitHub. With the ClientId and ClientSecret, anybody can authenticate and perform actions as the connected user inside Business Central. Example: `{"keyVaultName":"MyKeyVault","clientId":"d48b773f-2c26-4394-8bd2-c5b64e0cae32","clientSecret":"OPXxxxxxxxxxxxxxxxxxxxxxxabge","tenantId":"c645f7e7-0613-4b82-88ca-71f3dbb40045"}` From 50cc06f4767a6ec335f7d54b7644d7d6e173346c Mon Sep 17 00:00:00 2001 From: freddydk Date: Mon, 22 Jul 2024 19:48:30 +0200 Subject: [PATCH 6/6] review --- Actions/ReadSecrets/ReadSecretsHelper.psm1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Actions/ReadSecrets/ReadSecretsHelper.psm1 b/Actions/ReadSecrets/ReadSecretsHelper.psm1 index 48e24be6e..caa10acd0 100644 --- a/Actions/ReadSecrets/ReadSecretsHelper.psm1 +++ b/Actions/ReadSecrets/ReadSecretsHelper.psm1 @@ -131,10 +131,6 @@ function GetKeyVaultSecret { if ($null -eq $keyVaultCredentials) { return $null } - if ($secretName.Contains('_')) { - # Secret name contains a '_', which is not allowed in Key Vault secret names - return $null - } ConnectAz -azureCredentials $keyVaultCredentials @@ -144,6 +140,10 @@ function GetKeyVaultSecret { if ($secretSplit.Count -gt 1) { $secret = $secretSplit[1] } + if ($secret.Contains('_')) { + # Secret name contains a '_', which is not allowed in Key Vault secret names + return $null + } $value = $null try {