HodorNV / ALOps

ALOps
59 stars 24 forks source link

Strange behaviour with compiling - can not reproduce #258

Closed dNsl9r closed 3 years ago

dNsl9r commented 3 years ago

Describe the bug We had a pipeline run, that failed with:

##[error]error AL1001: Source file 'c:\Run\DevOps\app.json' could not be found

The step did the following before: Copy from [C:\Agent\_work\68\s] to [c:\Run\DevOps\]

So I checked the folder C:\Agent_work\68\s - it contains the app.json as expected.

After starting a new run for the pipeline the job completed without problems. And now the strange part:

Instead of generating a new "_work\NN" folder the pipeline run took the 68 one. This should not happen,right?

the used yaml please provide the yaml that you used. It helps you put the yaml like this:

....
  - job: CompileJobDE
    dependsOn: PrepareDockerContainerWithDependencies
    condition: succeeded('PrepareDockerContainerWithDependencies')
    steps:
    - checkout: self
      clean: true

    - task: ALOpsAppCompiler@1
      displayName: 'Compile App'
      inputs:
        usedocker: true
        al_analyzer: 'CodeCop'
        nav_app_version: '$(D365BC16-ReleaseNo).*'
        failed_on_warnings: false
        publish_artifact: true  
....

the output Also the complete output is necessary for us to see what is going on. Also use backtics:

2020-11-16T14:49:53.6898683Z ##[section]Starting: Compile App
2020-11-16T14:49:53.7053991Z ==============================================================================
2020-11-16T14:49:53.7054333Z Task         : ALOps App Compiler
2020-11-16T14:49:53.7054618Z Description  : Compile AL Extensions for Business Central
2020-11-16T14:49:53.7054859Z Version      : 1.435.1904
2020-11-16T14:49:53.7055055Z Author       : Hodor
2020-11-16T14:49:53.7055339Z Help         : Compile a Business Central extension from AL code.
2020-11-16T14:49:53.7056310Z ==============================================================================
2020-11-16T14:49:56.9683545Z *** Validate configuration
2020-11-16T14:49:58.3873666Z *** Task Inputs:
2020-11-16T14:49:58.3912034Z 
2020-11-16T14:49:58.3999027Z name                  defaultValue required                        value
2020-11-16T14:49:58.4001841Z ----                  ------------ --------                        -----
2020-11-16T14:49:58.4003862Z usedocker                    False    False                         True
2020-11-16T14:49:58.4005748Z fixed_tag                             False                             
2020-11-16T14:49:58.4008050Z targetproject           ./app.json    False C:\Agent\_work\68\s\app.json
2020-11-16T14:49:58.4010195Z nav_computername                       True                             
2020-11-16T14:49:58.4012314Z nav_serverinstance           BC140     True                        BC140
2020-11-16T14:49:58.4014461Z nav_tenant                 default     True                      default
2020-11-16T14:49:58.4016568Z nav_ports_dev                 7049     True                         7049
2020-11-16T14:49:58.4020022Z bc_username                           False                             
2020-11-16T14:49:58.4021791Z bc_password                           False                             
2020-11-16T14:49:58.4023622Z al_compiler_version     0.12.15355     True                   0.12.15355
2020-11-16T14:49:58.4025964Z al_analyzer                           False                      CodeCop
2020-11-16T14:49:58.4027968Z nav_app_version            1.0.*.0     True                     16.3.0.*
2020-11-16T14:49:58.4030051Z vsix_download_path                    False                             
2020-11-16T14:49:58.4032819Z use_ssl                      False    False                        False
2020-11-16T14:49:58.4034439Z download_test_symbols        False    False                        False
2020-11-16T14:49:58.4036785Z usecompression                True    False                         True
2020-11-16T14:49:58.4038763Z publish_artifact              True    False                         True
2020-11-16T14:49:58.4040494Z failed_on_warnings           False    False                        False
2020-11-16T14:49:58.4042435Z app_file_suffix                       False                             
2020-11-16T14:49:58.4044391Z updatebuildnumber             True    False                         True
2020-11-16T14:49:58.4047092Z setup_working_folder         False    False                        False
2020-11-16T14:49:58.4047731Z 
2020-11-16T14:49:58.4080794Z 
2020-11-16T14:49:58.4087306Z 
2020-11-16T14:49:58.4357226Z *** For documentation, please visit   : https://www.alops.be/documentation
2020-11-16T14:49:58.4362810Z 
2020-11-16T14:49:58.8774430Z *** ALOps License:
2020-11-16T14:49:58.8807228Z   * Licensed To: akquinet
2020-11-16T14:49:58.8812541Z 
2020-11-16T14:49:58.8956036Z *** Importing required PS-Functions
2020-11-16T14:50:05.1700882Z *** Initiate Docker Session
2020-11-16T14:50:05.6323324Z *** Set Docker Container ErrorActionPreference = Stop
2020-11-16T14:50:06.7116531Z *** Import NAV/BC Management DLL's
2020-11-16T14:50:06.7122209Z *** Loading assemblies for ServiceTier [BC].
2020-11-16T14:50:07.1065925Z *** Loading assemblies from: [C:\program files\microsoft dynamics nav\170\service]
2020-11-16T14:50:07.1301161Z *** Selected module: [C:\program files\microsoft dynamics nav\170\service\Microsoft.Dynamics.Nav.Apps.Management.dll]
2020-11-16T14:50:07.1316731Z *** Loading module: [C:\program files\microsoft dynamics nav\170\service\Microsoft.Dynamics.Nav.Apps.Management.dll]
2020-11-16T14:50:07.1817578Z *** Selected module: [C:\program files\microsoft dynamics nav\170\service\Microsoft.Dynamics.Nav.Management.dll]
2020-11-16T14:50:07.1918745Z *** Loading module: [C:\program files\microsoft dynamics nav\170\service\Microsoft.Dynamics.Nav.Management.dll]
2020-11-16T14:50:07.4962368Z *** Setting up AL Compiler [ALLanguage]
2020-11-16T14:50:07.7871561Z *** Downloading AL Compiler [ALLanguage]
2020-11-16T14:50:07.8016116Z *** Get Extension from Local-Disk...[C:\Run\ALLanguage.vsix]
2020-11-16T14:50:07.8038086Z *** Resolving Path [C:\Run\ALLanguage.vsix]
2020-11-16T14:50:08.2651309Z *** VSIX Path Resolved: [C:\Run\ALLanguage.vsix]
2020-11-16T14:50:08.2774684Z *** Unpacking Extension to folder...
2020-11-16T14:50:14.7480036Z *** Loading Json Object: [c:\Run\Microsoft.al\al-ALLanguage\extension\package.json]
2020-11-16T14:50:14.7840181Z *** Using AL Compiler [vALLanguage] located [C:\Run\Microsoft.al\al-ALLanguage\extension\bin\alc.exe]
2020-11-16T14:50:14.7847451Z ***
2020-11-16T14:50:14.7861561Z *** Working folder: C:\Agent\_work\68\s
2020-11-16T14:50:14.7873719Z ***
2020-11-16T14:50:14.7886133Z *** Copy Working folder to Docker Container: bc04c601c7f636114e6d56336f87e9cf40a44004492a1ecf2dd868f5f9923633
2020-11-16T14:50:14.7900866Z *** Docker Working Folder: c:\Run\DevOps\
2020-11-16T14:50:14.7915099Z *** Copy from [C:\Agent\_work\68\s] to [c:\Run\DevOps\]
2020-11-16T14:50:14.7975675Z *** Source File setup completed
2020-11-16T14:50:16.0723294Z *** Target Project: \app.json
2020-11-16T14:50:16.1020322Z *** Check for app.json files: c:\Run\DevOps\
2020-11-16T14:50:16.1023011Z *** Retrieving App-Info [\app.json]
2020-11-16T14:50:16.1069920Z ##[warning]Get-NAVInfoStep: Application manifest [c:\Run\DevOps\app.json] not found.
2020-11-16T14:50:16.1080555Z ***
2020-11-16T14:50:16.3916393Z *** Working Direcotry: [c:\Run\DevOps\]
2020-11-16T14:50:16.3947419Z *** Target Project: [\app.json]
2020-11-16T14:50:16.3972700Z *** Project Directory: [c:\Run\DevOps]
2020-11-16T14:50:16.3998356Z *** VSCode Settings: [c:\Run\DevOps\.vscode\settings.json]
2020-11-16T14:50:16.4050344Z *** No VSCode-Settings json found.
2020-11-16T14:50:16.4071009Z ***
2020-11-16T14:50:17.3024846Z *** Resolve Docker Credentials
2020-11-16T14:50:17.3715548Z *** Setup BC Username/Password from Container info
2020-11-16T14:50:17.3716132Z *** Download Symbols
2020-11-16T14:50:18.0210992Z *** Working Dir: c:\Run\DevOps\
2020-11-16T14:50:18.3037837Z *** Loading assemblies from: [C:\program files\microsoft dynamics nav\170\service]
2020-11-16T14:50:19.6766486Z *** PackageCache path created [c:\Run\DevOps\PackageCache]
2020-11-16T14:50:19.6788050Z ***
2020-11-16T14:50:19.7150950Z *** Check for Depency Apps 0
2020-11-16T14:50:20.3868019Z *** Starting AL Compiler...
2020-11-16T14:50:20.3918682Z *** App.Name         = 
2020-11-16T14:50:20.3950935Z *** App.Publisher    = 
2020-11-16T14:50:20.3971548Z *** App.Compiler Path= C:\Run\Microsoft.al\al-ALLanguage\extension\bin\alc.exe
2020-11-16T14:50:20.4137437Z *** Checking for Assemblies in App
2020-11-16T14:50:20.4145106Z *** Add Windows Assembly Path [C:\Windows\assembly]
2020-11-16T14:50:20.4391694Z *** Searching CodeCop: CodeCop
2020-11-16T14:50:20.4651791Z *** Codecop found: C:\Run\Microsoft.al\al-ALLanguage\extension\bin\Analyzers\Microsoft.Dynamics.Nav.CodeCop.dll
2020-11-16T14:50:20.5704041Z ##[command]& C:\Run\Microsoft.al\al-ALLanguage\extension\bin\alc.exe /packagecachepath:"c:\Run\DevOps\PackageCache" /project:"c:\Run\DevOps" /out:"c:\Run\DevOps\__.app" /fullpaths /analyzer:"C:\Run\Microsoft.al\al-ALLanguage\extension\bin\Analyzers\Microsoft.Dynamics.Nav.CodeCop.dll" /assemblyprobingpaths:C:\Windows\assembly
2020-11-16T14:50:28.1837407Z *** AL Compiler Exit Code: 1
2020-11-16T14:50:28.5360014Z *** AL Compiler raw logs: Start
2020-11-16T14:50:28.5465885Z Microsoft (R) AL Compiler version 6.0.5.33503 Copyright (C) Microsoft Corporation. All rights reserved  error AL1001: Source file 'c:\Run\DevOps\app.json' could not be found
2020-11-16T14:50:28.5469952Z *** AL Compiler raw logs: End
2020-11-16T14:50:28.5478830Z *** Start processing compile results.
2020-11-16T14:50:28.5524099Z ##[error]error AL1001: Source file 'c:\Run\DevOps\app.json' could not be found
2020-11-16T14:50:28.5601493Z *** Store compile log to [c:\Run\DevOps\compilelog.txt]
2020-11-16T14:50:28.5623610Z *** Start processing compile results done.
2020-11-16T14:50:28.5651056Z *** Transfer App Artifact from Docker container.
2020-11-16T14:50:29.1559582Z ##[error]Cannot find path 'c:\Run\DevOps\__.app' because it does not exist.
2020-11-16T14:50:29.3144451Z ##[section]Async Command Start: Add Build Tag
2020-11-16T14:50:29.3145269Z Build '1460' has following tags now: AL.Compiler.ALLanguage, BC.Version.17.0.17126.18919, BC.Platform.17.0.17020.18852, bcdecurr-sandbox-17.0.17126.18919-de-10.0.17763.1282-ltsc2019, App.CORE.16.3.0.1458
2020-11-16T14:50:29.3146030Z ##[section]Async Command End: Add Build Tag
2020-11-16T14:50:29.3147566Z ##[section]Async Command Start: Add Build Tag
2020-11-16T14:50:29.3148523Z Build '1460' has following tags now: AL.Analyzer.CodeCop, AL.Compiler.ALLanguage, BC.Version.17.0.17126.18919, BC.Platform.17.0.17020.18852, bcdecurr-sandbox-17.0.17126.18919-de-10.0.17763.1282-ltsc2019, App.DYNAMO CORE.16.3.0.1458
2020-11-16T14:50:29.3149320Z ##[section]Async Command End: Add Build Tag
2020-11-16T14:50:29.3150959Z ##[section]Finishing: Compile App

Expected behavior No error of course..

waldo1001 commented 3 years ago

This is DevOps internal caching that isn't that friendly with Business Central. Sometimes it even happens it takes files from a previous run.

to mitigate this, you could enable a better cleanup like this: Edit your pipeline, and go to triggers image navigate to YAML and then Get Sources image Set it up to clean all build directories image

dNsl9r commented 3 years ago

Thanks @waldo1001 - changed it. I'll be watching them - very well 🤖

dNsl9r commented 3 years ago

btw: as far as I can see this can also be done in the YAML file, right?

https://docs.microsoft.com/en-us/azure/devops/pipelines/process/phases?view=azure-devops&tabs=yaml#workspace