Skip to content

Commit

Permalink
Regression + test failure (#3728)
Browse files Browse the repository at this point in the history
Fixes #3727

---------

Co-authored-by: freddydk <freddydk@users.noreply.github.com>
  • Loading branch information
freddydk and freddydk authored Oct 16, 2024
1 parent 031d1a5 commit d3b4ae6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions AppHandling/Compile-AppInNavContainer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -431,11 +431,11 @@ try {
else {
(($_.Name -eq $dependency.name) -and ($_.Name -eq "Application" -or (($_.Publisher -eq $dependency.publisher) -and ([System.Version]$_.Version -ge [System.Version]$dependency.version))))
}
}
} | Sort-Object { [System.Version]$_.Version } -Descending | Select-Object -First 1
$addDependencies = @()
if ($existingApp) {
Write-Host "Dependency App exists"
if ($existingApp.PropagateDependencies) {
if ($existingApp.ContainsKey('PropagateDependencies') -and $existingApp.PropagateDependencies -and $existingApp.ContainsKey('Dependencies')) {
$addDependencies += $existingApp.Dependencies
}
}
Expand Down
4 changes: 2 additions & 2 deletions CompilerFolderHandling/Compile-AppWithBcCompilerFolder.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,11 @@ try {
Write-Host "Processing dependency $($dependency.Publisher)_$($dependency.Name)_$($dependency.Version) ($($dependency.AppId))"
$existingApp = $existingApps | Where-Object {
((($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))
}
} | Sort-Object { [System.Version]$_.Version } -Descending | Select-Object -First 1
$addDependencies = $()
if ($existingApp) {
Write-Host "Dependency App exists"
if ($existingApp.ContainsKey('PropagateDependencies') -and $existingApp.PropagateDependencies) {
if ($existingApp.ContainsKey('PropagateDependencies') -and $existingApp.PropagateDependencies -and $existingApp.ContainsKey('Dependencies')) {
$addDependencies += $existingApp.Dependencies
}
}
Expand Down
1 change: 1 addition & 0 deletions ReleaseNotes.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
6.0.27
Issue 3538 Compile-AppWithBcCompilerFolder fails when dependency does propagateDependencies
Issue 3727 Regression - Release pipelines failing with SaaS environments due BcAuthContext

6.0.26
As minimum, always use the generic tag version which was available when shipping BcContainerHelper
Expand Down
9 changes: 5 additions & 4 deletions Saas/Publish-PerTenantExtensionApps.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ function Publish-PerTenantExtensionApps {
$telemetryScope = InitTelemetryScope -name $MyInvocation.InvocationName -parameterValues $PSBoundParameters -includeParameters @()
try {

$script:authContext = Renew-BcAuthContext -bcAuthContext $bcAuthContext

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

$bcauthContext = New-BcAuthContext `
$script:authContext = New-BcAuthContext `
-clientID $clientID `
-clientSecret $clientSecret `
-tenantID $tenantId `
-scopes "https://api.businesscentral.dynamics.com/.default"

if (-not ($bcAuthContext)) {
if (-not ($script:AuthContext)) {
throw "Authentication failed"
}
}
else {
$script:authContext = Renew-BcAuthContext -bcAuthContext $bcAuthContext
}

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

0 comments on commit d3b4ae6

Please sign in to comment.