HodorNV / ALOps

ALOps
59 stars 24 forks source link

New build pipeline for a Translation App only not compiling #591

Closed petertijsma closed 1 year ago

petertijsma commented 1 year ago

Hi,

I'm trying to create a new build pipeline (based on an older existing one), but for some reason it doesn't want to compile/create the app because it can't find te project folder

The Compile Step output:

2022-12-13T16:27:51.2950164Z ##[section]Starting: ALOPS - Compile PRD Extension: App
2022-12-13T16:27:51.3125814Z ==============================================================================
2022-12-13T16:27:51.3126140Z Task         : ALOps App Compiler
2022-12-13T16:27:51.3126385Z Description  : Compile AL Extensions for Business Central
2022-12-13T16:27:51.3126638Z Version      : 1.454.3383
2022-12-13T16:27:51.3126813Z Author       : Hodor
2022-12-13T16:27:51.3127078Z Help         : Compile a Business Central extension from AL code.
2022-12-13T16:27:51.3127391Z ==============================================================================
2022-12-13T16:27:52.5539966Z *** Configure AMSI for session: disable (in memory)
2022-12-13T16:27:52.5693504Z 0
2022-12-13T16:27:53.9232297Z *** Validate configuration
2022-12-13T16:27:54.2073285Z *** Task Inputs:
2022-12-13T16:27:54.2125864Z 
2022-12-13T16:27:54.2303545Z name                                                                                                         value
2022-12-13T16:27:54.2306273Z ----                                                                                                         -----
2022-12-13T16:27:54.2308158Z usedocker                                                                                                     True
2022-12-13T16:27:54.2309975Z fixed_tag                                                                                                         
2022-12-13T16:27:54.2311674Z targetproject                                    F:\ADOAgents\Agent2\_work\21\s\CurrentApp\CurrentApp\App\app.json
2022-12-13T16:27:54.2313343Z nav_computername                                                                                                  
2022-12-13T16:27:54.2314939Z nav_serverinstance                                                                                           BC140
2022-12-13T16:27:54.2316508Z nav_tenant                                                                                                 default
2022-12-13T16:27:54.2318083Z nav_ports_dev                                                                                                 7049
2022-12-13T16:27:54.2319662Z bc_username                                                                                                       
2022-12-13T16:27:54.2321226Z bc_password                                                                                                       
2022-12-13T16:27:54.2322793Z al_compiler_version                                                                                     0.12.15355
2022-12-13T16:27:54.2325448Z ruleset                                                                                                           
2022-12-13T16:27:54.2327040Z suppresswarnings                                                                                              KEEP
2022-12-13T16:27:54.2328592Z al_analyzer                                                                                                   none
2022-12-13T16:27:54.2330173Z ignorepragmas                                                                                                     
2022-12-13T16:27:54.2331743Z nav_app_version                                                                                    18.6.[yyyyWW].*
2022-12-13T16:27:54.2333293Z vsix_download_path                                                                                                
2022-12-13T16:27:54.2334859Z use_ssl                                                                                                      False
2022-12-13T16:27:54.2336478Z download_test_symbols                                                                                        False
2022-12-13T16:27:54.2338035Z usecompression                                                                                                True
2022-12-13T16:27:54.2339593Z publish_artifact                                                                                              True
2022-12-13T16:27:54.2342769Z publishxlif                                                                                                  False
2022-12-13T16:27:54.2344624Z failed_on_warnings                                                                                           False
2022-12-13T16:27:54.2346449Z app_file_suffix                                                                                               _APP
2022-12-13T16:27:54.2348046Z updatebuildnumber                                                                                             True
2022-12-13T16:27:54.2349689Z setup_working_folder                                                                                         False
2022-12-13T16:27:54.2351306Z showmycode                                                                                                    Keep
2022-12-13T16:27:54.2352893Z resourceexposurepolicy_allowdebugging                                                                         Keep
2022-12-13T16:27:54.2354558Z resourceexposurepolicy_allowdownloadingsource                                                                 Keep
2022-12-13T16:27:54.2356272Z resourceexposurepolicy_includesourceinsymbolfile                                                              Keep
2022-12-13T16:27:54.2357905Z internalsvisibleto                                                                                            Keep
2022-12-13T16:27:54.2359532Z preprocessorsymbols                                                                                               
2022-12-13T16:27:54.2361115Z applicationinsightskey                                                                                            
2022-12-13T16:27:54.2362675Z printappmanifest                                                                                              True
2022-12-13T16:27:54.2364265Z output_alc_logs                                                                                               True
2022-12-13T16:27:54.2365830Z additionalprobingpaths                                                                                            
2022-12-13T16:27:54.2390008Z 
2022-12-13T16:27:54.2399848Z 
2022-12-13T16:27:54.2407898Z 
2022-12-13T16:27:54.2620269Z *** For documentation, please visit   : https://www.alops.be/documentation
2022-12-13T16:27:54.2835038Z 
2022-12-13T16:27:54.5225100Z *** ALOps License:
2022-12-13T16:27:54.5247868Z   * Licensed To: Optimum Group BV (RepositoryPer5 License)
2022-12-13T16:27:54.5254979Z 
2022-12-13T16:27:54.5381270Z *** Importing required PS-Functions
2022-12-13T16:27:55.1033760Z *** Initiate Docker Session
2022-12-13T16:27:56.5603021Z *** Set Docker Container ErrorActionPreference = Stop
2022-12-13T16:27:57.1155493Z *** Import NAV/BC Management DLL's
2022-12-13T16:27:57.1217508Z *** Loading assemblies for ServiceTier [BC].
2022-12-13T16:27:58.6973444Z *** Loading assemblies from: [C:\program files\microsoft dynamics nav\180\service]
2022-12-13T16:27:58.7080044Z *** Selected module: [C:\program files\microsoft dynamics nav\180\service\Microsoft.Dynamics.Nav.Apps.Management.dll]
2022-12-13T16:27:58.7091010Z *** Loading module: [C:\program files\microsoft dynamics nav\180\service\Microsoft.Dynamics.Nav.Apps.Management.dll]
2022-12-13T16:27:59.4936565Z *** Selected module: [C:\program files\microsoft dynamics nav\180\service\Microsoft.Dynamics.Nav.Management.dll]
2022-12-13T16:27:59.4943787Z *** Loading module: [C:\program files\microsoft dynamics nav\180\service\Microsoft.Dynamics.Nav.Management.dll]
2022-12-13T16:27:59.5193850Z *** BC NCL Management DLL: C:\program files\microsoft dynamics nav\180\service\Microsoft.Dynamics.Nav.Ncl.dll
2022-12-13T16:28:01.0262871Z *** BC Types DLL: C:\program files\microsoft dynamics nav\180\service\Microsoft.Dynamics.Nav.Types.dll
2022-12-13T16:28:01.2290346Z *** Setting up AL Compiler [ALLanguage]
2022-12-13T16:28:01.4084507Z *** Downloading AL Compiler [ALLanguage]
2022-12-13T16:28:01.4176669Z *** Get Extension from Local-Disk...[C:\Run\ALLanguage.vsix]
2022-12-13T16:28:01.4186973Z *** Resolving Path [C:\Run\ALLanguage.vsix]
2022-12-13T16:28:01.4852112Z *** VSIX Path Resolved: [C:\Run\ALLanguage.vsix]
2022-12-13T16:28:01.4882862Z *** Unpacking Extension to folder...
2022-12-13T16:28:06.9524865Z *** Loading Json Object: [c:\Run\Microsoft.al\al-ALLanguage\extension\package.json]
2022-12-13T16:28:06.9764959Z *** Using AL Compiler [vALLanguage] located [C:\Run\Microsoft.al\al-ALLanguage\extension\bin\win32\alc.exe]
2022-12-13T16:28:06.9772395Z ***
2022-12-13T16:28:06.9785804Z *** Working folder: F:\ADOAgents\Agent2\_work\21\s\CurrentApp
2022-12-13T16:28:06.9796591Z ***
2022-12-13T16:28:06.9806935Z *** Copy Working folder to Docker Container: 410992badc9f8ea2cc87294d0e9ccfa1abc10ed9023801a47b27ad57fe12d2cc
2022-12-13T16:28:06.9817581Z *** Docker Working Folder: c:\Run\DevOps\
2022-12-13T16:28:06.9829403Z *** Copy from [F:\ADOAgents\Agent2\_work\21\s\CurrentApp] to [c:\Run\DevOps\]
2022-12-13T16:28:06.9880816Z *** Source File setup completed
2022-12-13T16:28:07.4161160Z *** Target Project: \CurrentApp\App\app.json
2022-12-13T16:28:07.4172261Z *** Check for app.json files: c:\Run\DevOps\
2022-12-13T16:28:07.4318556Z *** Project found:
2022-12-13T16:28:07.4369926Z    - C:\Run\DevOps\App
2022-12-13T16:28:07.4397406Z *** Retrieving App-Info [\CurrentApp\App\app.json]
2022-12-13T16:28:07.4574659Z ##[warning]Get-NAVInfoStep: Application manifest [c:\Run\DevOps\CurrentApp\App\app.json] not found.
2022-12-13T16:28:07.4593428Z ***
2022-12-13T16:28:07.5222127Z *** Working Direcotry: [c:\Run\DevOps\]
2022-12-13T16:28:07.5230285Z *** Target Project: [\CurrentApp\App\app.json]
2022-12-13T16:28:07.5242395Z *** Project Directory: [c:\Run\DevOps\CurrentApp\App]
2022-12-13T16:28:07.5294740Z *** VSCode Settings: [c:\Run\DevOps\CurrentApp\App\.vscode\settings.json]
2022-12-13T16:28:07.5325631Z *** No VSCode-Settings json found.
2022-12-13T16:28:07.5336273Z *** No AL-RuleSet json found.
2022-12-13T16:28:07.5345988Z ***
2022-12-13T16:28:07.7744429Z *** Resolve Docker Credentials
2022-12-13T16:28:07.7812310Z *** Setup BC Username/Password from Container info
2022-12-13T16:28:07.7950523Z *** Download Symbols
2022-12-13T16:28:08.1314886Z *** Working Dir: c:\Run\DevOps\
2022-12-13T16:28:08.3106150Z *** Loading assemblies from: [C:\program files\microsoft dynamics nav\180\service]
2022-12-13T16:28:08.5041091Z *** PackageCache path created [c:\Run\DevOps\PackageCache]
2022-12-13T16:28:08.5042821Z ***
2022-12-13T16:28:08.5107024Z *** AppSourceCop not specified, skipping download previous
2022-12-13T16:28:08.5160461Z *** Check for Depency Apps 0
2022-12-13T16:28:08.9416079Z *** Starting AL Compiler...
2022-12-13T16:28:08.9450336Z *** App.Name         = 
2022-12-13T16:28:08.9472659Z *** App.Publisher    = 
2022-12-13T16:28:08.9481897Z *** App.Compiler Path= C:\Run\Microsoft.al\al-ALLanguage\extension\bin\win32\alc.exe
2022-12-13T16:28:08.9590846Z *** Checking for Assemblies in App
2022-12-13T16:28:08.9660795Z *** Add Windows Assembly Path [C:\Windows\assembly]
2022-12-13T16:28:08.9881812Z *** CodeAnalyzers DISABLED.
2022-12-13T16:28:09.0050365Z *** Detect ALC.EXE Features.
2022-12-13T16:28:09.0051944Z ##[command]& C:\Run\Microsoft.al\al-ALLanguage\extension\bin\win32\alc.exe /?
2022-12-13T16:28:10.5012020Z   * PARALLEL+
2022-12-13T16:28:10.5017821Z   * MAXDEGREEOFPARALLELISM
2022-12-13T16:28:10.5028376Z   * ASSEMBLYPROBINGPATHS
2022-12-13T16:28:10.5068217Z ##[command]& C:\Run\Microsoft.al\al-ALLanguage\extension\bin\win32\alc.exe /packagecachepath:"c:\Run\DevOps\PackageCache" /project:"c:\Run\DevOps\CurrentApp\App" /out:"c:\Run\DevOps\___APP.app" /fullpaths /parallel+ /maxDegreeOfParallelism:2 /assemblyprobingpaths:"C:\Windows\assembly","C:\Windows\Microsoft.NET\assembly","C:\program files\microsoft dynamics nav\180\service"
2022-12-13T16:28:10.7236370Z *** AL Compiler Exit Code: 1
2022-12-13T16:28:10.7256539Z *** Full Compile Log:
2022-12-13T16:28:10.7284956Z Microsoft (R) AL Compiler version 7.5.7.62578 Copyright (C) Microsoft Corporation. All rights reserved  error AL1018: Directory 'c:\Run\DevOps\CurrentApp\App' could not be found error AL1001: Source file 'c:\Run\DevOps\CurrentApp\App\app.json' could not be found
2022-12-13T16:28:10.7292873Z 
2022-12-13T16:28:10.7529221Z *** AL Compiler raw logs: Start
2022-12-13T16:28:10.7540126Z Microsoft (R) AL Compiler version 7.5.7.62578
2022-12-13T16:28:10.7552610Z Copyright (C) Microsoft Corporation. All rights reserved
2022-12-13T16:28:10.7563144Z error AL1018: Directory 'c:\Run\DevOps\CurrentApp\App' could not be found
2022-12-13T16:28:10.7574185Z error AL1001: Source file 'c:\Run\DevOps\CurrentApp\App\app.json' could not be found
2022-12-13T16:28:10.7583684Z *** AL Compiler raw logs: End
2022-12-13T16:28:10.7594541Z *** Start processing compile results.
2022-12-13T16:28:10.7628958Z ##[error]error AL1001: Source file 'c:\Run\DevOps\CurrentApp\App\app.json' could not be found
2022-12-13T16:28:10.7639694Z *** Store compile log to [c:\Run\DevOps\compilelog.txt]
2022-12-13T16:28:10.7709110Z *** Start processing compile results done.
2022-12-13T16:28:10.7722270Z *** Transfer App Artifact from Docker container.
2022-12-13T16:28:10.9526458Z ##[error]Cannot find path 'c:\Run\DevOps\___APP.app' because it does not exist.
2022-12-13T16:28:10.9927167Z ##[section]Async Command Start: Add Build Tag
2022-12-13T16:28:10.9927832Z Build '21003' has following tags now: BC.Version.18.6.30510.0, BC.Platform.18.0.30479.0, AL.Compiler.ALLanguage, myimage-onprem-18.6.30510.0-nl-10.0.17763.3650-ltsc2019
2022-12-13T16:28:10.9928333Z ##[section]Async Command End: Add Build Tag
2022-12-13T16:28:10.9929475Z ##[section]Finishing: ALOPS - Compile PRD Extension: App

