Azure/arm-ttk

System.Collections.Generic.KeyNotFoundException: The given key 'file:///D:/a/1/s/source/bicep/.avm/res/sql/server/database/backup-short-term-retention-policy/main.bicep' was not present in the dictionary.

aavdberg opened this issue · 4 comments

When I am running the ARM-TTK tests in Azure DevOps pipeline I am getting the following error.

Installed Version: 0.23

Latest Version: 0.24

System.Collections.Generic.KeyNotFoundException: The given key 'file:///D:/a/1/s/source/bicep/.avm/res/sql/server/database/backup-short-term-retention-policy/main.bicep' was not present in the dictionary.

I am using the https://github.com/Azure/bicep-registry-modules/tree/main/avm/res/sql/server modules.

Is this something wrong in the ARM-TTK or in the module @sam-cogan ?

Sounds like it could be the extension at fault here. Could you provide the full error from the pipeline, and details of how you setup the task please?

Looks like his problem: Azure/bicep#5175

But using version Bicep CLI version 0.25.3

the total error is:

at System.Collections.Generic.Dictionary2.get_Item(TKey) at Bicep.Core.Workspaces.SourceFileGroupingBuilder.<ReportFailuresForCycles>b__16_5(Uri fileUri) at System.Linq.Enumerable.SelectEnumerableIterator2.MoveNext()
at Bicep.Core.Extensions.EnumerableExtensions.WhereNotNull[T](IEnumerable1 source)+MoveNext() at System.Linq.Enumerable.DistinctIterator1.MoveNext()
at System.Linq.Enumerable.SelectEnumerableIterator2.MoveNext() at System.Linq.Enumerable.SelectManySingleSelectorIterator2.MoveNext()
at System.Linq.Lookup2.Create[TSource](IEnumerable1, Func2, Func2, IEqualityComparer1) at System.Linq.Enumerable.ToLookup[TSource,TKey,TElement](IEnumerable1, Func2, Func2, IEqualityComparer1 ) at System.Linq.Enumerable.ToLookup[TSource,TKey,TElement](IEnumerable1, Func2, Func2)
at Bicep.Core.Workspaces.SourceFileGroupingBuilder.ReportFailuresForCycles()
at Bicep.Core.Workspaces.SourceFileGroupingBuilder.Build(Uri entryFileUri, IFeatureProviderFactory featuresFactory, ImmutableHashSet1 sourceFilesToRebuild) at Bicep.Core.Workspaces.SourceFileGroupingBuilder.Rebuild(IFeatureProviderFactory featuresFactory, IModuleDispatcher moduleDispatcher, IReadOnlyWorkspace workspace, SourceFileGrouping current) at Bicep.Core.BicepCompiler.CreateCompilation(Uri bicepUri, IReadOnlyWorkspace workspace, Boolean skipRestore, Boolean forceRestore) at Bicep.Cli.Commands.BuildCommand.RunAsync(BuildArguments args) at Bicep.Cli.Program.RunAsync(String[] args, CancellationToken cancellationToken) at Bicep.Cli.Program.<>c__DisplayClass3_0.<<Main>b__0>d.MoveNext() --- End of stack trace from previous location --- at Bicep.Cli.Program.RunWithCancellationAsync(Func2 runFunc)
at Bicep.Cli.Program.Main(String[] args)
at Bicep.Cli.Program.

(String[] args)

Ok, so looks like it's actually an issue with Bicep, probably at the point where the template is being transpiled to ARM, so before it gets to the TTK. If you run Bicep build manually from the CLI, does the same issue occur?
Assuming it does, you probably need to raise it in the Bicep repo.

Thank you @sam-cogan I commented out the ARM-TTK task in the pipeline and ran it again and then i got an error from the task that did bicep build.

Already opened an issue at Bicep.