microsoft / AL-Go

The plug-and-play DevOps solution for Business Central app development on GitHub
MIT License
296 stars 125 forks source link

Intermittent error in Deliver step #528

Closed AskeHolst closed 7 months ago

AskeHolst commented 1 year ago

I get the error below in the Deliver step, but when rerunning it delivers correctly. So there is some randomness to it. The error given to the user "Error: StorageContext secret is malformed..." is a red herring, I guess you just catch all errors and assume it was a problem with the StorageContext.

Note the part "Error was: Cannot set percent because PercentComplete cannot be greater than 100. Parameter name: value Actual value was 101."

Not a big issue, we can just rerun if it happens again, more to let you know about a potential bug lurking somewhere, but maybe that is Az.Storage?

Run microsoft/AL-Go-Actions/Deliver@v3.0
Run try { D:\a\_actions\microsoft\AL-Go-Actions\v3.0\Deliver/Deliver.ps1 -actor $ENV:_actor -token $ENV:_token -parentTelemetryScopeJson $ENV:_parentTelemetryScopeJson -projects $ENV:_projects -deliveryTarget $ENV:_deliveryTarget -artifacts $ENV:_artifacts -type $ENV:_type -atypes $ENV:_atypes -goLive ($ENV:_goLive -eq 'Y') } catch { Write-Host "::Error::Unexpected error when running action ($($_.Exception.Message.Replace("`r",'').Replace("`n",' ')))"; exit 1 }
Downloading BcContainerHelper latest version from CDN
BcContainerHelper version 5.0.1
BC.HelperFunctions emits usage statistics telemetry to Microsoft
Artifacts .artifacts
Projects:
[REDACTED1]
[REDACTED2]
Using StorageContext
Project 'Intercompany.Main'
Artifacts:
- [REDACTED1]-main-Apps-1.0.27.6
- [REDACTED1]-main-BuildOutput-1.0.27.6
- [REDACTED1]-main-TestApps-1.0.27.6
- [REDACTED1]-main-TestResults-1.0.27.6
- [REDACTED2]-main-Apps-1.0.27.6
- [REDACTED2]-main-BuildOutput-1.0.27.6
- thisbuild-[REDACTED1]-Apps
- thisbuild-[REDACTED1]-TestApps
- thisbuild-[REDACTED1]-Apps
Azure.Storage Module is available in version 2.1.0
Using Azure.Storage version 2.1.0
Json OK
WARNING: Microsoft Azure PowerShell collects data about how users use PowerShell cmdlets and some problems they 
encounter.  Microsoft uses this information to improve our PowerShell cmdlets.  Participation is voluntary and when you
 choose to participate your device automatically sends information to Microsoft about how you use Azure PowerShell. 

If you choose to participate, you can stop at any time by using Azure PowerShell as follows:

1. Use the Disable-AzureDataCollection cmdlet to turn the feature Off. The cmdlet can be found in the 
AzureResourceManager module

To disable data collection: PS > Disable-AzureDataCollection

If you choose to not participate, you can enable at any time by using Azure PowerShell as follows:

1. Use the Enable-AzureDataCollection cmdlet to turn the feature On. The cmdlet can be found in the 
AzureResourceManager module

To enable data collection: PS > Enable-AzureDataCollection

Select Y to enable data collection [Y/N]:
Error: Deliver action failed. Error: StorageContext secret is malformed. Needs to be formatted as Json, containing StorageAccountName, containerName, blobName and sastoken or storageAccountKey, which points to an existing container in a storage account. Error was: Cannot set percent because PercentComplete cannot be greater than 100. Parameter name: value Actual value was 101. Stacktrace: at <ScriptBlock>, D:\a\_actions\microsoft\AL-Go-Actions\v3.0\Deliver\Deliver.ps1: line 349 at <ScriptBlock>, D:\a\_actions\microsoft\AL-Go-Actions\v3.0\Deliver\Deliver.ps1: line 99 at <ScriptBlock>, D:\a\_temp\70f8a265-2e2b-4cb5-a3e5-db9e0e543a7c.ps1: line 2 at <ScriptBlock>, <No file>: line 1
AL-Go action ran: Deliver Telemetry Correlation Id: ab9b8260-681f-41fd-b05d-6c1c9510c670
Removing BcContainerHelper
Error: Process completed with exit code 1.
freddydk commented 1 year ago

You are right that the error is out of our hands, but I will improve the error message. Also, I will set

$ProgressPreference = "SilentlyContinue"

Which might prevent the error message altogether.

freddydk commented 1 year ago

The "funny" thing is that the function failing is New-AzStorageContext - why in earth would that need a percentage complete indicator????

AskeHolst commented 1 year ago

Yeah, seems it was already found and fixed https://github.com/Azure/azure-powershell/issues/20489 and here https://github.com/Azure/azure-powershell/issues/17743 But if the old buggy version is used, that is of course still a problem.

freddydk commented 1 year ago

In both of these bugs, it is setting the blob that makes the percentage go beyond 100. In your sample, it was creating the context... - but I guess there is similar code behind...