microsoft / navcontainerhelper

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

Removing session sometimes hangs #2836

Closed PaulFurlet closed 1 year ago

PaulFurlet commented 1 year ago

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

Describe the issue I have an agent, that is creating container, compiles app and removes container. The process is successfully passing through all points but sometimes hangs on the last stage of Removing Session. That happened once even when I did try to remove container manually on other VPC. That time I did not pay attention to it. In this example I cancelled pipeline run after 54min of waiting

Scripts used to create container and cause the issue

param (
    [String[]]$versions,
    [String]$type = "sandbox",
    [String]$country = "w1",
    [String]$ArtifactFolder = "c:\Agent\_work\1\a\",
    [String]$runtimeRequired,
    [String[]]$validationRequiredFor,
    [String[]]$preprocessorSymbols
)

Import-Module BCContainerHelper

#likely will be changed:
$licenseFile = "C:\Dev\DevLicense.flf"
$pfxFile = "c:\Dev\DigiCertCode-Sign.pfx"
#$certpass = ConvertTo-SecureString (Get-Content -Path 'c:\Dev\certp.txt') -AsPlainText -Force
$certpass = Get-Content -Path 'c:\Dev\certp.txt'

$releasePackagesFolder = "c:\Dev\Releases\"
$releaseRuntimePackagesFolder = "c:\Dev\Releases\Runtime"
if (-not(Test-Path $releasePackagesFolder)) {
    New-Item -Path $releasePackagesFolder -ItemType Directory -Force
}
if (-not(Test-Path $releaseRuntimePackagesFolder)) {
    New-Item -Path $releaseRuntimePackagesFolder -ItemType Directory -Force
}
$pipelineRoot = Join-Path $PSScriptRoot "..\"
$credential = New-Object pscredential "Admin", (ConvertTo-SecureString -String "Pas$w0rd" -AsPlainText -Force)
$appJson = Get-Content (Join-Path $pipelineRoot "app.json") | ConvertFrom-Json
$appName = $appJson.name
$appFileNameWOExt = $appJson.publisher + "_" + $appName + "_" + $appJson.version
$hoststring = "https://bcartifacts.azureedge.net/" + $type + "/"

#remove all possibly left after previous unsuccessful run
foreach ($contname in (docker ps --format "{{.Names}}")) {
    Remove-BcContainer $contname
}

