Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow duplicated resources (by name) if at most one is unconditional #15909

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

jeskew
Copy link
Contributor

@jeskew jeskew commented Dec 20, 2024

Resolves #1410

There are a couple of updates to this check included as well:

  • The check is also applied to existing resources (since duplicates are not allowed in symbolic name templates)
  • The check is based on the type of the name rather than the syntax, so it will catch duplicates that use a reference or expression
Microsoft Reviewers: Open in CodeFlow

Copy link
Contributor

github-actions bot commented Dec 20, 2024

Test this change out locally with the following install scripts (Action run 12485439009)

VSCode
  • Mac/Linux
    bash <(curl -Ls https://aka.ms/bicep/nightly-vsix.sh) --run-id 12485439009
  • Windows
    iex "& { $(irm https://aka.ms/bicep/nightly-vsix.ps1) } -RunId 12485439009"
Azure CLI
  • Mac/Linux
    bash <(curl -Ls https://aka.ms/bicep/nightly-cli.sh) --run-id 12485439009
  • Windows
    iex "& { $(irm https://aka.ms/bicep/nightly-cli.ps1) } -RunId 12485439009"

Copy link
Contributor

github-actions bot commented Dec 20, 2024

Dotnet Test Results

    78 files   -     39      78 suites   - 39   29m 29s ⏱️ - 19m 10s
11 570 tests  -     20  11 570 ✅  -     20  0 💤 ±0  0 ❌ ±0 
26 870 runs   - 13 412  26 870 ✅  - 13 412  0 💤 ±0  0 ❌ ±0 

Results for commit 9776c42. ± Comparison against base commit b732155.

This pull request removes 1846 and adds 636 tests. Note that renamed tests count towards both.

		nestedProp1: 1
		nestedProp2: 2
		prop1: true
		prop2: false
	1
	2
	\$'")
	prop1: true
	prop2: false
…
Bicep.Core.IntegrationTests.AzTypesViaRegistryTests ‑ Bicep_compiler_handles_corrupted_extension_package_gracefully (\u001f�\u0008\u0000\u0000\u0000\u0000\u0000\u0000
�ӽ\u000e� \u0010\u0007p�>\u0005O�w\u0008�\u000e�\u001d�
�5�G�F45i��šI\u0007M\u0017�M�o��p@�"��~[�C�xa�6�`s��(5�>@�\u000c�\u0005\u0018�֡���O2��m�(K���d�m{��\u0002)�`2�\�$	)߄���\u001e�m�E�.��9q��\u001b\u001a����/\u001a�z��o=ѧ�\u0003H��Ri@\u0019M!�8T�E2����?֞ ��(Z�\u0013z���\u0000\u000c\u0000\u0000,"The path: index.json was not found in artifact contents")
Bicep.Core.IntegrationTests.AzTypesViaRegistryTests ‑ Bicep_compiler_handles_corrupted_extension_package_gracefully (\u001f�\u0008\u0000\u0000\u0000\u0000\u0000\u0000
��A\u000b�0\u0014\u0007��\u0014�\u000f0���4�\u0010t�\u0008\u000b��1r��\u0016j �囇�tQ\u000b���`o\u001b�\u0011w���V�.+\u0002\�K�Ш\u0001�߹�b���\u000bET
\u0001\u0008�f�I:ܫZ�f�)��A\bUg����\u0004��\u0006\u0001�!�`3S:��X�o�>GY��\�k�v�=��>�������ҧ�Sn��K�\u0003���?\u0008��O��?��É��b\u0013/���6q����ߞɲ,�\u001a�\u0013��/\u001b\u0000\u000c\u0000\u0000,"'7' is an invalid end of a number. Expected a delimiter. Path: $.INVALID_JSON | LineNumber: 0 | BytePositionInLine: 20.")
Bicep.Core.IntegrationTests.AzTypesViaRegistryTests ‑ Bicep_compiler_handles_corrupted_extension_package_gracefully (\u001f�\u0008\u0000\u0000\u0000\u0000\u0000\u0000
���\u000b�0\u0014\u0007��+����t{Z�KХ?`鋌4q\u0006B��7\u000f�E�⏠}Nc{�����\u0016u��a\u0010(�\u0019\u0019\u001b�@�����\u0011\u0011�\u001b'<R \u0008������F׶�9��AALu�\u0017��(T\u001cb\u001e�L�\u001d\u000b��k�КX�J7�$/3l���ʮ�\u0018*_��΀��MwE���CI�\u001f\u0010\u0006�%t�\u0007�l5�%����\u0007�\u000e%�\u0015�
f;,�X{\u001bz�W�ϥ{s\u001c�q��\u0002�\u0017��\u0000\u000c\u0000\u0000,"Value cannot be null. (Parameter 'source')")
Bicep.Core.IntegrationTests.AzTypesViaRegistryTests ‑ Bicep_compiler_handles_corrupted_extension_package_gracefully (\u001f�\u0008\u0000\u0000\u0000\u0000\u0000\u0000\u0003��K
�0\u0010\u0006�=EO��$�Ǧ{�^!h�\u0007M�M� ��t!�hqS[�|�\u000c�L\u0018~��\�-ݡlZ.��9gs�H\u0013��\u000fP!C�\u0002\u000c�"�X�ϾɈ�
���,1�\u0007	��p��\u0002�T�- qk\u0011��M��'k�]]8\u0016����������PM5���d����5�S�\u0001\u0004C2Rh �t�?���_$�����c�
�$I�5<\u0001yB�`\u0000\u000c\u0000\u0000,"The path: index.json was not found in artifact contents")
Bicep.Core.IntegrationTests.AzTypesViaRegistryTests ‑ Bicep_compiler_handles_corrupted_extension_package_gracefully (\u001f�\u0008\u0000\u0000\u0000\u0000\u0000\u0000\u0003��K
�0\u0010\u0006�=E�\u0001��m\u0005�n\u00047\u001e �\u0011\u0015[��P\u0010�n�\u00107-n�\u0003̷L\u0006f��������+��L
!nj\u000c
"�T�y�+K�}\u0000\u0002Vk �6�O��⃫�(����Ą��/qƭ�`&q\u0019,\u0007e��G�n�w�szva7�W\u00056��OU[^�����I������U�A*\u0012�\u0000)\u000c(�
\u0001�����H&�<�W��*lθ	X,�\c�M��\u001d=޾=[�$I�>w~�(�\u0000\u000c\u0000\u0000,"Value cannot be null. (Parameter 'source')")
Bicep.Core.IntegrationTests.AzTypesViaRegistryTests ‑ Bicep_compiler_handles_corrupted_extension_package_gracefully (\u001f�\u0008\u0000\u0000\u0000\u0000\u0000\u0000\u0003��O\u000b�0\u0014\u0000��\u0014�\u000f0���\u0006\u001e�\u000e\u0019aA�5F\u000e2�B
��|�\u0010]�.jA�\u001dv�{�7\u001e�!����ѩ)+\u0014P\u001a�\u0008\u000c
[����\u0016a\u0012\u0010��\u0001��c\u0000`3x%\u001d�U�K[�\u0014o� �����DD\u0006\u001c\u000be���
\u0015crfc��\u0018	�M��(+RӠKu-���/���tz��7�\u001b��\u001fS\u0006�\u000e\u0008���s\u0001�hO\u0000'��?���\u0017'��&^\u001e��m�͡��߮�q\u001c�\u0019�\u0013�$��\u0000\u000c\u0000\u0000,"'7' is an invalid end of a number. Expected a delimiter. Path: $.INVALID_JSON | LineNumber: 0 | BytePositionInLine: 20.")
Bicep.Core.IntegrationTests.AzTypesViaRegistryTests ‑ Repository_not_found_in_registry (ArtifactRegistryAddress { RegistryAddress = mcr.microsoft.com, RepositoryPath = unknown/path/az, ExtensionVersion = 0.0.0-placeholder },Azure.RequestFailedException: The artifact does not exist in the registry.
   at Bicep.Core.Registry.AzureContainerRegistryManager.DownloadManifestAndLayersAsync(IOciArtifactReference artifactReference, ContainerRegistryContentClient client) in /home/runner/work/bicep/bicep/src/Bicep.Core/Registry/AzureContainerRegistryManager.cs:line 138
   at Bicep.Core.Registry.AzureContainerRegistryManager.DownloadManifestAndLayersAsync(IOciArtifactReference artifactReference, ContainerRegistryContentClient client) in /home/runner/work/bicep/bicep/src/Bicep.Core/Registry/AzureContainerRegistryManager.cs:line 138,[(BCP192, Error, Unable to restore the artifact with reference "br:mcr.microsoft.com/unknown/path/az:0.0.0-placeholder": The artifact does not exist in the registry.)])
Bicep.Core.IntegrationTests.AzTypesViaRegistryTests ‑ Repository_not_found_in_registry (ArtifactRegistryAddress { RegistryAddress = mcr.microsoft.com, RepositoryPath = unknown/path/az, ExtensionVersion = 0.0.0-placeholder },Azure.RequestFailedException: The artifact does not exist in the registry.
   at Bicep.Core.Registry.AzureContainerRegistryManager.DownloadManifestAndLayersAsync(IOciArtifactReference artifactReference, ContainerRegistryContentClient client) in D:\a\bicep\bicep\src\Bicep.Core\Registry\AzureContainerRegistryManager.cs:line 138
   at Bicep.Core.Registry.AzureContainerRegistryManager.DownloadManifestAndLayersAsync(IOciArtifactReference artifactReference, ContainerRegistryContentClient client) in D:\a\bicep\bicep\src\Bicep.Core\Registry\AzureContainerRegistryManager.cs:line 138,[(BCP192, Error, Unable to restore the artifact with reference "br:mcr.microsoft.com/unknown/path/az:0.0.0-placeholder": The artifact does not exist in the registry.)])
Bicep.Core.IntegrationTests.AzTypesViaRegistryTests ‑ Repository_not_found_in_registry (ArtifactRegistryAddress { RegistryAddress = unknown.registry.azurecr.io, RepositoryPath = bicep/extensions/az, ExtensionVersion = 0.0.0-placeholder },System.AggregateException: Retry failed after 4 tries. Retry settings can be adjusted in ClientOptions.Retry or by configuring a custom retry policy in ClientOptions.RetryPolicy. (No such host is known. (unknown.registry.azurecr.io:443)) (No such host is known. (unknown.registry.azurecr.io:443)) (No such host is known. (unknown.registry.azurecr.io:443)) (No such host is known. (unknown.registry.azurecr.io:443))
   at Bicep.Core.Registry.AzureContainerRegistryManager.DownloadManifestAndLayersAsync(IOciArtifactReference artifactReference, ContainerRegistryContentClient client) in /home/runner/work/bicep/bicep/src/Bicep.Core/Registry/AzureContainerRegistryManager.cs:line 138
   at Bicep.Core.Registry.AzureContainerRegistryManager.<>c__DisplayClass4_0.<<PullArtifactAsync>g__DownloadManifestInternalAsync|0>d.MoveNext() in /home/runner/work/bicep/bicep/src/Bicep.Core/Registry/AzureContainerRegistryManager.cs:line 44
--- End of stack trace from previous location ---
   at Bicep.Core.Registry.AzureContainerRegistryManager.PullArtifactAsync(RootConfiguration configuration, IOciArtifactReference artifactReference) in /home/runner/work/bicep/bicep/src/Bicep.Core/Registry/AzureContainerRegistryManager.cs:line 51
   at Bicep.Core.Registry.AzureContainerRegistryManager.DownloadManifestAndLayersAsync(IOciArtifactReference artifactReference, ContainerRegistryContentClient client) in /home/runner/work/bicep/bicep/src/Bicep.Core/Registry/AzureContainerRegistryManager.cs:line 138
   at Bicep.Core.Registry.AzureContainerRegistryManager.<>c__DisplayClass4_0.<<PullArtifactAsync>g__DownloadManifestInternalAsync|0>d.MoveNext() in /home/runner/work/bicep/bicep/src/Bicep.Core/Registry/AzureContainerRegistryManager.cs:line 44
--- End of stack trace from previous location ---
   at Bicep.Core.Registry.AzureContainerRegistryManager.PullArtifactAsync(RootConfiguration configuration, IOciArtifactReference artifactReference) in /home/runner/work/bicep/bicep/src/Bicep.Core/Registry/AzureContainerRegistryManager.cs:line 63
   at Bicep.Core.Registry.OciArtifactRegistry.TryRestoreArtifactAsync(RootConfiguration configuration, OciArtifactReference reference) in /home/runner/work/bicep/bicep/src/Bicep.Core/Registry/OciArtifactRegistry.cs:line 495,[(BCP192, Error, Unable to restore the artifact with reference "br:unknown.registry.azurecr.io/bicep/extensions/az:0.0.0-placeholder": Retry failed after 4 tries. Retry settings can be adjusted in ClientOptions.Retry or by configuring a custom retry policy in ClientOptions.RetryPolicy. (No such host is known. (unknown.registry.azurecr.io:443)) (No such host is known. (unknown.registry.azurecr.io:443)) (No such host is known. (unknown.registry.azurecr.io:443)) (No such host is known. (unknown.registry.azurecr.io:443)))])
Bicep.Core.IntegrationTests.AzTypesViaRegistryTests ‑ Repository_not_found_in_registry (ArtifactRegistryAddress { RegistryAddress = unknown.registry.azurecr.io, RepositoryPath = bicep/extensions/az, ExtensionVersion = 0.0.0-placeholder },System.AggregateException: Retry failed after 4 tries. Retry settings can be adjusted in ClientOptions.Retry or by configuring a custom retry policy in ClientOptions.RetryPolicy. (No such host is known. (unknown.registry.azurecr.io:443)) (No such host is known. (unknown.registry.azurecr.io:443)) (No such host is known. (unknown.registry.azurecr.io:443)) (No such host is known. (unknown.registry.azurecr.io:443))
   at Bicep.Core.Registry.AzureContainerRegistryManager.DownloadManifestAndLayersAsync(IOciArtifactReference artifactReference, ContainerRegistryContentClient client) in D:\a\bicep\bicep\src\Bicep.Core\Registry\AzureContainerRegistryManager.cs:line 138
   at Bicep.Core.Registry.AzureContainerRegistryManager.<>c__DisplayClass4_0.<<PullArtifactAsync>g__DownloadManifestInternalAsync|0>d.MoveNext() in D:\a\bicep\bicep\src\Bicep.Core\Registry\AzureContainerRegistryManager.cs:line 44
--- End of stack trace from previous location ---
   at Bicep.Core.Registry.AzureContainerRegistryManager.PullArtifactAsync(RootConfiguration configuration, IOciArtifactReference artifactReference) in D:\a\bicep\bicep\src\Bicep.Core\Registry\AzureContainerRegistryManager.cs:line 51
   at Bicep.Core.Registry.AzureContainerRegistryManager.DownloadManifestAndLayersAsync(IOciArtifactReference artifactReference, ContainerRegistryContentClient client) in D:\a\bicep\bicep\src\Bicep.Core\Registry\AzureContainerRegistryManager.cs:line 138
   at Bicep.Core.Registry.AzureContainerRegistryManager.<>c__DisplayClass4_0.<<PullArtifactAsync>g__DownloadManifestInternalAsync|0>d.MoveNext() in D:\a\bicep\bicep\src\Bicep.Core\Registry\AzureContainerRegistryManager.cs:line 44
--- End of stack trace from previous location ---
   at Bicep.Core.Registry.AzureContainerRegistryManager.PullArtifactAsync(RootConfiguration configuration, IOciArtifactReference artifactReference) in D:\a\bicep\bicep\src\Bicep.Core\Registry\AzureContainerRegistryManager.cs:line 63
   at Bicep.Core.Registry.OciArtifactRegistry.TryRestoreArtifactAsync(RootConfiguration configuration, OciArtifactReference reference) in D:\a\bicep\bicep\src\Bicep.Core\Registry\OciArtifactRegistry.cs:line 495,[(BCP192, Error, Unable to restore the artifact with reference "br:unknown.registry.azurecr.io/bicep/extensions/az:0.0.0-placeholder": Retry failed after 4 tries. Retry settings can be adjusted in ClientOptions.Retry or by configuring a custom retry policy in ClientOptions.RetryPolicy. (No such host is known. (unknown.registry.azurecr.io:443)) (No such host is known. (unknown.registry.azurecr.io:443)) (No such host is known. (unknown.registry.azurecr.io:443)) (No such host is known. (unknown.registry.azurecr.io:443)))])
…

♻️ This comment has been updated with latest results.

# Conflicts:
#	src/Bicep.Core.IntegrationTests/ScenarioTests.cs
#	src/Bicep.Core.Samples/Files/baselines/Resources_CRLF/main.json
#	src/Bicep.Core.Samples/Files/baselines/Resources_CRLF/main.symbolicnames.json
@jeskew jeskew requested a review from Copilot December 24, 2024 19:19

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 18 out of 34 changed files in this pull request and generated no comments.

Files not reviewed (16)
  • src/Bicep.Core.Samples/Files/baselines/Dependencies_LF/main.bicep: Language not supported
  • src/Bicep.Core.Samples/Files/baselines/Dependencies_LF/main.diagnostics.bicep: Language not supported
  • src/Bicep.Core.Samples/Files/baselines/Dependencies_LF/main.formatted.bicep: Language not supported
  • src/Bicep.Core.Samples/Files/baselines/Dependencies_LF/main.ir.bicep: Language not supported
  • src/Bicep.Core.Samples/Files/baselines/Dependencies_LF/main.json: Language not supported
  • src/Bicep.Core.Samples/Files/baselines/Dependencies_LF/main.sourcemap.bicep: Language not supported
  • src/Bicep.Core.Samples/Files/baselines/Dependencies_LF/main.symbolicnames.json: Language not supported
  • src/Bicep.Core.Samples/Files/baselines/Dependencies_LF/main.symbols.bicep: Language not supported
  • src/Bicep.Core.Samples/Files/baselines/Dependencies_LF/main.syntax.bicep: Language not supported
  • src/Bicep.Core.Samples/Files/baselines/Dependencies_LF/main.tokens.bicep: Language not supported
  • src/Bicep.Core.Samples/Files/baselines/InvalidModules_LF/main.diagnostics.bicep: Language not supported
  • src/Bicep.Core.Samples/Files/baselines/InvalidResources_CRLF/main.diagnostics.bicep: Language not supported
  • src/Bicep.Core.Samples/Files/baselines/Resources_CRLF/main.bicep: Language not supported
  • src/Bicep.Core.Samples/Files/baselines/Resources_CRLF/main.diagnostics.bicep: Language not supported
  • src/Bicep.Core.Samples/Files/baselines/Resources_CRLF/main.formatted.bicep: Language not supported
  • src/Bicep.Core.Samples/Files/baselines/Resources_CRLF/main.ir.bicep: Language not supported
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Two mutually-exclusive conditional resources with the same type and name will throw name validation error
1 participant