It states: error AL1018: Directory 'c:\Run\DevOps\CurrentApp\App' could not be found error AL1001: Source file 'c:\Run\DevOps\CurrentApp\App\app.json' could not be found

But when I check the agent itself (and thus the folder that needs to be transferred to the Docker, all seems good:

image

No clue what's wrong.

Just a sidenote: The idea here is to generate a separate small translation app, containing only the xlf file needed for our main app. This way, translations can be added to the production environment (On Premise) easily without disturbing everybody else. Since there is only the xlf file present, no schema updates are necessary, making it very quick and easy to publish.

petertijsma commented 1 year ago

UPDATE: Tried removing one level "CurrentApp" from the directory structure and now it worked. Seems that compile fails if there is only one directory with sources (in this case only "s/CurrentApp/App") Normally i have more subdirectories like "s/ThirdPartyApps/xxxxx" etc.

Still, I think this should not influence the compiler

waldo1001 commented 1 year ago

Could it be that your initial setting was wrong?

I see in your output that the targetproject-param is:

F:\ADOAgents\Agent2\_work\21\s\CurrentApp\CurrentApp\App\app.json

Twice "CurrentApp" seems a mistake?

waldo1001 commented 1 year ago

Another tip to investigate:

Perform a Get-ChildItem -Path "c:\Run\DevOps\" -Recurse in a docker exec after the Docker Wait.. .

petertijsma commented 1 year ago

Found the culprit:

Yaml of a build with MULTIPLE resources:

steps:
- checkout: self
  path: s\CurrentApp
  clean: true 
  persistCredentials: true # allow git auth token be used

- checkout: ThirdPartyApps
  path: s\ThirdPartyApps
  clean: true
  persistCredentials: true # allow git auth token be used

Output of "ALOpsDockerWait"

*** Copy Working folder to Docker Container: 8fdd30267a436b879b6e15946ce53f50dc4d5cd469e2b8bd0b4c13ffd1d5a4e1
*** Docker Working Folder: c:\Run\DevOps\
*** Copy from [F:\ADOAgents\Agent1\_work\1\s] to [c:\Run\DevOps\]
*** Compression Enabled Transfer (Dotnet)

Yaml of a build with a SINGLE resource:

steps:
- checkout: self
  path: s\CurrentApp
  clean: true 
  persistCredentials: true # allow git auth token be used

Output of "ALOpsDockerWait"

*** Copy Working folder to Docker Container: c341676886ef4447c9ef17016b68098b78ce233377778bb4f6528bfed0c14380
*** Docker Working Folder: c:\Run\DevOps\
*** Copy from [F:\ADOAgents\Agent1\_work\24\s\CurrentApp] to [c:\Run\DevOps\]
*** Compression Enabled Transfer (Dotnet)

See the difference in the copy action?

Somehow ALOps tries to be smart and limit the number of directory levels if there's only one directory, but this is confusing further down the road :-)

At least good to know now. Will be able to work with it.

(PS, your tip to list the contents of C:\Run\Devops did the trick to find this :-) )

waldo1001 commented 1 year ago

We're working with workingdirectory, which gets messed up when working with multiple checkouts. So if working with multiple checkouts, you'll have to manage it like above.