microsoft / navcontainerhelper

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

Question: Could not Compile app using Run-AlPipeline command, what did I wrong? #3148

Closed kpipic closed 1 year ago

kpipic commented 1 year ago

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

Describe the issue Trying to compile app using Run-AlPipeline command, but command does not compile the app. After creating container, command resolving dependencies and after that remove container without compiling app.

Scripts used to create container and cause the issue

$Credential = Get-Credential
$artifactUrl = Get-BCArtifactUrl -country w1 -select Latest -storageAccount bcartifacts -type Sandbox
Run-AlPipeline -artifact $artifactUrl -baseFolder "C:\AL\ALPipeline" -containerName sandbox-latest -credential $Credential

Full output of scripts

PS C:\Windows\system32> Run-AlPipeline -artifact $artifactUrl -baseFolder "C:\AL\ALPipeline" -containerName sandbox-latest -credential $Credential
WARNING: No app folders found
  _____                               _                
 |  __ \                             | |               
 | |__) |_ _ _ __ __ _ _ __ ___   ___| |_ ___ _ __ ___ 
 |  ___/ _` | '__/ _` | '_ ` _ \ / _ \ __/ _ \ '__/ __|
 | |  | (_| | | | (_| | | | | | |  __/ |_  __/ |  \__ \
 |_|   \__,_|_|  \__,_|_| |_| |_|\___|\__\___|_|  |___/

Pipeline name                   
Container name                  sandbox-latest
Image name                      my
ArtifactUrl                     https://bcartifacts.azureedge.net/sandbox/22.3.58346.59502/w1
SasToken                        Not Specified
BcAuthContext                   Not Specified
Environment                     
ReUseContainer                  False
KeepContainer                   False
useCompilerFolder               False
artifactCachePath               
useDevEndpoint                  False
Auth                            UserPassword
Credential                      Specified
CompanyName                     
MemoryLimit                     8G
FailOn                          none
TreatTestFailuresAsWarnings     False
Enable Task Scheduler           False
Assign Premium Plan             False
Install Test Runner             False
Install Test Framework          False
Install Test Libraries          False
Install Perf. Toolkit           False
InstallOnlyReferencedApps       False
generateDependencyArtifact      False
CopySymbolsFromContainer        False
enableCodeCop                   False
enableAppSourceCop              False
enableUICop                     False
enablePerTenantExtensionCop     False
doNotPerformUpgrade             False
doNotPublishApps                False
uninstallRemovedApps            False
escapeFromCops                  False
doNotBuildTests                 False
doNotRunTests                   False
doNotRunBcptTests               False
useDefaultAppSourceRuleSet      False
rulesetFile                     
azureDevOps                     False
gitLab                          False
gitHubActions                   False
vsixFile                        
License file                    Not specified
CodeSignCertPfxFile             Not specified
CodeSignCertPfxPassword         Not specified
CodeSignCertIsSelfSigned        False
KeyVaultCertPfxFile             Not specified
KeyVaultCertPfxPassword         Not specified
KeyVaultClientId                
BuildOutputFile                 
ContainerEventLogFile           
TestResultsFile                 C:\AL\ALPipeline\TestResults.xml
BcptTestResultsFile             C:\AL\ALPipeline\bcptTestResults.json
TestResultsFormat               JUnit
AdditionalCountries             
PackagesFolder                  C:\AL\ALPipeline\.packages
OutputFolder                    C:\AL\ALPipeline\.output
BuildArtifactFolder             
CreateRuntimePackages           False
AppVersion                      
AppBuild                        0
AppRevision                     0
SourceRepositoryUrl             
SourceCommit                    
BuildBy                         BcContainerHelper,5.0.5
BuildUrl                        
Install Apps
- None
Install Test Apps
- None
Previous Apps
- None
Application folders
- None
Test application folders
- None
BCPT Test application folders
- None
BCPT Test suites
- None
Custom CodeCops
- None

  _____       _ _ _                                          _        _                            
 |  __ \     | | (_)                                        (_)      (_)                           
 | |__) |   _| | |_ _ __   __ _    __ _  ___ _ __   ___ _ __ _  ___   _ _ __ ___   __ _  __ _  ___ 
 |  ___/ | | | | | | '_ \ / _` |  / _` |/ _ \ '_ \ / _ \ '__| |/ __| | | '_ ` _ \ / _` |/ _` |/ _ \
 | |   | |_| | | | | | | | (_| | | (_| |  __/ | | |  __/ |  | | (__  | | | | | | | (_| | (_| |  __/
 |_|    \__,_|_|_|_|_| |_|\__, |  \__, |\___|_| |_|\___|_|  |_|\___| |_|_| |_| |_|\__,_|\__, |\___|
                           __/ |   __/ |                                                 __/ |     
                          |___/   |___/                                                 |___/      

Pulling mcr.microsoft.com/businesscentral:10.0.20348.1850

Pulling generic image took 2 seconds

   _____                _   _                               _        _                 
  / ____|              | | (_)                             | |      (_)                
 | |     _ __ ___  __ _| |_ _ _ __   __ _    ___ ___  _ __ | |_ __ _ _ _ __   ___ _ __ 
 | |    | '__/ _ \/ _` | __| | '_ \ / _` |  / __/ _ \| '_ \| __/ _` | | '_ \ / _ \ '__|
 | |____| | |  __/ (_| | |_| | | | | (_| | | (__ (_) | | | | |_ (_| | | | | |  __/ |   
  \_____|_|  \___|\__,_|\__|_|_| |_|\__, |  \___\___/|_| |_|\__\__,_|_|_| |_|\___|_|   
                                     __/ |                                             
                                    |___/                                              

Creaing docker container
Default parameter Isolation = Process
BcContainerHelper is version 5.0.5
BcContainerHelper is running as administrator
HyperV is Enabled
UsePsSession is True
Host is Microsoft Windows 11 Pro - 10.0.22621.1992
Docker Client Version is 24.0.2
Docker Server Version is 24.0.2
Removing Desktop shortcuts
Fetching all docker images
Fetching all docker volumes
ArtifactUrl and ImageName specified
Image my:sandbox-22.3.58346.59502-w1-mt already exists
Using image my:sandbox-22.3.58346.59502-w1-mt
Creating Container sandbox-latest
Style: sandbox
Multitenant: Yes
Version: 22.3.58346.59502
Platform: 22.0.59472.0
Generic Tag: 1.0.2.14
Container OS Version: 10.0.20348.1850 (ltsc2022)
Host OS Version: 10.0.22621.1992 (22H2)
Using Process isolation
Using locale en-US
Disabling the standard eventlog dump to container log every 2 seconds (use -dumpEventLog to enable)
Additional Parameters:
--volume "C:\AL\ALPipeline:c:\sources"
--env customNavSettings=EnableTaskScheduler=False
Files in C:\ProgramData\BcContainerHelper\Extensions\sandbox-latest\my:
- AdditionalOutput.ps1
- MainLoop.ps1
- SetupVariables.ps1
- updatehosts.ps1
Creating container sandbox-latest from image my:sandbox-22.3.58346.59502-w1-mt
3607c4f39faef10fe7d26c976bfb5dbb579fa777047be4b7d01542206369937e
Waiting for container sandbox-latest to be ready
Initializing...
Setting host.docker.internal to 192.168.1.110 in container hosts file (copy from host hosts file)
Setting gateway.docker.internal to 192.168.1.110 in container hosts file (copy from host hosts file)
Setting kubernetes.docker.internal to 127.0.0.1 in container hosts file (copy from host hosts file)
Setting host.containerhelper.internal to 172.29.192.1 in container hosts file
Starting Container
Hostname is sandbox-latest
PublicDnsName is sandbox-latest
WARNING: DNS resolution not working from within the container.
Using NavUserPassword Authentication
Starting Local SQL Server
Starting Internet Information Server
Creating Self Signed Certificate
Self Signed Certificate Thumbprint D1D0685D6F4BE8B53E4B358D16CA332B412086B2
DNS identity sandbox-latest
Modifying Service Tier Config File with Instance Specific Settings
Modifying Service Tier Config File with settings from environment variable
Setting EnableTaskScheduler to False
Starting Service Tier
Registering event sources
Creating DotNetCore Web Server Instance
Using application pool name: BC
Using default container name: NavWebApplicationContainer
Copy files to WWW root C:\inetpub\wwwroot\BC
Create the application pool BC
Create website: NavWebApplicationContainer without SSL
Update configuration: navsettings.json
Done Configuring Web Client
Enabling Financials User Experience
Dismounting Tenant
Mounting Tenant
Mounting Database for default on server localhost\SQLEXPRESS with AllowAppDatabaseWrite = False
Sync'ing Tenant
Tenant is Operational
Creating http download site
Setting SA Password and enabling SA
Creating kpipic as SQL User and add to sysadmin
Creating SUPER user
Container IP Address: 172.29.201.28
Container Hostname  : sandbox-latest
Container Dns Name  : sandbox-latest
Web Client          : http://sandbox-latest/BC/?tenant=default
Dev. Server         : http://sandbox-latest
Dev. ServerInstance : BC
Dev. Server Tenant  : default
Setting sandbox-latest to 172.29.201.28 in host hosts file
Setting sandbox-latest-default to 172.29.201.28 in host hosts file
Setting sandbox-latest-default to 172.29.201.28 in container hosts file

Files:
http://sandbox-latest:8080/ALLanguage.vsix

Container Total Physical Memory is 31.7Gb
Container Free Physical Memory is 12.5Gb

Initialization took 37 seconds
Ready for connections!
Reading CustomSettings.config from sandbox-latest
Creating Desktop Shortcuts for sandbox-latest
Cleanup old dotnet core assemblies
Container sandbox-latest successfully created

Use:
Get-BcContainerEventLog -containerName sandbox-latest to retrieve a snapshot of the event log from the container
Get-BcContainerDebugInfo -containerName sandbox-latest to get debug information about the container
Enter-BcContainer -containerName sandbox-latest to open a PowerShell prompt inside the container
Remove-BcContainer -containerName sandbox-latest to remove the container again
docker logs sandbox-latest to retrieve information about URL's again

Creating container took 47 seconds

 _____                _       _                   _                           _                 _          
|  __ \              | |     (_)                 | |                         | |               (_)         
| |__) |___ ___  ___ | |_   ___ _ __   __ _    __| | ___ _ __   ___ _ __   __| | ___ _ __   ___ _  ___ ___ 
|  _  // _ \ __|/ _ \| \ \ / / | '_ \ / _` |  / _` |/ _ \ '_ \ / _ \ '_ \ / _` |/ _ \ '_ \ / __| |/ _ \ __|
| | \ \  __\__ \ (_) | |\ V /| | | | | (_| | | (_| |  __/ |_) |  __/ | | | (_| |  __/ | | | (__| |  __\__ \
|_|  \_\___|___/\___/|_| \_/ |_|_| |_|\__, |  \__,_|\___| .__/ \___|_| |_|\__,_|\___|_| |_|\___|_|\___|___/
                                       __/ |            | |                                                
                                      |___/             |_|                                                

Sorted App folders
External dependencies
- None
Sorted TestApp folders
- None
  _____                           _                               _        _                 
 |  __ \                         (_)                             | |      (_)                
 | |__) |___ _ __ ___   _____   ___ _ __   __ _    ___ ___  _ __ | |_ __ _ _ _ __   ___ _ __ 
 |  _  // _ \ '_ ` _ \ / _ \ \ / / | '_ \ / _` |  / __/ _ \| '_ \| __/ _` | | '_ \ / _ \ '__|
 | | \ \  __/ | | | | | (_) \ V /| | | | | (_| | | (_| (_) | | | | || (_| | | | | |  __/ |   
 |_|  \_\___|_| |_| |_|\___/ \_/ |_|_| |_|\__, |  \___\___/|_| |_|\__\__,_|_|_| |_|\___|_|   
                                           __/ |                                             
                                          |___/                                              
Removing Session sandbox-latest
Removing container sandbox-latest
Removing entries from hosts
Removing sandbox-latest from container hosts file
Removing sandbox-latest-* from container hosts file
Removing Desktop shortcuts
Removing C:\ProgramData\BcContainerHelper\Extensions\sandbox-latest

Removing container took 2 seconds

AL Pipeline finished in 50 seconds

PS C:\Windows\system32> 
...

Screenshots image

AL: GO! app created and compile in VS code is working: image

Am I missing something in Run-AlPipeline command?

Additional context I tried command with CompileAppInBcContainer: Run-AlPipeline -artifact $artifactUrl -baseFolder "C:\AL\ALPipeline" -CompileAppInBcContainer {$True} -containerName sandbox-latest -credential $Credential

but result was the same.

dannoe commented 1 year ago

First line of the log tells you the problem: WARNING: No app folders found You have to specify -appFolders.

Run-AlPipeline -artifact $artifactUrl -baseFolder "C:\AL" -appFolders "ALPipeline" -containerName sandbox-latest -credential $Credential