foreach ($version in $versions) {
    #common
    $containerName = "bc" + $version.Replace(".","") + $type
    $projectPath = "c:\ProgramData\BcContainerHelper\Extensions\" + $containerName + "\my\Project\"
    $alpackagePath = $projectPath + ".AlPackages\"
    $resultPath = $projectPath + ".result\"

    $artifactUrl = Get-BCArtifactUrl -version $version -select "Latest" -country $country -type $type
    if ($artifactUrl -ne $null) { 
        $fullVersion = $artifactUrl.Substring($hoststring.Length,$artifactUrl.LastIndexOf("/") - $hoststring.Length)
        $majorVersion = $fullVersion.Substring(0,$fullVersion.IndexOf("."))
        $cuVersion = $fullVersion.Substring($fullVersion.IndexOf(".")+1,($fullVersion.Substring($fullVersion.IndexOf(".")+1)).IndexOf("."))

        if ($preprocessorSymbols -ne "") { #expecting ForOnPremPreprocessor as minimum
            $preprocList = @()
            for ($majInt = [int]$majorVersion ; $majInt -le 20; $majInt++) {
                $MinToInt = 7
                $MinFromInt = 0
                if ($majInt -eq [int]$majorVersion) {
                    $MinFromInt = [int]$cuVersion + 1
                }
                for ($minInt = $MinFromInt; $minInt -le $MinToInt; $minInt++) {
                    $cu = ""
                    if ($minInt -le 9) {
                        $cu = "0"
                    }
                    $cu += $minInt
                    $preprocList += "ForBeforeBC" + $majInt + $cu + "Preprocessor"
                }
            }
            foreach ($preproc in $preprocessorSymbols) {
                $preprocList += $preproc
            }
            $appjson.preprocessorSymbols = $preprocList

            if ($majorVersion -eq "18") {
                $oldvalue = $appjson.applicationInsightsKey
                if ($oldvalue -ne $null) {
                } else {
                    $oldvalue = $appjson.applicationInsightsConnectionString
                    if ($oldvalue -ne "") {
                        $newvalue = $oldvalue.Split(";")[0]
                        $newvalue = $newvalue.Split("=")[1]
                        $appjson.PSObject.Properties.Remove("applicationInsightsConnectionString")
                        $appjson | Add-Member -Type NoteProperty -Name "applicationInsightsKey" -Value $newvalue
                    }
                }
            }
            if ($majorVersion -ge "19") {
                $oldvalue = $appjson.showMyCode
                if ($oldvalue -ne $null) {
                    $appjson.PSObject.Properties.Remove("showMyCode")
                    $appjson | Add-Member -Type NoteProperty "resourceExposurePolicy" -Value (@{ "allowDebugging"=$true; "allowDownloadingSource"=$false; "includeSourceInSymbolFile"=$true } | ConvertTo-Json)
                }
                $appjson.runtime = "8.0"
            }
            $appjson | ConvertTo-Json -depth 32 | set-content (Join-Path $pipelineRoot "app.json")
        }

        if ([int]$cuVersion -le 9) {
            $cuVersion = "0" + $cuVersion
        }
        if ($type -ne "sandbox") {
            $appFileName = $appFileNameWOExt + "_BC" + $majorVersion + "." + $cuVersion + ".app"
        } else {
            $appFileName = $appFileNameWOExt + ".app"
        }
        $resultFileName = $resultPath + $appFileName
        $cachepath = "c:\bcartifacts.cache\" + $type
        $appspath = $cachepath + "\" + $fullVersion + "\platform\Applications\"

        $runtimeSuffix = "_BC" + $majorVersion + "." + $cuVersion + "_Runtime"
        $runtimeAppFileName = $appFileNameWOExt + $runtimeSuffix + ".app"
        $runtimeAppFullName = $resultPath + $runtimeAppFileName 

        Write-Host "##[group]***** BC"$majorVersion"."$cuVersion
        Write-Host "##[section]settings:"
        Write-Host "##[command] >pipelineRoot =" $pipelineRoot
        Write-Host "##[command] >appFileNameWOExt =" $appFileNameWOExt
        Write-Host "##[command] >runtimeAppFullName =" $runtimeAppFullName
        Write-Host "##[command] >projectPath =" $projectPath
        Write-Host "##[command] >artifactUrl =" $artifactUrl
        Write-Host "##[command] >ArtifactFolder =" $ArtifactFolder
        Write-Host "##[command] >PreprocessorSymbols =" $preprocList
        Write-Host "##[section]removing container" $containerName
        Remove-BCContainer $containerName

        Write-Host -ForegroundColor Green "##[section]creating container" $containerName
        New-BcContainer -accept_eula:$true `
                        -containername $containerName `
                        -artifactUrl $artifactUrl `
                        -auth "UserPassword" `
                        -Credential $credential `
                        -usessl:$false `
                        -updateHosts:$false `
                        -licenseFile $licenseFile `
                        -memoryLimit 4G `
                        -assignPremiumPlan:$true

        Write-Host "##[section]copying files for compilation"
        Copy-Item -Path $pipelineRoot -Destination $projectPath -Recurse -Force

        if (-not(Test-Path $alpackagePath)) {
            New-Item -Path $alpackagePath -ItemType Directory -Force
        }
        if (-not(Test-Path $resultPath)) {
            New-Item -Path $resultPath -ItemType Directory -Force
        }

        Write-Host "##[section]preparing packages for compiling..."
        Write-Host "##[command]getting system"
        #Get-BcContainerAppRuntimePackage -containerName $containerName -appName "System" -appFile ($alpackagePath + "System.app")
        Copy-Item -Path ("c:\bcartifacts.cache\" + $type + "\" + $fullVersion + "\platform\ModernDev\program files\Microsoft Dynamics NAV\" + $majorVersion + "0\AL Development Environment\System.app") -Destination ($alpackagePath + "System.app")
        Write-Host "##[command]getting base app"
        #Get-BcContainerAppRuntimePackage -containerName $containerName -appName "Base Application" -appFile ($alpackagePath + "BaseApp.app")
        Copy-Item -Path ($appspath + "BaseApp\Source\Microsoft_Base Application.app") -Destination ($alpackagePath + "BaseApp.app")
        Write-Host "##[command]getting app"
        #Get-BcContainerAppRuntimePackage -containerName $containerName -appName "Application" -appFile ($alpackagePath + "App.app")
        Copy-Item -Path ($appspath + "Application\Source\Microsoft_Application.app") -Destination ($alpackagePath + "App.app")
        Write-Host "##[command]getting system app"
        #Get-BcContainerAppRuntimePackage -containerName $containerName -appName "System Application" -appFile ($alpackagePath + "SystemApp.app")
        Copy-Item -Path ($appspath + "system application\source\Microsoft_System Application.app") -Destination ($alpackagePath + "SystemApp.app")
        Write-Host "##[section]compiling"
        Compile-AppInBcContainer -containerName $containerName -appProjectFolder $projectPath -appOutputFolder $resultPath -appSymbolsFolder $alpackagePath -appName $appFileName -credential $credential
        Write-Host "##[section]signing"
        & "C:\Program Files (x86)\Windows Kits\10\App Certification Kit\SignTool.exe" sign /fd SHA256 /f $pfxFile /p $certpass /t "http://timestamp.digicert.com" $resultFileName

        #Sign-BcContainerApp -containerName $containerName `
        #                    -appFile $resultFileName `
        #                    -pfxFile $pfxFile `
        #                    -pfxPassword $certpass `
        #                    -timeStampServer "http://timestamp.digicert.com"

        if ($runtimeRequired -eq "true") {
            Write-Host -ForegroundColor Green "##[section]preparing runtime package..."
            Publish-BcContainerApp -containerName $containerName -appFile $resultFileName -credential $credential -sync -syncMode ForceSync
            Install-BcContainerApp -containerName $containerName -appName $appName
            Get-BcContainerAppRuntimePackage -containerName $containerName -appName $appName -appFile $runtimeAppFullName
            Write-Host -ForegroundColor Green "##[section]signing runtime"
            & "C:\Program Files (x86)\Windows Kits\10\App Certification Kit\SignTool.exe" sign /fd SHA256 /f $pfxFile /p $certpass /t "http://timestamp.digicert.com" $runtimeAppFullName

            #Sign-BcContainerApp -containerName $containerName `
            #                    -appFile $runtimeAppFullName `
            #                    -pfxFile $pfxFile `
            #                    -pfxPassword $certpass `
            #                    -timeStampServer "http://timestamp.digicert.com"
        }

        Write-Host "##[section]copying files to Artifacts folder..."
        Copy-Item -Path $resultFileName -Destination (Join-Path $ArtifactFolder $appFileName) -Force
        Copy-Item -Path $resultFileName -Destination (Join-Path $releasePackagesFolder $appFileName) -Force
        if ($runtimeRequired -eq "true") {
            Copy-Item -Path $runtimeAppFullName -Destination (Join-Path $ArtifactFolder $runtimeAppFileName) -Force
            Copy-Item -Path $runtimeAppFullName -Destination (Join-Path $releaseRuntimePackagesFolder $runtimeAppFileName) -Force
        }

        Write-Host "##[section]removing container" $containerName
        Remove-BCContainer $containerName
    }
    Write-Host '##[endgroup]'
}

