Azure / cli

Automate your GitHub workflows using Azure CLI scripts
MIT License
133 stars 54 forks source link

"Couldn't find a valid ICU package installed on the system." when trying to run a deployment with bicep #165

Open rubenmamo opened 2 months ago

rubenmamo commented 2 months ago

I have the following github workflow

      - name: Login to Azure
        uses: azure/login@v2
        with:
          creds: ${{ secrets.AZURE_CREDENTIALS_PRENV }}

      - name: Create Resource Group
        uses: azure/CLI@v2
        with:
          azcliversion: latest
          inlineScript: |
            az group create --name rg-company-${{ env.target_env }} --location "West Europe"

      - name: Deploy Stage 1
        uses: azure/CLI@v2
        with:
          azcliversion: latest
          inlineScript: |
            az deployment group create --resource-group rg-company-${{ env.target_env }} --template-file ./infra/Stage1/stage-1.bicep --parameters deploymentTag='${{ env.target_env }}'

this was working without issues, however, today I started getting the following error in the Deploy Stage 1 step:

Run azure/CLI@v2
Warning: Unable to fetch all az cli versions, please report it as an issue on https://github.com/Azure/CLI/issues. Output: ***
Starting script execution via docker image mcr.microsoft.com/azure-cli:latest
WARNING: The configuration value of bicep.use_binary_from_path has been set to 'false'.
ERROR: Process terminated. Couldn't find a valid ICU package installed on the system. Please install libicu (or icu-libs) using your package manager and try again. Alternatively you can set the configuration flag System.Globalization.Invariant to true if you want to run with no globalization support. Please see https://aka.ms/dotnet-missing-libicu for more information.
   at System.Environment.FailFast(System.String)
   at System.Globalization.GlobalizationMode+Settings..cctor()
   at System.Globalization.GlobalizationMode+Settings.get_Invariant()
   at System.Globalization.GlobalizationMode.get_Invariant()
   at System.Globalization.CultureData.CreateCultureWithInvariantData()
   at System.Globalization.CultureData.get_Invariant()
   at System.Globalization.CultureInfo..cctor()
   at System.Globalization.CultureInfo.get_InvariantCulture()
   at System.Globalization.NumberFormatInfo.get_InvariantInfo()
   at System.Reflection.AssemblyNameParser.ParseVersion(System.String)
   at System.Reflection.AssemblyNameParser.Parse()
   at System.Reflection.AssemblyNameParser.Parse(System.String)
   at System.Reflection.AssemblyName..ctor(System.String)
   at System.Reflection.TypeNameParser.ResolveAssembly(System.String)
   at System.Reflection.TypeNameParser.GetType(System.String, System.ReadOnlySpan`1<System.String>, System.String)
   at System.Reflection.TypeNameParser+NamespaceTypeName.ResolveType(System.Reflection.TypeNameParser ByRef, System.String)
   at System.Reflection.TypeNameParser.Parse()
   at System.Reflection.TypeNameParser.GetTypeReferencedByCustomAttribute(System.String, System.Reflection.RuntimeModule)
   at System.Reflection.CustomAttributeTypedArgument.ResolveType(System.Reflection.RuntimeModule, System.String)
   at System.Reflection.CustomAttributeTypedArgument..ctor(System.Reflection.RuntimeModule, System.Reflection.CustomAttributeEncodedArgument)
   at System.Reflection.RuntimeCustomAttributeData.get_ConstructorArguments()
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.GetDynamicallyAccessedMemberTypes(System.Type)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.ValidateTrimmingAnnotations(System.Type, System.Type[], System.Type, System.Type[])
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.Populate()
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory..ctor(System.Collections.Generic.ICollection`1<Microsoft.Extensions.DependencyInjection.ServiceDescriptor>)
   at Microsoft.Extensions.DependencyInjection.ServiceProvider..ctor(System.Collections.Generic.ICollection`1<Microsoft.Extensions.DependencyInjection.ServiceDescriptor>, Microsoft.Extensions.DependencyInjection.ServiceProviderOptions)
   at Microsoft.Extensions.DependencyInjection.ServiceCollectionContainerBuilderExtensions.BuildServiceProvider(Microsoft.Extensions.DependencyInjection.IServiceCollection, Microsoft.Extensions.DependencyInjection.ServiceProviderOptions)
   at Microsoft.Extensions.DependencyInjection.ServiceCollectionContainerBuilderExtensions.BuildServiceProvider(Microsoft.Extensions.DependencyInjection.IServiceCollection)
   at Microsoft.Extensions.Logging.LoggerFactory.Create(System.Action`1<Microsoft.Extensions.Logging.ILoggingBuilder>)
   at Bicep.Cli.Program.CreateLoggerFactory(Bicep.Cli.IOContext)
   at Bicep.Cli.Program.ConfigureServices(Bicep.Cli.IOContext)
   at Bicep.Cli.Program..ctor(Bicep.Cli.IOContext, System.Action`1<Microsoft.Extensions.DependencyInjection.IServiceCollection>)
   at Bicep.Cli.Program+<>c__DisplayClass3_0+<<Main>b__0>d.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[Bicep.Cli.Program+<>c__DisplayClass3_0+<<Main>b__0>d, bicep, Version=0.29.0.0, Culture=neutral, PublicKeyToken=null]](<<Main>b__0>d ByRef)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.Int32, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Start[[Bicep.Cli.Program+<>c__DisplayClass3_0+<<Main>b__0>d, bicep, Version=0.29.0.0, Culture=neutral, PublicKeyToken=null]](<<Main>b__0>d ByRef)
   at Bicep.Cli.Program+<>c__DisplayClass3_0.<Main>b__0(System.Threading.CancellationToken)
   at Bicep.Cli.Program+<RunWithCancellationAsync>d__6.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[Bicep.Cli.Program+<RunWithCancellationAsync>d__6, bicep, Version=0.29.0.0, Culture=neutral, PublicKeyToken=null]](<RunWithCancellationAsync>d__6 ByRef)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.Int32, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Start[[Bicep.Cli.Program+<RunWithCancellationAsync>d__6, bicep, Version=0.29.0.0, Culture=neutral, PublicKeyToken=null]](<RunWithCancellationAsync>d__6 ByRef)
   at Bicep.Cli.Program.RunWithCancellationAsync(System.Func`2<System.Threading.CancellationToken,System.Threading.Tasks.Task`1<Int32>>)
   at Bicep.Cli.Program+<Main>d__3.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[Bicep.Cli.Program+<Main>d__3, bicep, Version=0.29.0.0, Culture=neutral, PublicKeyToken=null]](<Main>d__3 ByRef)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.Int32, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Start[[Bicep.Cli.Program+<Main>d__3, bicep, Version=0.29.0.0, Culture=neutral, PublicKeyToken=null]](<Main>d__3 ByRef)
   at Bicep.Cli.Program.Main(System.String[])
   at Bicep.Cli.Program.<Main>(System.String[])
Error: Error: az cli script failed.
cleaning up container...
MICROSOFT_AZURE_CLI_17[253](https://github.com/Witty-Creations/WittyCreations.Web/actions/runs/10681659890/job/29606293790#step:7:254)62060372_CONTAINER
Error: az cli script failed.
rubenmamo commented 2 months ago

When I ran it yesterday I got this output:

Run azure/CLI@v2
Starting script execution via docker image mcr.microsoft.com/azure-cli:latest
WARNING: The configuration value of bicep.use_binary_from_path has been set to 'false'.
WARNING: Azure CLI 2.63.0 is the last version available on Alpine and will not receive updates. Consider migrating to the Azure Linux based image for Azure CLI. For more information: https://go.microsoft.com/fwlink/?linkid=2282203
rubenmamo commented 2 months ago

This seems to be related to https://github.com/Azure/azure-cli/issues/29828

MoChilia commented 2 months ago

Hi @rubenmamo, please temporarily pin azcliversion to 2.63.0. The image base of Azure CLI 2.64.0 has changed from Alpine to CBL Mariner 2.0. This change may introduce some breaking changes that could cause failures in bicep. We will investigate this issue during our work hours. Let's keep track of the issue in https://github.com/Azure/azure-cli/issues/29828.

rubenmamo commented 2 months ago

@MoChilia thanks for your reply. I had in fact already applied that on my workflows once I figured out that the issue is due to the azure cli image

MoChilia commented 2 months ago

@rubenmamo, please try the solution mentioned in this blog. Temporarily, you have to install the icu package manually with tdnf install -y icu. We're now collaborating with the Bicep team to resolve the issue in Azure CLI version 2.65.0.

verschaevesiebe commented 2 months ago

Having this as well in 2.64.0 pinning 2.63.0 resolved the issue 👍🏽

Thanks for this thread. For anyone wondering this is the fix.

     - name: Azure CLI Action
        uses: Azure/cli@v2
        with:
          azcliversion: 2.63.0
          inlineScript: az stack sub create
            --name baseline-
            .......