microsoft / navcontainerhelper

Official Microsoft repository for BcContainerHelper, a PowerShell module, which makes it easier to work with Business Central Containers on Docker.
MIT License
385 stars 246 forks source link

Error: App filenames must be unique #3477

Closed EC-Janeck closed 7 months ago

EC-Janeck commented 7 months ago

PLEASE DO NOT INCLUDE ANY PASSWORDS OR TOKENS IN YOUR ISSUE!!!

Describe the issue BcContainerHelper Version 6.0.15 With the latest changes for the CDN switch small parts of the HelperFunctions.ps1 were changed too, specifically the function CopyAppFilesToFolder was changed. These changes cause our pipelines to break down with thousends of "::WARNING:: xyz.app already exists, it looks like you have multiple app files with the same name. App filenames must be unique." When I switch those portions back the pipeline magically works again.

I created a public GitHub repository with my "Frankenstein" version of the HelperFunctions.ps1 (Franken-HelperFunctions.ps1), the original HelperFunctions.ps1 (using version of #3459) to easily compare the changes made, as well as a logs of a run with my version and the original: https://github.com/EC-Janeck/BcCHIssue

Scripts used to create container and cause the issue


Run-AlPipeline 
-pipelinename varys.rwb.core-ci 
-containerName devsrv01-varysrwbcore-ci 
-imageName bcimage 
-artifact https://bcartifacts-exdbf9fwegejdqak.b02.azurefd.net/onprem/23.2.14098.14562/de 
-licenseFile *** 
-memoryLimit 8G 
-baseFolder D:\Agent\_work\1\s 
-bcAuthContext  
-environment  
-installApps D:\Agent\_work\1\s\ 
-installTestApps  
-previousApps https://businesscentralapps.azureedge.net/helloworld/latest/apps.zip 
-appFolders D:\Agent\_work\1\s 
-doNotRunTests:False 
-azureDevOps:(AzureDevOps -eq 'AzureDevOps') 
-gitLab:(AzureDevOps -eq 'GitLab') 
-gitHubActions:(AzureDevOps -eq 'GitHubActions') 
-failOn 'error' 
-additionalCountries  
-buildArtifactFolder D:\Agent\_work\1\a 
-CreateRuntimePackages:True 
-appBuild 0 -appRevision 2936

**Full output of scripts**
See: "Log Original.txt" and "Log Franken.txt" in the GitHub repo
freddydk commented 7 months ago

This is a bug, but it is caused by an unexpected parameter for installApps. You are setting installApps to the baseFolder - meaning that Run-AlPipeline will scan the entire folder for .app files and install those. If you instead set installApps to the actual folder where your apps are located - it should work.

This HelperFunctions should contain a fix for this: https://raw.githubusercontent.com/freddydk/navcontainerhelper/issue3477/HelperFunctions.ps1

If you can try this in your setup and tell me whether this works?

EC-Janeck commented 7 months ago

@freddydk the fix works! Thanks a lot for the swift response and for pointing out that misshap with the installApp param (an environment param was blank 😅).