Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ALOps App Compiler: No app file is created #119

Closed
ThierryPermentier opened this issue Apr 28, 2020 · 12 comments
Closed

ALOps App Compiler: No app file is created #119

ThierryPermentier opened this issue Apr 28, 2020 · 12 comments

Comments

@ThierryPermentier
Copy link

YAML:

- task: Hodor.hodor-alops.alopsdeploytask.ALOpsAppCompiler@1
  displayName: 'ALOps App Compiler'
  inputs:
    usedocker: true
    targetproject: './CMFRT_Base/app.json'
    nav_app_version: 1.0.0.0
    setup_working_folder: true

RESULT:

*** Read App Manifest: [c:\Run\DevOps\PackageCache\Microsoft_System_16.0.11233.12436.app].
***
*** Check for Depency Apps 2
*** Download Application-Symbols for [System Application v1.0.0.0]
*** Downloading NAV Symbols for [System Application v1.0.0.0]
*** Downloading NAV Symbols from [https://231de1f7be21:7049/BC/dev/packages?publisher=Microsoft&appName=System+Application&versionText=1.0.0.0&tenant=default]
*** Downloading NAV Symbols with BasicAuthentication [admin]
Invoke-RestMethod -Method Get -Uri https://231de1f7be21:7049/BC/dev/packages?publisher=Microsoft&appName=System+Application&versionText=1.0.0.0&tenant=default
*** Content-Disposition: attachment; filename="Microsoft_System Application_16.0.11240.12474.app"
*** Saving symbol file [Microsoft_System Application_16.0.11240.12474.app] to [c:\Run\DevOps\PackageCache]
*** Read App Manifest: [c:\Run\DevOps\PackageCache\Microsoft_System Application_16.0.11240.12474.app].
***
*** Download Application-Symbols for [Base Application v15.0.0.0]
*** Downloading NAV Symbols for [Base Application v15.0.0.0]
*** Downloading NAV Symbols from [https://231de1f7be21:7049/BC/dev/packages?publisher=Microsoft&appName=Base+Application&versionText=15.0.0.0&tenant=default]
*** Downloading NAV Symbols with BasicAuthentication [admin]
Invoke-RestMethod -Method Get -Uri https://231de1f7be21:7049/BC/dev/packages?publisher=Microsoft&appName=Base+Application&versionText=15.0.0.0&tenant=default
*** Content-Disposition: attachment; filename="Microsoft_Base Application_16.0.11240.12474.app"
*** Saving symbol file [Microsoft_Base Application_16.0.11240.12474.app] to [c:\Run\DevOps\PackageCache]
*** Read App Manifest: [c:\Run\DevOps\PackageCache\Microsoft_Base Application_16.0.11240.12474.app].
*** Propagated Dependency: Microsoft - System Application - 16.0.0.0
***
*** Download Application-Symbols for [System Application v16.0.0.0]
*** Downloading NAV Symbols for [System Application v16.0.0.0]
*** Downloading NAV Symbols from [https://231de1f7be21:7049/BC/dev/packages?publisher=Microsoft&appName=System+Application&versionText=16.0.0.0&tenant=default]
*** Downloading NAV Symbols with BasicAuthentication [admin]
Invoke-RestMethod -Method Get -Uri https://231de1f7be21:7049/BC/dev/packages?publisher=Microsoft&appName=System+Application&versionText=16.0.0.0&tenant=default
*** Content-Disposition: attachment; filename="Microsoft_System Application_16.0.11240.12474.app"
*** Saving symbol file [Microsoft_System Application_16.0.11240.12474.app] to [c:\Run\DevOps\PackageCache]
*** Read App Manifest: [c:\Run\DevOps\PackageCache\Microsoft_System Application_16.0.11240.12474.app].
***
*** Starting AL Compiler...
*** App.Name         = CMFRT Base
*** App.Publisher    = Astena NV
*** App.Compiler Path= C:\Run\Microsoft.al\al-ALLanguage\extension\bin\alc.exe
*** Checking for Assemblies in App
*** Add Windows Assembly Path [C:\Windows\assembly]
& C:\Run\Microsoft.al\al-ALLanguage\extension\bin\alc.exe /packagecachepath:"c:\Run\DevOps\PackageCache" /project:"c:\Run\DevOps\CMFRT_Base" /out:"c:\Run\DevOps\Astena NV_CMFRT Base_1.0.0.0.app" /fullpaths /assemblyprobingpaths:C:\Windows\assembly
*** AL Compiler Exit Code: -1073741502
*** AL Compiler raw logs: Start

*** AL Compiler raw logs: End
*** Start processing compile results.
*** Compile OK.
*** Start processing compile results done.
*** Transfer App Artifact from Docker container.
##[error]Cannot find path 'c:\Run\DevOps\Astena NV_CMFRT Base_1.0.0.0.app' because it does not exist.
Async Command Start: Add Build Tag
Build '2353' has following tags now: mcr.microsoft.com/businesscentral/sandbox-be-ltsc2016, BC.Platform.16.0.11233.12436, BC.Version.16.0.11240.12474, AL.Compiler.ALLanguage
Async Command End: Add Build Tag
Async Command Start: Update Build Number
Update build number to 1.0.0.0 for build 2353
Async Command End: Update Build Number
Finishing: ALOps App Compiler
Showing 5 filtered items.

No app file is created. We executed the command manually in the container but with the same result. The compiler does not create the app file. Any suggestion?

@AdminHodor
Copy link
Contributor

AdminHodor commented Apr 29, 2020

Dear @ThierryPermentier ,

It seems your ALC.EXE is crashing unexpectedly.

AL Compiler Exit Code: -1073741502

It's not clear why it is crashing, mostly this is related to the Host/Docker image. Could you please specify the exact version of Windows the Vsts Agent is running on? Since the Februari update of Windows there are some know problems with running 32bit applications inside docker which can be solved by changing the Hyper-V Isolation.

We'll also make a hotfix to throw an error on ALC.EXE exceptions, this should break the pipeline on the correct step.

Kind regards,

@ThierryPermentier
Copy link
Author

Hi @AdminHodor,

I think the problem is located in the docker container. With the same image, I could not compile when using a build pipeline using NavContainerHelper. The image I use is mcr.microsoft.com/businesscentral/sandbox:be-ltsc2016. ('Always pull' is enabled), so we're using the latest images on this one. When using the image mcr.microsoft.com/businesscentral/sandbox:15.2.39558.40594-be-ltsc2016 everything is running ok at this point. So mainly, I think the problem is related to the dockers image (but I'm using the latest).

Best regards,

Thierry Permentier

@DanielGoehler
Copy link

Hi, we have the same issue. Is there a way to reproduce what

C:\Run\Microsoft.al\al-ALLanguage\extension\bin\alc.exe /packagecachepath:"c:\Run\DevOps\PackageCache" /project:"c:\Run\DevOps\MainApp" /out:"c:\Run\DevOps\MyCompany_MyApp_1.0.202020.402.app" /fullpaths /ruleset:"c:\Run\DevOps\MainApp.vscode\ruleset.json" /assemblyprobingpaths:C:\Windows\assembly

is doing?

I played a little bit around with Freddys bcsandbox Azure VM and found out that the recent ALC.exe says I should install .NET Framework 4.8.

Screenshot 1

But installing .NET Framework 4.8 + KB4556441 on the Azure DevOps Build Agent itself didn't solves this issue. While doing that I also ran into the issue #40 and removed and reinstalled the Build Agents.

I still ended up with AL Compiler Exit Code: -1073741502.

Where and how will the ALC.exe executed, in the Build Agent or inside the docker images?

Locally executed Build Agents VMs works:
Screenshot 2

Pipeline Output:

##[section]Starting: ALOpsAppCompiler
==============================================================================
Task         : ALOps App Compiler
Description  : Compiles NAV Apps
Version      : 1.429.1405
Author       : Hodor
Help         : Compile a Business Central extension from AL code.
==============================================================================
*** Validate configuration
*** No ALOps License found. Set License with the [alops-licenseid] or [alops_licenseid] variables.
Cleanup old Tasks
*** Importing required PS-Functions
*** Initiate Docker Session
*** Set Docker Container ErrorActionPreference = Stop
*** Import NAV/BC Management DLL's
*** Loading assemblies for ServiceTier [BC].
*** Loadin assemblies from: [C:\program files\microsoft dynamics nav\160\service]
*** Setting up AL Compiler [ALLanguage]
*** Downloading AL Compiler [ALLanguage]
*** Get Extension from Local-Disk...[C:\Run\ALLanguage.vsix]
*** Resolving Path [C:\Run\ALLanguage.vsix]
*** VSIX Path Resolved: [C:\Run\ALLanguage.vsix]
*** Unpacking Extension to folder...
*** Loading Json Object: [c:\Run\Microsoft.al\al-ALLanguage\extension\package.json]
*** Using AL Compiler [vALLanguage] located [C:\Run\Microsoft.al\al-ALLanguage\extension\bin\alc.exe]
***
*** Working folder: C:\agent\_work\1\s
***
*** Copy Working folder to Docker Container: f1f41c68d9b74a3160bdd63456d15670397d438a12e70fa3e56dc02cd45d6dc8
*** Docker Working Folder: c:\Run\DevOps\
*** Copy from [C:\agent\_work\1\s] to [c:\Run\DevOps\]
*** Source File setup completed
*** Target Project: \MainApp\app.json
*** Check for app.json files: c:\Run\DevOps\
*** Project found:
   - C:\Run\DevOps\MainApp
*** Retrieving App-Info [\MainApp\app.json]
*** Loading Json Object: [c:\Run\DevOps\MainApp\app.json]
  * App.ID          = f9f406ba-a7c2-43fb-9534-abe714aafe6d
  * App.Name        = MyApp
  * App.Publisher   = MyCompany
  * App.Version     = 1.0.0.0
  * App.Platform    = 15.0.0.0
  * App.Application = 
***
*** Match: yyyyWW
*** Setting Managed App Version [c:\Run\DevOps\MainApp\app.json] =>  1.0.202020.402
***
*** Working Direcotry: [c:\Run\DevOps\]
*** Target Project: [\MainApp\app.json]
*** Project Directory: [c:\Run\DevOps\MainApp]
*** VSCode Settings: [c:\Run\DevOps\MainApp\.vscode\settings.json]
*** VSCode-Settings json found.
*** Loading Json Object: [c:\Run\DevOps\MainApp\.vscode\settings.json]
*** Using Ruleset: [c:\Run\DevOps\MainApp\.vscode\ruleset.json]
***
*** Resolve Docker Credentials
*** Setup BC Username/Password from Container info
*** Download Symbols
*** Working Dir: c:\Run\DevOps\
*** Loadin assemblies from: [C:\program files\microsoft dynamics nav\160\service]
*** PackageCache path created [c:\Run\DevOps\PackageCache]
***
*** Download System-Symbols for [15.0.0.0]
*** Downloading NAV Symbols for [System v15.0.0.0]
*** Downloading NAV Symbols from [https://f1f41c68d9b7:7049/BC/dev/packages?publisher=Microsoft&appName=System&versionText=15.0.0.0&tenant=default]
*** Downloading NAV Symbols with BasicAuthentication [admin]
##[command]Invoke-RestMethod -Method Get -Uri https://f1f41c68d9b7:7049/BC/dev/packages?publisher=Microsoft&appName=System&versionText=15.0.0.0&tenant=default
*** Content-Disposition: attachment; filename=Microsoft_System_16.0.12630.12758.app
*** Saving symbol file [Microsoft_System_16.0.12630.12758.app] to [c:\Run\DevOps\PackageCache]
*** Read App Manifest: [c:\Run\DevOps\PackageCache\Microsoft_System_16.0.12630.12758.app].
***
*** Check for Depency Apps 0
*** Starting AL Compiler...
*** App.Name         = MyApp
*** App.Publisher    = MyCompany
*** App.Compiler Path= C:\Run\Microsoft.al\al-ALLanguage\extension\bin\alc.exe
*** Checking for Assemblies in App
*** Add Windows Assembly Path [C:\Windows\assembly]
##[command]& C:\Run\Microsoft.al\al-ALLanguage\extension\bin\alc.exe /packagecachepath:"c:\Run\DevOps\PackageCache" /project:"c:\Run\DevOps\MainApp" /out:"c:\Run\DevOps\MyCompany_MyApp_1.0.202020.402.app" /fullpaths /ruleset:"c:\Run\DevOps\MainApp\.vscode\ruleset.json" /assemblyprobingpaths:C:\Windows\assembly
*** AL Compiler Exit Code: -1073741502
*** AL Compiler raw logs: Start

*** AL Compiler raw logs: End
*** Start processing compile results.
*** Compile OK.
*** Start processing compile results done.
*** Transfer App Artifact from Docker container.
##[error]Der Pfad "c:\Run\DevOps\MyCompany_MyApp_1.0.202020.402.app" kann nicht gefunden werden, da er nicht vorhanden ist.
##[section]Async Command Start: Add Build Tag
Build '402' has following tags now: mcr.microsoft.com/businesscentral/onprem-de-ltsc2019, BC.Platform.16.0.12630.12758, BC.Version.16.1.12629.12805, AL.Compiler.ALLanguage
##[section]Async Command End: Add Build Tag
##[section]Async Command Start: Update Build Number
Update build number to 1.0.202020.402 for build 402
##[section]Async Command End: Update Build Number
##[section]Finishing: ALOpsAppCompiler

@DanielGoehler
Copy link

Issue #96, #113, #126 and this seems be this same issue and here is the fix: #126 (comment)

@ThierryPermentier
Copy link
Author

Hi all,

Is there any working solution without using the --isolation=hyper option? As I cannot use it.
A suggestion was that it is related to the image. But what image should we use to be able to compile an extension? I use the latest sandbox:be-lstc2019.

Thanks

@waldo1001
Copy link
Collaborator

Thing is - it's the Docker image from Microsoft that is causing this. Things get complicated when you do have the februari update installed on the DevOps agent.

Official MIcrosoft message: "hyperv-isolution is the only way to make it always work".

So, it's not "just" the image, it's the image in combination with certain windows updates .. . You could be building your own images .. but that way out of our comfort zone.. .

Is there any reason why hyper-v-isolation is not an option?

@ThierryPermentier
Copy link
Author

Waldo,

The main reason that using the hyperv-isolation is not an option for me, is that it generates errors that I cannot fix. Maybe a lack of knowledge perhaps, but I noticed that I'm not the only one having troubles with this and that a lot of issues mentioned on ALOps have the same solution: use the hyperv-isolation.

The image itself could indeed be the cause, but as I was trying to get my app compiled. I wrote a separate build pipeline based on the same image by using inline powershell and make use of NavContainerHelper.

I cannot compare both solutions, but using the same code, using the same docker image and by not using the hyperv option. The app gets compiled without any errors using NavContinaerHelper.

Is there a possibility to get ALOps working without the hyperv option?

Thanks.

@waldo1001
Copy link
Collaborator

waldo1001 commented Jun 14, 2020

Well - first of all - ALOps does work without HyperV isolation.

What you probably do when using navcontainerhelper, is using the "usebestcontaineros" option (am I correct?), which is basically building a completely new docker image based on your Host OS. This is a big detour from the "hyperv" isolation solution - one that we simply can't do within ALOps, since all problems are solved with hyperv isolation anyway (hence your remark that lots of issues with ALops are solved with hyperv isolation) - and it's "just" for a build pipeline anyway.

You are actually the first that I know where this wouldn't fix it - what errors does hyperv-isolation give you that you cannot fix?

Furthermore some background:
especially because of this isolation-mess, Microsoft is moving away from the current way of providing docker-images. They will give us a way to build our own docker-images (already in a decent state of progress). We believe that this will solve any isolation-issue, so I hope it will be released soon.

@ThierryPermentier
Copy link
Author

Waldo,

Thanks for the info. Knowing now that ALOps does not work without the option, I have to find a way for hyperv-isolation can work before I can use ALOps.

Regarding NavContainerHelper, I do not use the option usebestcontaineros as I know. The only arguments I provide are:

New-BCContainer -accept_eula
                -accept_outdated
                -containerName
                -licenseFile
                -auth Windows
                -imageName
                -updateHosts
                -doNotExportObjectsToText
                -memorylimit
                -additionalParameters
                -shortcuts None
                -alwaysPull
                -Credential

The option is maybe used by default behind the scenes , I don't know ...

@ThierryPermentier
Copy link
Author

Waldo,

Concerning the error when using the --isolation=hyperv option ... this is it:

##[error]C:\Program Files\Docker\docker.exe: Error response from daemon: hcsshim::CreateComputeSystem 5c5525fc13565ac227c07a79346128b583335e898e14e77d82b13bf7018c5bdc: De aanvraag wordt niet ondersteund.

Best regards.

@waldo1001
Copy link
Collaborator

That's strange - though, are you building that container on the same machine as you're running the build agent?
I hope the build agent is not on a Windows 10?
Can you share the complete ALOps-yaml that fails?

@ThierryPermentier
Copy link
Author

Containers are created on the same machine as the agent. Running Windows Server 2019.
The YAML file looks like this, nothing fancy I think.


steps:
- task: Hodor.hodor-alops.alopsdockerstart.ALOpsDockerStart@1
  displayName: 'ALOps Docker Start'
  inputs:
    docker_image: 'mcr.microsoft.com/businesscentral/sandbox:be-ltsc2019'
    accept_image_outdated: true
    enable_symbol_loading: true
    memory_gb: 6
    container_restart: always
    docker_parameters: '--isolation=hyperv'

steps:
- task: Hodor.hodor-alops.alopsdockerwait.ALOpsDockerWait@1
  displayName: 'ALOps Docker Wait'
  
steps:
- task: Hodor.hodor-alops.alopslicenseimport.ALOpsLicenseImport@1
  displayName: 'ALOps License Import'
  inputs:
    usedocker: true
    license_path: 'C:\License.flf'
    remove_license_file: false

steps:
- task: Hodor.hodor-alops.alopsdeploytask.ALOpsAppCompiler@1
  displayName: 'ALOps App Compiler'
  inputs:
    usedocker: true
    targetproject: './Base/app.json'
    nav_app_version: 1.0.0.0
    setup_working_folder: true
	
steps:
- task: Hodor.hodor-alops.alopspublishtask.ALOpsAppPublish@1
  displayName: 'ALOps App Publish'
  inputs:
    usedocker: true	

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants