microsoft / navcontainerhelper

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

Timeout while downloading Artifacts #3555

Closed ronnykwon closed 5 months ago

ronnykwon commented 5 months ago

BCContainerHelper 6.0.17 timeouts when downloading artifacts Trying to download artifacts from both bcinsider and bcartifacts storage. After 5 mns of downloading, the bccontainerhelper would raise an error :

Downloading artifact /sandbox/24.1.18927.20043/fr
Downloading C:\Users\ronny\AppData\Local\Temp\4d47bdec-9358-413c-9456-c5348d593993.zip
Could not download from CDN..., retrying from blob storage in 6 seconds...

Scripts used to create container and cause the issue

$artifact = Get-BCArtifactUrl -storage bcartifacts -type sandbox -version 24.1 -accept_insiderEula -country fr -select latest
Download-Artifacts $artifact

Full output of scripts

PS C:\Windows\System32> Import-module bccontainerhelper
BcContainerHelper version 6.0.17
WinRM service is not running, will not try to use WinRM sessions
BC.HelperFunctions emits usage statistics telemetry to Microsoft
Running on Windows, PowerShell 7.4.2
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.
PS C:\Windows\System32> $artifact = Get-BCArtifactUrl -storage bcartifacts -type sandbox -version 24.1 -accept_insiderEula -country fr -select latest
PS C:\Windows\System32> Download-Artifacts $artifact
Downloading artifact /sandbox/24.1.18927.20043/fr
Downloading C:\Users\ronny\AppData\Local\Temp\4d47bdec-9358-413c-9456-c5348d593993.zip
Could not download from CDN..., retrying from blob storage in 6 seconds...

Additional context

freddydk commented 5 months ago

Could you try to run:

$bcContainerHelperConfig.artifactDownloadTimeout = 0
ronnykwon commented 5 months ago

I have this error

PS C:\Windows\System32> $bcContainerHelperConfig.artifactDownloadTimeout = 0
PS C:\Windows\System32> Download-Artifacts $artifact
Downloading artifact /sandbox/24.1.18927.20043/fr
Downloading C:\Users\ronny\AppData\Local\Temp\7185dd16-8833-49c4-83be-a6a3bbb133e4.zip
Could not download from CDN..., retrying from blob storage in 5 seconds...
Download-Artifacts Telemetry Correlation Id: c2e39fcd-85c0-45a6-96fd-97d9f72e99ae
Exception: C:\Users\ronny\OneDrive\Documents\PowerShell\Modules\bccontainerhelper\6.0.17\Common\Download-File.ps1:95
Line |
  95 |                  throw (GetExtendedErrorMessage $_)
     |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Exception setting "Timeout": "value ('00:00:00') must be greater than '00:00:00'. (Parameter 'value') Actual value was 00:00:00."
freddydk commented 5 months ago

So, aparently 0 wasn't an option - please try with a high number of seconds then

ronnykwon commented 5 months ago

I have set timeout to 3600 and it could download with far more bandwith and I could download in less than 5 mns

PS C:\Windows\System32> $bcContainerHelperConfig.artifactDownloadTimeout = 3600
PS C:\Windows\System32> Download-Artifacts $artifact
Downloading artifact /sandbox/24.1.18927.20043/fr
Downloading C:\Users\ronny\AppData\Local\Temp\33c2bcb2-a903-4a07-bdc2-34bea5b22beb.zip
Unpacking artifact to tmp folder using 7zip
c:\bcartifacts.cache\sandbox\24.1.18927.20043\fr
PS C:\Windows\System32> Download-Artifacts $artifact -includePlatform
c:\bcartifacts.cache\sandbox\24.1.18927.20043\fr
Downloading platform artifact /sandbox/24.1.18927.20043/platform
Downloading C:\Users\ronny\AppData\Local\Temp\84545643-c5f2-4507-b402-02f946ae6768.zip
Unpacking artifact to tmp folder using 7zip
Downloading Prerequisite Components
Downloading c:\bcartifacts.cache\sandbox\24.1.18927.20043\platform\Prerequisite Components\IIS URL Rewrite Module\rewrite_2.0_rtw_x64.msi
Downloading c:\bcartifacts.cache\sandbox\24.1.18927.20043\platform\Prerequisite Components\DotNetCore\DotNetCore.1.0.4_1.1.1-WindowsHosting.exe
c:\bcartifacts.cache\sandbox\24.1.18927.20043\platform

image

If that's a workaround, it would work on my PC but if it's not a system wide configuration, it won't work on my self hosted github runner, will it ?

freddydk commented 5 months ago

The artifactDownloadTimeout is default 300 seconds - but I will increase that to 600 seconds. If your runners are slower than this, you would need to add this setting to bccontainerhelper.settings.json on your runners (or specify it in al-go repo settings if running AL-Go for GitHub)

freddydk commented 5 months ago

in .github/AL-Go-Settings.json you can specify settings for BcContainerHelper directly.

ronnykwon commented 5 months ago

So I added the config in the AL-GO-Settings.json but It's skipped during the build phase :

Import from C:\ProgramData\BcContainerHelper\6.0.17\BcContainerHelper\BcContainerHelper.ps1
BcContainerHelper version 6.0.17
Ignoring config setting artifactDownloadTimeout as the type in the config file is different than in the default configuration
Ignoring config setting defaultDownloadTimeout as the type in the config file is different than in the default configuration
BC.HelperFunctions emits usage statistics telemetry to Microsoft
Running on Windows, PowerShell 7.4.2
use settings and secrets
Analyzing repository
  Checking type
  Checking appFolders, testFolders and bcptTestFolders
  Application Dependency 24.0.0.0
  Checking artifact setting for project
  Downloading artifacts from https://bcartifacts-exdbf9fwegejdqak.b02.azurefd.net/sandbox/24.0.16410.20025/fr
  Downloading platform artifact /sandbox/24.0.16410.20025/platform
  Downloading C:\Users\Administrateur\AppData\Local\Temp\66f7a408-59c8-45d4-8f1e-652ee873[68](https://github.com/CapsetPF/Capset_AL_Framework/actions/runs/9260111950/job/25473310589#step:8:70)ae.zip
  Could not download from CDN..., retrying from blob storage in 2 seconds...
freddydk commented 5 months ago

That is actually a new bug caused by a type difference in PowerShell 7 Only thing you can do right now is to run PowerShell 5.1 I will fix the issue in ContainerHelper asap

freddydk commented 5 months ago

Fixed in 6.0.18