Skip to content

Commit d3b4ae6

Browse files
authored
Regression + test failure (#3728)
Fixes #3727 --------- Co-authored-by: freddydk <[email protected]>
1 parent 031d1a5 commit d3b4ae6

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

AppHandling/Compile-AppInNavContainer.ps1

+2-2
Original file line numberDiff line numberDiff line change
@@ -431,11 +431,11 @@ try {
431431
else {
432432
(($_.Name -eq $dependency.name) -and ($_.Name -eq "Application" -or (($_.Publisher -eq $dependency.publisher) -and ([System.Version]$_.Version -ge [System.Version]$dependency.version))))
433433
}
434-
}
434+
} | Sort-Object { [System.Version]$_.Version } -Descending | Select-Object -First 1
435435
$addDependencies = @()
436436
if ($existingApp) {
437437
Write-Host "Dependency App exists"
438-
if ($existingApp.PropagateDependencies) {
438+
if ($existingApp.ContainsKey('PropagateDependencies') -and $existingApp.PropagateDependencies -and $existingApp.ContainsKey('Dependencies')) {
439439
$addDependencies += $existingApp.Dependencies
440440
}
441441
}

CompilerFolderHandling/Compile-AppWithBcCompilerFolder.ps1

+2-2
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,11 @@ try {
186186
Write-Host "Processing dependency $($dependency.Publisher)_$($dependency.Name)_$($dependency.Version) ($($dependency.AppId))"
187187
$existingApp = $existingApps | Where-Object {
188188
((($dependency.appId -ne '' -and $_.AppId -eq $dependency.appId) -or ($dependency.appId -eq '' -and $_.Name -eq $dependency.Name)) -and ([System.Version]$_.Version -ge [System.Version]$dependency.version))
189-
}
189+
} | Sort-Object { [System.Version]$_.Version } -Descending | Select-Object -First 1
190190
$addDependencies = $()
191191
if ($existingApp) {
192192
Write-Host "Dependency App exists"
193-
if ($existingApp.ContainsKey('PropagateDependencies') -and $existingApp.PropagateDependencies) {
193+
if ($existingApp.ContainsKey('PropagateDependencies') -and $existingApp.PropagateDependencies -and $existingApp.ContainsKey('Dependencies')) {
194194
$addDependencies += $existingApp.Dependencies
195195
}
196196
}

ReleaseNotes.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
6.0.27
22
Issue 3538 Compile-AppWithBcCompilerFolder fails when dependency does propagateDependencies
3+
Issue 3727 Regression - Release pipelines failing with SaaS environments due BcAuthContext
34

45
6.0.26
56
As minimum, always use the generic tag version which was available when shipping BcContainerHelper

Saas/Publish-PerTenantExtensionApps.ps1

+5-4
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ function Publish-PerTenantExtensionApps {
5151
$telemetryScope = InitTelemetryScope -name $MyInvocation.InvocationName -parameterValues $PSBoundParameters -includeParameters @()
5252
try {
5353

54-
$script:authContext = Renew-BcAuthContext -bcAuthContext $bcAuthContext
55-
5654
function GetAuthHeaders {
5755
$script:authContext = Renew-BcAuthContext -bcAuthContext $script:authContext
5856
return @{ "Authorization" = "Bearer $($script:authContext.AccessToken)" }
@@ -69,16 +67,19 @@ try {
6967
if ($clientSecret -is [String]) { $clientSecret = ConvertTo-SecureString -String $clientSecret -AsPlainText -Force }
7068
if ($clientSecret -isnot [SecureString]) { throw "ClientSecret needs to be a SecureString or a String" }
7169

72-
$bcauthContext = New-BcAuthContext `
70+
$script:authContext = New-BcAuthContext `
7371
-clientID $clientID `
7472
-clientSecret $clientSecret `
7573
-tenantID $tenantId `
7674
-scopes "https://api.businesscentral.dynamics.com/.default"
7775

78-
if (-not ($bcAuthContext)) {
76+
if (-not ($script:AuthContext)) {
7977
throw "Authentication failed"
8078
}
8179
}
80+
else {
81+
$script:authContext = Renew-BcAuthContext -bcAuthContext $bcAuthContext
82+
}
8283

8384
$appFolder = Join-Path ([System.IO.Path]::GetTempPath()) ([guid]::NewGuid().ToString())
8485
try {

0 commit comments

Comments
 (0)