if (Test-Path (Join-Path $pipelineRoot "AppSourceCop.json")) {
    Write-Host '##[group]Validation'
    $appSourceJson = Get-Content (Join-Path $pipelineRoot "AppSourceCop.json") | ConvertFrom-Json
    $oldVersion = $appSourceJson.version
    $oldAppFileName = $appJson.publisher + "_" + $appName + "_" + $oldVersion + ".app"
    Write-Host "##[section]validating" $appName "against version" $oldVersion

    if ($validationRequiredFor -ne $null) {
        Run-AlValidation `
            -apps (Join-Path $releasePackagesFolder $appFileName) `
            -previousApps (Join-Path $releasePackagesFolder $oldAppFileName) `
            -affixes $appSourceJson.mandatoryPrefix `
            -countries $validationRequiredFor `
            -validateCurrent true `
            -failOnError true
    }
    Write-Host "##[section]removing redundand cache files for Sandbox"
    Get-ChildItem -Path $cachepath -Directory | Select-Object -SkipLast 1 | Remove-Item -Force -Recurse
    Write-Host '##[endgroup]'
}

Used parameters -versions ("20.4") -type "onprem" -country "w1" -ArtifactFolder "$(Build.ArtifactStagingDirectory)" -runtimeRequired "true" -validationRequiredFor ("") -preprocessorSymbols ("ForOnPremAppPreprocessor")

