Skip to content

Commit 6e5776c

Browse files
Don't remove packagesFolder if it already exists (#3910)
If compilefolders are used the packages folder will be deleted and recreated during the pipeline run. In certain cases especially when you use customized AL:Go with foreign container systems, this folder exists on purpose and already includes files. This files should not be deleted because it will lead the pipeline to fail
1 parent e97b665 commit 6e5776c

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

AppHandling/Run-AlPipeline.ps1

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -875,10 +875,12 @@ if ($updateLaunchJson) {
875875

876876
if ($useCompilerFolder -or $filesOnly -or !$useDevEndpoint) {
877877
$packagesFolder = CheckRelativePath -baseFolder $baseFolder -sharedFolder $sharedFolder -path $packagesFolder -name "packagesFolder"
878-
if (Test-Path $packagesFolder) {
879-
Remove-Item $packagesFolder -Recurse -Force
878+
if (!($bcContainerHelperConfig.doNotRemovePackagesFolderIfExists)) {
879+
if (Test-Path $packagesFolder) {
880+
Remove-Item $packagesFolder -Recurse -Force
881+
}
880882
}
881-
New-Item $packagesFolder -ItemType Directory | Out-Null
883+
New-Item $packagesFolder -ItemType Directory -Force | Out-Null
882884
}
883885

884886
if ($useDevEndpoint) {

BC.HelperFunctions.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ function Get-ContainerHelperConfig {
122122
"useApproximateVersion" = $false
123123
"useSqlServerModule" = $false
124124
"NuGetSearchResultsCacheRetentionPeriod" = 600 # 10 minutes
125+
"doNotRemovePackagesFolderIfExists" = $false
125126
}
126127

127128
if ($isInsider) {

ReleaseNotes.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Fixes issues determining test symbols for W1 and OnPrem artifacts not containing
99
Add cache for search results of a NuGet feed
1010
Add new setting NuGetSearchResultsCacheRetentionPeriod (default: 600) to set the retention period (in seconds) for the search result cache of NuGet feeds (0 to disable the cache)
1111
Download-BcNuGetPackageToFolder checks all direct dependency versions of a package based on the NuSpec before downloading the whole package and its dependencies
12+
New Option doNotRemovePackagesFolderIfExists to prevent Run-ALPipeline from deleting the packages folder, if it already exists. Default is false
1213
Add support for Windows 2025 Containers
1314

1415
6.1.3

0 commit comments

Comments
 (0)