Skip to content

Commit

Permalink
Try
Browse files Browse the repository at this point in the history
  • Loading branch information
aholstrup1 committed Nov 1, 2024
1 parent 7e24ffd commit 3b801e7
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 9 deletions.
43 changes: 43 additions & 0 deletions Build/Scripts/ImportTestDataInBcContainer.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Param(
[Parameter(ParameterSetName="ALGo")]
[Hashtable]$parameters,
[Parameter(ParameterSetName="Manual")]
[string]$containerName
)

function Get-NavDefaultCompanyName
{
return "CRONUS International Ltd."
}

if ($PSCmdlet.ParameterSetName -eq 'ALGo') {
$containerName = $parameters.ContainerName
}

# Get the repoversion
Import-Module "$PSScriptRoot\EnlistmentHelperFunctions.psm1"

$installedApps = Get-BcContainerAppInfo -containerName $parameters.ContainerName -tenantSpecificProperties -sort DependenciesLast
$appsToBeUnPublished = (Get-ConfigValue -ConfigType "BuildConfig" -Key "AppsNotToBePublished")
$installedApps | ForEach-Object {
if ($_.Name -in $appsToBeUnPublished) {
Write-Host "Unpublishing $($_.Name)"
Unpublish-BcContainerApp -containerName $parameters.ContainerName -name $_.Name -unInstall -doNotSaveData -doNotSaveSchema -force
}
}

try {
$repoVersion = Get-ConfigValue -ConfigType "AL-GO" -Key "RepoVersion"
$DemoDataType = "EXTENDED"

Write-Host "Initializing company"
Invoke-NavContainerCodeunit -Codeunitid 2 -containerName $containerName -CompanyName (Get-NavDefaultCompanyName)

Write-Host "Importing configuration package"
Invoke-NavContainerCodeunit -Codeunitid 8620 -containerName $containerName -CompanyName (Get-NavDefaultCompanyName) -MethodName "ImportAndApplyRapidStartPackage" -Argument "C:\ConfigurationPackages\NAV$($repoVersion).W1.ENU.$($DemoDataType).rapidstart"
} catch {
Write-Host "Error while importing configuration package"
Write-Host $_.Exception.Message
Write-Host $_.Exception.StackTrace
exit 1
}
9 changes: 0 additions & 9 deletions Build/Scripts/RunTestsInBcContainer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,4 @@ if ($disabledTests)
$parameters["disabledTests"] = $disabledTests
}

$installedApps = Get-BcContainerAppInfo -containerName $parameters.ContainerName -tenantSpecificProperties -sort DependenciesLast
$appsToBeUnPublished = (Get-ConfigValue -ConfigType "BuildConfig" -Key "AppsNotToBePublished")
$installedApps | ForEach-Object {
if ($_.Name -in $appsToBeUnPublished) {
Write-Host "Unpublishing $($_.Name)"
Unpublish-BcContainerApp -containerName $parameters.ContainerName -name $_.Name -unInstall -doNotSaveData -doNotSaveSchema -force
}
}

Run-TestsInBcContainer @parameters
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Param(
[Hashtable]$parameters
)

$script = Join-Path $PSScriptRoot "../../../scripts/ImportTestDataInBcContainer.ps1" -Resolve
. $script -parameters $parameters

0 comments on commit 3b801e7

Please sign in to comment.