Full output of scripts

Starting: PowerShell Script
==============================================================================
Task         : PowerShell
Description  : Run a PowerShell script on Linux, macOS, or Windows
Version      : 2.212.0
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/powershell
==============================================================================
Generating script.
Formatted command: . 'C:\agent\_work\29\s\Scripts\Compile.ps1' -versions ("20.4") -type "onprem" -country "w1" -ArtifactFolder "C:\agent\_work\29\a" -runtimeRequired "true" -validationRequiredFor ("") -preprocessorSymbols ("ForOnPremAppPreprocessor")
========================== Starting Command Output ===========================
"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'C:\agent\_work\_temp\1cd90de7-4bb4-4f1e-9a94-4c3362aa8679.ps1'"
BcContainerHelper version 4.0.7
BcContainerHelper emits usage statistics telemetry to Microsoft
WARNING: The names of some imported commands from the module 'BCContainerHelper' include unapproved verbs that might 
make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the 
Verbose parameter. For a list of approved verbs, type Get-Verb.
***** BC 20.04
settings:
2022-12-23T17:21:25.1177633Z ##[section]Starting: PowerShell Script
2022-12-23T17:21:25.1393663Z ==============================================================================
2022-12-23T17:21:25.1394003Z Task         : PowerShell
2022-12-23T17:21:25.1394238Z Description  : Run a PowerShell script on Linux, macOS, or Windows
2022-12-23T17:21:25.1394479Z Version      : 2.212.0
2022-12-23T17:21:25.1394658Z Author       : Microsoft Corporation
2022-12-23T17:21:25.1394935Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/powershell
2022-12-23T17:21:25.1395278Z ==============================================================================
2022-12-23T17:21:26.1983226Z Generating script.
2022-12-23T17:21:26.2035544Z Formatted command: . 'C:\agent\_work\29\s\Scripts\Compile.ps1' -versions ("20.4") -type "onprem" -country "w1" -ArtifactFolder "C:\agent\_work\29\a" -runtimeRequired "true" -validationRequiredFor ("") -preprocessorSymbols ("ForOnPremAppPreprocessor")
2022-12-23T17:21:26.2395721Z ========================== Starting Command Output ===========================
2022-12-23T17:21:26.2625068Z ##[command]"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'C:\agent\_work\_temp\1cd90de7-4bb4-4f1e-9a94-4c3362aa8679.ps1'"
2022-12-23T17:21:26.7567598Z BcContainerHelper version 4.0.7
2022-12-23T17:21:26.9427798Z BcContainerHelper emits usage statistics telemetry to Microsoft
2022-12-23T17:21:31.1631151Z WARNING: The names of some imported commands from the module 'BCContainerHelper' include unapproved verbs that might 
2022-12-23T17:21:31.1685990Z make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the 
2022-12-23T17:21:31.1687775Z Verbose parameter. For a list of approved verbs, type Get-Verb.
2022-12-23T17:21:32.5526771Z ##[group]***** BC 20.04
2022-12-23T17:21:32.5578264Z ##[section]settings:
2022-12-23T17:21:32.5589635Z ##[command] >pipelineRoot = C:\agent\_work\29\s\Scripts\..\
2022-12-23T17:21:32.5600177Z ##[command] >appFileNameWOExt = MyCompany_MyApplication_4.1.1.0
2022-12-23T17:21:32.5604756Z ##[command] >runtimeAppFullName = c:\ProgramData\BcContainerHelper\Extensions\bc204onprem\my\Project\.result\MyCompany_MyApplication_4.1.1.0_BC20.04_Runtime.app
2022-12-23T17:21:32.5614181Z ##[command] >projectPath = c:\ProgramData\BcContainerHelper\Extensions\bc204onprem\my\Project\
2022-12-23T17:21:32.5618176Z ##[command] >artifactUrl = https://bcartifacts.azureedge.net/onprem/20.4.44313.44365/w1
2022-12-23T17:21:32.5627580Z ##[command] >ArtifactFolder = C:\agent\_work\29\a
2022-12-23T17:21:32.5631479Z ##[command] >PreprocessorSymbols = ForBeforeBC2005Preprocessor ForBeforeBC2006Preprocessor ForBeforeBC2007Preprocessor ForOnPremAppPreprocessor
2022-12-23T17:21:32.5675314Z ##[section]removing container bc204onprem
2022-12-23T17:21:32.9946327Z Removing Desktop shortcuts
2022-12-23T17:21:33.4457532Z ##[section]creating container bc204onprem
2022-12-23T17:21:33.9858072Z BcContainerHelper is version 4.0.7
2022-12-23T17:21:33.9866858Z BcContainerHelper is running as administrator
2022-12-23T17:21:34.8515883Z Hyper-V is Enabled
2022-12-23T17:21:34.8544509Z UsePsSession is True
2022-12-23T17:21:34.8566322Z Host is Microsoft Windows Server 2022 Datacenter Azure Edition - ltsc2022
2022-12-23T17:21:35.0284948Z Docker Client Version is 20.10.14
2022-12-23T17:21:35.0296886Z Docker Server Version is 20.10.14
2022-12-23T17:21:35.4484000Z Removing Desktop shortcuts
2022-12-23T17:21:35.9340658Z Fetching all docker images
2022-12-23T17:21:36.0676367Z Fetching all docker volumes
2022-12-23T17:21:36.5022415Z Using image mcr.microsoft.com/businesscentral:10.0.20348.1249
2022-12-23T17:21:37.1057836Z Creating Container bc204onprem
2022-12-23T17:21:37.1068807Z Style: onprem
2022-12-23T17:21:37.1077141Z Multitenant: No
2022-12-23T17:21:37.1094850Z Version: 20.4.44313.44365
2022-12-23T17:21:37.1102224Z Platform: 20.0.44266.44359
2022-12-23T17:21:37.1113626Z Generic Tag: 1.0.2.13
2022-12-23T17:21:37.1142256Z Container OS Version: 10.0.20348.1249 (ltsc2022)
2022-12-23T17:21:37.1149800Z Host OS Version: 10.0.20348.1366 (ltsc2022)
2022-12-23T17:21:37.1242275Z Using process isolation
2022-12-23T17:21:37.1317871Z Using locale en-US
2022-12-23T17:21:37.1346780Z Disabling the standard eventlog dump to container log every 2 seconds (use -dumpEventLog to enable)
2022-12-23T17:21:37.1514053Z Using license file C:\Dev\DevLicense.flf
2022-12-23T17:21:37.1972547Z Files in C:\ProgramData\BcContainerHelper\Extensions\bc204onprem\my:
2022-12-23T17:21:37.2013433Z - AdditionalOutput.ps1
2022-12-23T17:21:37.2021454Z - license.flf
2022-12-23T17:21:37.2030790Z - MainLoop.ps1
2022-12-23T17:21:37.2039049Z - SetupNavUsers.ps1
2022-12-23T17:21:37.2047588Z - SetupVariables.ps1
2022-12-23T17:21:37.2055829Z - updatecontainerhosts.ps1
2022-12-23T17:21:37.2064277Z Creating container bc204onprem from image mcr.microsoft.com/businesscentral:10.0.20348.1249
2022-12-23T17:21:37.4304397Z fc86d97a72a5d1983d727cd71a3809b6a15398f3960d92f021a9cd1bca305aaf
2022-12-23T17:21:40.8584238Z Waiting for container bc204onprem to be ready
2022-12-23T17:21:43.2360510Z Using artifactUrl https://bcartifacts.azureedge.net/onprem/20.4.44313.44365/w1
2022-12-23T17:21:43.2361407Z Using installer from C:\Run\150-new
2022-12-23T17:21:43.2439814Z Installing Business Central
2022-12-23T17:21:43.2574831Z Installing from artifacts
2022-12-23T17:21:45.5855669Z Starting Local SQL Server
2022-12-23T17:21:45.5856520Z Starting Internet Information Server
2022-12-23T17:21:45.5857074Z Copying Service Tier Files
2022-12-23T17:21:48.1838184Z c:\dl\onprem\20.4.44313.44365\platform\ServiceTier\Program Files
2022-12-23T17:21:48.1839200Z c:\dl\onprem\20.4.44313.44365\platform\ServiceTier\System64Folder
2022-12-23T17:21:48.1839912Z Copying PowerShell Scripts
2022-12-23T17:21:48.1840557Z c:\dl\onprem\20.4.44313.44365\platform\WindowsPowerShellScripts\Cloud\NAVAdministration
2022-12-23T17:21:48.1841413Z c:\dl\onprem\20.4.44313.44365\platform\WindowsPowerShellScripts\WebSearch
2022-12-23T17:21:48.1842036Z Copying Web Client Files
2022-12-23T17:21:51.3187070Z c:\dl\onprem\20.4.44313.44365\platform\WebClient\Microsoft Dynamics NAV
2022-12-23T17:21:51.3187876Z Copying Client Files
2022-12-23T17:21:51.3190464Z c:\dl\onprem\20.4.44313.44365\platform\LegacyDlls\program files\Microsoft Dynamics NAV
2022-12-23T17:21:51.3191047Z c:\dl\onprem\20.4.44313.44365\platform\LegacyDlls\program files\Microsoft Dynamics NAV
2022-12-23T17:21:52.4962488Z c:\dl\onprem\20.4.44313.44365\platform\LegacyDlls\systemFolder
2022-12-23T17:21:52.4964829Z Copying ModernDev Files
2022-12-23T17:21:52.4965161Z c:\dl\onprem\20.4.44313.44365\platform
2022-12-23T17:21:52.4965553Z c:\dl\onprem\20.4.44313.44365\platform\ModernDev\program files\Microsoft Dynamics NAV
2022-12-23T17:21:52.4965896Z Copying additional files
2022-12-23T17:21:52.4966171Z Copying ConfigurationPackages
2022-12-23T17:21:52.4966488Z C:\dl\onprem\20.4.44313.44365\platform\ConfigurationPackages
2022-12-23T17:21:52.4966856Z Copying Test Assemblies
2022-12-23T17:21:52.4967268Z C:\dl\onprem\20.4.44313.44365\platform\Test Assemblies
2022-12-23T17:21:52.4967611Z Copying Applications
2022-12-23T17:21:56.2847254Z C:\dl\onprem\20.4.44313.44365\platform\Applications
2022-12-23T17:21:56.2848141Z Copying dependencies
2022-12-23T17:22:12.2849494Z Copying ReportBuilder
2022-12-23T17:22:14.6364229Z Importing PowerShell Modules
2022-12-23T17:22:22.8338573Z Restoring CRONUS Demo Database
2022-12-23T17:22:22.8339458Z Setting CompatibilityLevel for CRONUS on localhost\SQLEXPRESS
2022-12-23T17:22:22.8340370Z Modifying Business Central Service Tier Config File for Docker
2022-12-23T17:22:27.4742445Z Creating Business Central Service Tier
2022-12-23T17:22:27.4743034Z Installing SIP crypto provider: 'C:\Windows\System32\NavSip.dll'
2022-12-23T17:24:14.6401585Z Starting Business Central Service Tier
2022-12-23T17:24:14.6402400Z Importing license file
2022-12-23T17:24:15.7993037Z Stopping Business Central Service Tier
2022-12-23T17:24:15.7993755Z Installation took 153 seconds
2022-12-23T17:24:15.7994004Z Installation complete
2022-12-23T17:24:26.3525422Z Initializing...
2022-12-23T17:24:26.3536029Z Setting host.containerhelper.internal to 172.21.176.1 in container hosts file
2022-12-23T17:24:26.3537374Z Starting Container
2022-12-23T17:24:26.3553991Z Hostname is bc204onprem
2022-12-23T17:24:26.3555148Z PublicDnsName is bc204onprem
2022-12-23T17:24:26.3555968Z Using NavUserPassword Authentication
2022-12-23T17:24:26.3556695Z Creating Self Signed Certificate
2022-12-23T17:24:26.3563163Z Self Signed Certificate Thumbprint 47EAF2C924E52FCC619C77B44CE6A9A60ED5E9E1
2022-12-23T17:24:26.3564442Z DNS identity bc204onprem
2022-12-23T17:24:28.7030506Z Modifying Service Tier Config File with Instance Specific Settings
2022-12-23T17:24:46.8433460Z Starting Service Tier
2022-12-23T17:24:46.8435987Z Registering event sources
2022-12-23T17:24:46.8438055Z Creating DotNetCore Web Server Instance
2022-12-23T17:24:46.8439937Z Using application pool name: BC
2022-12-23T17:24:46.8441777Z Using default container name: NavWebApplicationContainer
2022-12-23T17:24:49.7014157Z Copy files to WWW root C:\inetpub\wwwroot\BC
2022-12-23T17:24:49.7377827Z Create the application pool BC
2022-12-23T17:24:54.7643462Z Create website: NavWebApplicationContainer without SSL
2022-12-23T17:24:54.7780488Z Update configuration: navsettings.json
2022-12-23T17:24:54.8023426Z Done Configuring Web Client
2022-12-23T17:24:56.8499433Z Using license file 'c:\run\my\license.flf'
2022-12-23T17:24:56.8500375Z Import License
2022-12-23T17:24:56.8501133Z Creating http download site
2022-12-23T17:24:56.8501691Z Setting SA Password and enabling SA
2022-12-23T17:25:00.4855096Z Creating Admin as SQL User and add to sysadmin
2022-12-23T17:25:11.4687026Z Creating SUPER user
2022-12-23T17:25:12.6240211Z Assign Premium plan for ADMIN
2022-12-23T17:25:12.6241281Z Container IP Address: 172.21.188.139
2022-12-23T17:25:12.6241938Z Container Hostname  : bc204onprem
2022-12-23T17:25:12.6242589Z Container Dns Name  : bc204onprem
2022-12-23T17:25:12.6243043Z Web Client          : http://bc204onprem/BC/
2022-12-23T17:25:12.6243512Z Dev. Server         : http://bc204onprem
2022-12-23T17:25:12.6243943Z Dev. ServerInstance : BC
2022-12-23T17:25:12.6244222Z 
2022-12-23T17:25:12.6244599Z Files:
2022-12-23T17:25:12.6245488Z http://bc204onprem:8080/ALLanguage.vsix
2022-12-23T17:25:12.6245952Z 
2022-12-23T17:25:12.6246395Z Container Total Physical Memory is 7.0Gb
2022-12-23T17:25:12.6246860Z Container Free Physical Memory is 2.2Gb
2022-12-23T17:25:12.6247155Z 
2022-12-23T17:25:12.6247787Z Initialization took 57 seconds
2022-12-23T17:25:13.3597022Z Ready for connections!
2022-12-23T17:25:14.2421882Z Reading CustomSettings.config from bc204onprem
2022-12-23T17:25:14.7296030Z Creating Desktop Shortcuts for bc204onprem
2022-12-23T17:25:14.8787698Z Container bc204onprem successfully created
2022-12-23T17:25:23.7557920Z 
2022-12-23T17:25:23.7572836Z Use:
2022-12-23T17:25:23.7587537Z Get-BcContainerEventLog -containerName bc204onprem to retrieve a snapshot of the event log from the container
2022-12-23T17:25:23.7604123Z Get-BcContainerDebugInfo -containerName bc204onprem to get debug information about the container
2022-12-23T17:25:23.7618414Z Enter-BcContainer -containerName bc204onprem to open a PowerShell prompt inside the container
2022-12-23T17:25:23.7633961Z Remove-BcContainer -containerName bc204onprem to remove the container again
2022-12-23T17:25:23.7647711Z docker logs bc204onprem to retrieve information about URL's again
2022-12-23T17:25:24.5090386Z ##[section]copying files for compilation
2022-12-23T17:25:27.4336465Z 
2022-12-23T17:25:27.4337363Z 
2022-12-23T17:25:27.4339843Z     Directory: C:\ProgramData\BcContainerHelper\Extensions\bc204onprem\my\Project
2022-12-23T17:25:27.4340191Z 
2022-12-23T17:25:27.4340267Z 
2022-12-23T17:25:27.4350657Z Mode                 LastWriteTime         Length Name                                                                 
2022-12-23T17:25:27.4353716Z ----                 -------------         ------ ----                                                                 
2022-12-23T17:25:27.4362745Z d-----        12/23/2022   5:25 PM                .AlPackages                                                          
2022-12-23T17:25:27.4388450Z d-----        12/23/2022   5:25 PM                .result                                                              
2022-12-23T17:25:27.4396792Z ##[section]preparing packages for compiling...
2022-12-23T17:25:27.4404438Z ##[command]getting system
2022-12-23T17:25:27.4524154Z ##[command]getting base app
2022-12-23T17:25:27.4873888Z ##[command]getting app
2022-12-23T17:25:27.5058097Z ##[command]getting system app
2022-12-23T17:25:27.5218005Z ##[section]compiling
2022-12-23T17:25:28.3944115Z Using Symbols Folder: c:\ProgramData\BcContainerHelper\Extensions\bc204onprem\my\Project\.AlPackages\
2022-12-23T17:26:19.3487136Z Compiling...
2022-12-23T17:26:19.3702552Z .\alc.exe /project:"C:\Run\my\Project" /packagecachepath:"C:\Run\my\Project\.AlPackages" /out:"C:\Run\my\Project\.result\MyCompany_MyApplication_4.1.1.0_BC20.04.app" /assemblyprobingpaths:"C:\Program Files (x86)\Microsoft Dynamics NAV\200\RoleTailored Client","C:\Program Files\Microsoft Dynamics NAV\200\Service","C:\Program Files (x86)\Open XML SDK\V2.5\lib","c:\Windows\Microsoft.NET\Assembly","C:\Test Assemblies\Mock Assemblies"
2022-12-23T17:26:29.8539634Z Microsoft (R) AL Compiler version 9.3.10.1758
2022-12-23T17:26:29.8561877Z Copyright (C) Microsoft Corporation. All rights reserved
2022-12-23T17:26:29.8565926Z 
2022-12-23T17:26:29.8575399Z Compilation started for project 'MyApplication' containing '330' files at '17:26:20.554'.
2022-12-23T17:26:29.8579058Z 
2022-12-23T17:26:29.8583879Z 
2022-12-23T17:26:29.8593509Z Compilation ended at '17:26:29.781'.
2022-12-23T17:26:29.8597121Z 
2022-12-23T17:26:29.8673301Z c:\ProgramData\BcContainerHelper\Extensions\bc204onprem\my\Project\.result\MyCompany_MyApplication_4.1.1.0_BC20.04.app successfully created in 62 seconds
2022-12-23T17:26:29.8674734Z c:\ProgramData\BcContainerHelper\Extensions\bc204onprem\my\Project\.result\MyCompany_MyApplication_4.1.1.0_BC20.04.app
2022-12-23T17:26:30.2920707Z ##[section]signing
2022-12-23T17:26:30.3926439Z Done Adding Additional Store
2022-12-23T17:26:30.7100392Z Successfully signed: c:\ProgramData\BcContainerHelper\Extensions\bc204onprem\my\Project\.result\MyCompany_MyApplication_4.1.1.0_BC20.04.app
2022-12-23T17:26:30.7120375Z 
2022-12-23T17:26:30.7181087Z ##[section]preparing runtime package...
2022-12-23T17:26:31.7775709Z Publishing C:\ProgramData\BcContainerHelper\Extensions\bc204onprem\6a0e88f2-8509-476b-b893-7eb73703f609\MyCompany_MyApplication_4.1.1.0_BC20.04.app
2022-12-23T17:26:48.5897360Z Synchronizing MyApplication on tenant default
2022-12-23T17:26:51.3872732Z App MyCompany_MyApplication_4.1.1.0_BC20.04.app successfully published
2022-12-23T17:26:51.8253420Z Installing MyApplication on default
2022-12-23T17:27:16.2944209Z App successfully installed
2022-12-23T17:27:22.9936166Z C:\Run\my\Project\.result\MyCompany_MyApplication_4.1.1.0_BC20.04_Runtime.app
2022-12-23T17:27:23.3574465Z ##[section]signing runtime
2022-12-23T17:27:23.4427208Z Done Adding Additional Store
2022-12-23T17:27:23.7772882Z Successfully signed: c:\ProgramData\BcContainerHelper\Extensions\bc204onprem\my\Project\.result\MyCompany_MyApplication_4.1.1.0_BC20.04_Runtime.app
2022-12-23T17:27:23.7793746Z 
2022-12-23T17:27:23.7847483Z ##[section]copying files to Artifacts folder...
2022-12-23T17:27:23.7999561Z ##[section]removing container bc204onprem
2022-12-23T17:27:24.3810942Z Removing Session bc204onprem
2022-12-23T18:14:40.8836567Z ##[error]The operation was canceled.
2022-12-23T18:14:40.8849950Z ##[section]Finishing: PowerShell Script

Screenshots image

Additional context

freddydk commented 1 year ago

Seems to be a duplicate of #2617, where two workarounds are described towards the end. The real problem is DevOps (and GitHub) agents, but there is a workaround.

PaulFurlet commented 1 year ago

@freddydk thank you for pointing that, for some reason I did not find that thread before.